ACCESS(2) DOMAIN/IX SYS5 ACCESS(2)
NAME
access - determine accessibility of a file
USAGE
int access (path, amode)
char *path;
int amode;
DESCRIPTION
The path argument points to the pathname of a file. Access
checks that file for access rights according to the bit pat-
tern 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. The bit pattern contained in amode is
structured as follows:
04 read
02 write
01 execute (search)
00 check existence of file
RETURN VALUE
A successful call (indicating access is allowed) returns
zero. A failed call returns -1 and sets errno as indicated
below.
ERRORS
Access to the file is denied if one or more of the following
is true:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The call asked for the permissions of a null path-
name, i.e., path was omitted from the call.
[ENOENT] The file named does not exist.
[EACCES] Search permission is denied on a component of the
path prefix.
[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.
[EACCESS] The file's permission bits do not permit the
access requested.
Printed 12/4/86 ACCESS-1
ACCESS(2) DOMAIN/IX SYS5 ACCESS(2)
[EFAULT] Path points outside the allocated address space
for the process.
If the same user owns both the program file and the file
being checked, access checks the "owner" read, write, and
execute mode bits. If a member (other than the owner) of
the file's group owns the program, the "group" mode bits of
the file are checked. If anyone else owns the program, the
"other" mode bits determine the accessibility. (See
chmod(2) for a further explanation of the access bits.)
RELATED INFORMATION
chmod(2), stat(2)
ACCESS-2 Printed 12/4/86