Annotation of cci/usr/src/man/man2/access.2, revision 1.1

1.1     ! root        1: .TH ACCESS 2 "18 July 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: access \- determine accessibility of file
        !             5: .SH SYNOPSIS
        !             6: .nf
        !             7: .ft B
        !             8: #include <sys/file.h>
        !             9: .PP
        !            10: .ft B
        !            11: .ta 1.25i 1.6i
        !            12: #define R_OK   4       /* test for read permission */
        !            13: #define W_OK   2       /* test for write permission */
        !            14: #define X_OK   1       /* test for execute (search) permission */
        !            15: #define F_OK   0       /* test for presence of file */
        !            16: .PP
        !            17: .ft B
        !            18: accessible = access(path, mode)
        !            19: int accessible;
        !            20: char *path;
        !            21: int mode;
        !            22: .ft R
        !            23: .fi
        !            24: .SH DESCRIPTION
        !            25: .I Access
        !            26: checks the given
        !            27: file
        !            28: .I path
        !            29: for accessibility according to
        !            30: .IR mode ,
        !            31: which is an inclusive or of the bits
        !            32: R_OK,
        !            33: W_OK
        !            34: and
        !            35: X_OK.
        !            36: Specifying
        !            37: .I mode
        !            38: as F_OK (i.e. 0)
        !            39: tests whether the directories leading to the file can be
        !            40: searched and the file exists.
        !            41: .PP
        !            42: The real user ID and the group access list
        !            43: (including the real group ID) are
        !            44: used in verifying permission, so this call
        !            45: is useful to set-UID programs.
        !            46: .PP
        !            47: Notice that only access bits are checked.
        !            48: A directory may be indicated as writable by
        !            49: .IR access ,
        !            50: but an attempt to open it for writing will fail
        !            51: (although files may be created there);
        !            52: a file may look executable, but
        !            53: .I execve
        !            54: will fail unless it is in proper format.
        !            55: .SH "RETURN VALUE
        !            56: If
        !            57: .I path
        !            58: cannot be found or if any of the desired access modes would
        !            59: not be granted, then a \-1 value is returned; otherwise
        !            60: a 0 value is returned.
        !            61: .SH "ERRORS
        !            62: Access to the file is denied if one or more of the following are true:
        !            63: .TP 15
        !            64: [ENOTDIR]
        !            65: A component of the path prefix is not a directory.
        !            66: .TP 15
        !            67: [ENOENT]
        !            68: The argument path name was too long.
        !            69: .TP 15
        !            70: [ENOENT]
        !            71: Read, write, or execute (search) permission is requested for a null
        !            72: path name or the named file does not exist.
        !            73: .TP 15
        !            74: [EPERM]
        !            75: The argument contains a byte with the high-order bit set.
        !            76: .TP 15
        !            77: [ELOOP]
        !            78: Too many symbolic links were encountered in translating the pathname.
        !            79: .TP 15
        !            80: [EROFS]
        !            81: Write access is requested for a file on a read-only file system.
        !            82: .TP 15
        !            83: [ETXTBSY]
        !            84: Write access is requested for a pure procedure (shared text)
        !            85: file that is being executed.
        !            86: .TP 15
        !            87: [EACCES]
        !            88: Permission bits of the file mode do not permit the requested
        !            89: access; or search permission is denied on a component of the
        !            90: path prefix.  The owner of a file has permission checked with
        !            91: respect to the ``owner'' read, write, and execute mode bits,
        !            92: members of the file's group other than the owner have permission
        !            93: checked with respect to the ``group'' mode bits, and all
        !            94: others have permissions checked with respect to the ``other''
        !            95: mode bits.
        !            96: .TP 15
        !            97: [EFAULT]
        !            98: .I Path
        !            99: points outside the process's allocated address space.
        !           100: .SH "SEE ALSO
        !           101: chmod(2), stat(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.