ACCESS(2,L) AIX Technical Reference ACCESS(2,L)
-------------------------------------------------------------------------------
access
PURPOSE
Determines the accessibility of a file.
SYNTAX
#include <unistd.h>
int access (path, amode)
char *path;
int amode;
DESCRIPTION
The access system call checks the accessibility of the file specified by the
path parameter. If path refers to a symbolic link, the access system call
returns information about the file pointed to by the symbolic link.
Access permission to all components of the path parameter is determined by
using the real user ID instead of the effective user ID and the concurrent
group set (without the effective group ID) along with the real group ID.
The bit pattern contained in amode is constructed by logically ORing the
following values:
R_OK Checks read permission.
W_OK Checks write permission.
X_OK Checks execute (search) permission.
F_OK Checks to see if the file exists.
The owner of a file has access checked with respect to the owner read, write,
and execute mode bits. Members of the file's group other than the owner have
access checked with respect to the group mode bits. All others have access
checked with respect to the other mode bits.
RETURN VALUE
If the requested access is permitted, a value of 0 is returned. If the
requested access is denied, a value of -1 is returned and errno is set to
indicate the error.
ERROR CONDITIONS
Access to the file is denied if one or more of the following are true:
ENOTDIR A component of the path prefix is not a directory.
Processed November 7, 1990 ACCESS(2,L) 1
ACCESS(2,L) AIX Technical Reference ACCESS(2,L)
ENOENT Read, write, or execute (search) permission is requested for a null
path name.
ENOENT The named file does not exist.
EACCES Search permission is denied on a component of the path prefix.
EACCES Permission bits of the file mode do not permit the requested access.
EROFS Write access is requested for a file on a read-only file system.
ETXTBSY Write access is requested for a pure procedure (shared text) file
that is being executed.
EFAULT The path parameter points to a location outside of the process's
allocated address space.
ESTALE The process's root or current directory is located in an NFS virtual
file system that has been unmounted.
ENAMETOOLONG
A component of the path parameter exceeded NAME_MAX characters or the
entire path parameter exceeded PATH_MAX characters.
ENOENT A hidden directory was named, but no component inside it matched the
process's current site path list.
ENOENT A symbolic link was named, but the file to which it refers does not
exist.
ELOOP A loop of symbolic links was detected.
ENFILE The system inode table is full.
If the Transparent Computing Facility is installed on your system, access can
also fail if one or more of the following are true:
ESITEDN1 path cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE path is a name relative to the working directory, but no site which
stores this directory is currently up.
ENOSTORE A component of path is replicated but is not stored on any site which
is currently up.
EROFS Write access is requested for a file on a replicated file system in
which the primary copy is unavailable.
EINTR A signal was caught during the access system call. This can occur if
the internal open of this file is suspended during topology change.
Processed November 7, 1990 ACCESS(2,L) 2
ACCESS(2,L) AIX Technical Reference ACCESS(2,L)
RELATED INFORMATION
In this book: "chmod, fchmod" and "statx, fstatx, stat, fstat, fullstat,
ffullstat, lstat."
Processed November 7, 1990 ACCESS(2,L) 3