access, eaccess --
determine accessibility of a file
cc . . . -lc
int access (path, amode)
int eaccess (path, amode)
The access function checks the file named by
path for accessibility according to the bit pattern
contained in amode, using the real user ID in place of the
effective user ID and the real group ID
in place of the effective group ID. access
should only be used by set-UID and set-GID
programs; access is not equivalent to eaccess
even when the program is not being used by set-UID and
eaccess is similar to access except that the effective
user ID and group ID are used.
The value of amode is either the bitwise inclusive
OR of the access permissions to be checked or the
existence test as follows:
test for read permission
test for write permission
test for execute (search) permission
test for existence of file
These values are defined in the unistd.h header file.
If any access permissions are to be checked, each is checked
Access to the file is denied if one or more of the following is true:
Search permission is denied on a component of the path prefix, or
permission bits of the file mode do not permit the requested access.
A signal was caught during the access system call.
The value of amode is invalid.
Components of path require hopping
to multiple remote machines.
The length of the path argument exceeds
PATH_MAX or a pathname component is longer than
NAME_MAX while _POSIX_NO_TRUNC is in effect.
The path argument points to the name of a file that
does not exist or the path points to an empty string.
path points to a remote machine and the link
to that machine is no longer active.
A component of the path prefix is not a directory.
Write access is requested for a file on
a read-only file system.
Write access is requested for a pure procedure
(shared text) file that is being executed.
The owner of a file has permission checked with respect to
the ``owner'' read, write, and execute mode bits.
Members of the file's
group other than the owner have permissions checked with respect to the
``group'' mode bits, and all others have permissions checked with respect
to the ``other'' mode bits.