Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     ACCESS(S)                 UNIX System V                 ACCESS(S)



     Name
          access - determine accessibility of a file

     Syntax
          #include <unistd.h>

          int access (path, amode)
          char *path;
          int amode;

          int eaccess(path, amode)
          char *path;
          int amode;

     Description
          The path argument points to a path name naming a file.  The
          access function checks the named file 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.  eaccess is the
          same as access except that the effective user ID and group
          ID are used. The bit pattern contained in amode is
          constructed as follows:

               04   read
               02   write
               01   execute (search)
               00   check existence of file

          The symbolic constants for the argument amode are defined by
          the <unistd.h> header file and are as follows:

               Name Description
               R_OK test for read permission.
               W_OK test for write permission.
               X_OK test for execute (search) permission.
               F_OK test for existence of file.

          The argument amode is either the logical OR of one or more
          of the values of the symbolic constants for R_OK, W_OK, and
          X_OK or is the value of the symbolic constant F_OK.

          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]      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.
       [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.
       [EACCES]      Permission bits of the file mode do not permit
                     the requested access.
       [EFAULT]      path points outside the allocated address
                     space for the process.
       [EINTR]       A signal was caught during the access
                     system call.
       [ENOLINK]     path points to a remote machine and the link
                     to that machine is no longer active.
       [EMULTIHOP]   Components of path require hopping to multiple
                     remote machines.

          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.

     See Also
          chmod(S), stat(S).

     Diagnostics
          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.

     Standards Conformance
          access is conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          The X/Open Portability Guide II of January 1987;
          IEEE POSIX Std 1003.1-1988 with C Standard Language-
          Dependent System Support;
          and NIST FIPS 151-1.

                                                (printed 6/20/89)

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