HPUX access[2]



access in anderen Kapiteln des hpux Handbuch: access.3f




 access(2)                                                         access(2)





 NAME
      access - determine accessibility of a file

 SYNOPSIS
      #include <unistd.h>

      int access(char *path, int amode);

 DESCRIPTION
      path points to a path name naming a file.  access() checks the named
      file for accessibility according to the bit pattern contained in
      amode, using the real user ID instead of the effective user ID and the
      real group ID instead of the effective group ID.  The value of amode
      is either the bit-wise inclusive OR of the access permissions to be
      checked or the existence test.  The following symbolic constants,
      defined in <unistd.h>, test for permissions:

           R_OK    read
           W_OK    write
           X_OK    execute (search)
           F_OK    check existence of file

    Access Control Lists (ACLs)
      Read, write and execute/search permissions are checked against the
      file's access control list.  Each mode is checked separately since
      different ACL entries might grant different permissions.  The real
      user ID is combined with the process's real group ID and each group in
      its supplementary groups list, and the access control list is searched
      for a match.  Search proceeds in order of specificity and ends when
      one or more matching entries are found at a specific level.  More than
      one u.g or %.g entry can match a user if that user has a non-null
      supplementary groups list.  If any matching entry has the appropriate
      permission bit set, access is permitted.

      access() reports that a shared text file currently open for execution
      is not writable, regardless of its access control list.  It also
      reports that a file on a read-only file system is not writable.
      However, access() does not report that a shared text file open for
      writing is not executable, since the check is not easily done.

 RETURN VALUE
      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.

 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.





 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 access(2)                                                         access(2)





           [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]       The access control list does not permit the
                          requested access and the real user ID is not a
                          user with appropriate privileges.

           [EFAULT]       path points outside the allocated address space
                          for the process.  The reliable detection of this
                          error is implementation dependent.

           [ELOOP]        Too many symbolic links were encountered in
                          translating the path name.

           [ENAMETOOLONG] The length of the specified path name exceeds
                          PATH_MAX bytes, or the length of a component of
                          the path name exceeds NAME_MAX bytes while
                          _POSIX_NO_TRUNC is in effect.

      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.

      access() reports that a file currently open for execution is not
      writable, regardless of the setting of its mode.

 WARNINGS
      If the path is valid and the real user ID is super-user, and the
      access requested is not X_OK, access() always returns 0.  If X_OK
      access is requested for a valid path and the real user ID is super-
      user and the file is a directory, access always returns 0.  If X_OK
      access is requested for a valid path which is not a directory and the
      real user ID is super-user, access returns 0 only if at least one
      execute bit (for user, group, or other) is set in the file's mode.

    Access Control Lists
      Access control list descriptions in this entry apply only to standard
      HP-UX operating systems.  If HP-UX BLS software has been installed,



 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992






 access(2)                                                         access(2)





      access control lists are handled differently.  Refer to HP-UX BLS
      documentation for information about access control lists in the HP-UX
      BLS environment.

 SEE ALSO
      chmod(2), setacl(2), stat(2), acl(5), unistd(5).

 STANDARDS CONFORMANCE
      access(): AES, SVID2, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1













































 Hewlett-Packard Company            - 3 -     HP-UX Release 9.0: August 1992