*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> access (2)              
Title
Content
Arch
Section
 

Contents


 access(2)                                                         access(2)




 NAME    [Toc]    [Back]
      access - determine accessibility of a file

 SYNOPSIS    [Toc]    [Back]
      #include <unistd.h>

      int access(char *path, int amode);

 DESCRIPTION    [Toc]    [Back]
      The access() system call checks the file pointed to by path for
      accessibility according to the bit pattern contained in amode.
      access() uses the real user ID, not the effective user ID, and the
      real group ID, not 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.  You can use the
      following symbolic constants, defined in <unistd.h>, to test for
      permissions:

           R_OK      Read access
           W_OK      Write access
           X_OK      Execute (search) access
           F_OK      Check existence of file

      The owner of a file has permission checked with respect to the "user"
      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.  All others have permissions checked with respect to the
      "other" mode bits.

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

    Access Control Lists - HFS File Systems Only    [Toc]    [Back]
      Read, write, and execute/search permissions are checked against the
      file's access control list (ACL).  Each mode is checked separately
      since different ACL entries can 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 user.group or %.group entry can match a user if that user has a
      nonnull supplementary groups list.  If any matching entry has the
      appropriate permission bit set, access is permitted.

    Access Control Lists - JFS File Systems Only    [Toc]    [Back]
      Read, write, and execute/search permissions are checked against the
      file's access control list (ACL).  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 ACL entries and ends when the first entry



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 access(2)                                                         access(2)




      matching the user ID or any of the group IDs is encountered.

      If a shared text file is currently open for execution, access()
      reports that it is not writable, regardless of its access control
      list.  However, access() does not report that a shared text file open
      for writing is not executable, since the check is not easily done.

      It also reports that a file on a read-only file system is not
      writable.

 RETURN VALUE    [Toc]    [Back]
      access() returns the following values:

            0   Successful completion.  The requested access is permitted.

                If the path is valid and the real user ID is superuser,
                access() always returns 0, except when amode includes X_OK,
                the path is not a directory, and none of the execute bits
                are set in the file's mode.

           -1   Failure.  errno is set to indicate the error.

 ERRORS    [Toc]    [Back]
      If access() fails, errno is set to one of the following values.

           [EACCES]       Search permission is denied on a component of the
                          path prefix.

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

           [ENOENT]       Read, write, or execute (search) permission is
                          requested for a null path name.

           [ENOENT]       The named file does not exist.

           [ENOTDIR]      A component of the path prefix is not a directory.




 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003






 access(2)                                                         access(2)




           [EROFS]        Write access is requested for a file on a readonly
 file system.

           [ETXTBSY]      Write access is requested for a pure procedure
                          (shared text) file that is being executed.

 SEE ALSO    [Toc]    [Back]
      acl(2), chmod(2), stat(2), setacl(2), acl(5), aclv(5), unistd(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      access(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1


 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
access Tru64 Determines the accessibility of a file
access FreeBSD check accessibility of a file
eaccess FreeBSD check accessibility of a file
pxfaccess IRIX Checks the accessibility of a named file
rqsread IRIX reads the information out of an ELF file that is needed to determine if the file needs to be requickstarted
isastream Tru64 Determine if a file descriptor refers to a STREAMS file
useracc FreeBSD check memory regions for accessibility
volinfo Tru64 Print accessibility and usability of volumes
kernacc FreeBSD check memory regions for accessibility
vxinfo HP-UX print accessibility and usability of volumes
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service