Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(2) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

stat(2)




access(2) access(2)
NAME access - determine accessibility of a file SYNOPSIS #include<unistd.h> int access(path,amode) char *path; int amode; DESCRIPTION access is used to determine the accessibility of a file. The path points to a pathname naming a file. access checks the named file for accessibility according to the bit pattern contained in amode, by 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 constructed as follows: 04 read 02 write 01 execute (search) 00 check existence of file For the POSIX environment, the following values are defined for passing amode as the value of <unistd.h>: R_OK 04 read W_OK 02 write X_OK 01 executable file or searchable directory F_OK 00 check existence of file STATUS MESSAGES AND VALUES If the requested access is permitted, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. The access command will fail if one or more of the following is true: ENAMETOOLONG A component of a pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX. ELOOP Too many symbolic links were encountered in translating a pathname. ENOTDIR A component of the path prefix is not a directory. ENOENT Read, write, or execute (search) permission is January 1992 1



access(2) access(2)
requested for a null pathname. ENOENT The named file 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. Note: If you are running network file system (NFS) and you are accessing a shared binary remotely, it is possible that you will not get this errno. EACCESS Permission bits of the file mode do not permit the requested access. EFAULT The path points outside the allocated address space for the process. EINVAL Value of amode is invalid. 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. The superuser is always granted execute permission even though execute permission is meaningful only for directories and regular files and even though exec requires that at least one execute mode bit is set for the regular file to be executable. Notice that only access bits are checked. A directory may be announced as writable by access, but an attempt to open it for writing will fail because writing into the directory structure itself is not allowed, even though files may be created there. A file may look executable, but exec will 2 January 1992



access(2) access(2)
fail unless it is in the proper format. SEE ALSO chmod(2), stat(2) January 1992 3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026