Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(2) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

fstat(2)

stat(2)

stat(5)



access(2)                      DG/UX R4.11MU05                     access(2)


NAME
       access - determine the accessibility of a file

SYNOPSIS
       #include <unistd.h>

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

   where:
       path      Address of a pathname naming a file of type ordinary,
                 directory, FIFO, block special, character special, or
                 symbolic link.

       amode     Access mode bit pattern

DESCRIPTION
       Access checks that the calling process has specified access rights to
       the file.  If path refers to a symbolic link, the target of the
       symbolic link is checked, not the symbolic link.  The types of access
       requested are indicated by amode, which can have the following
       values:

       F_OK
              Check the existence of a file.

       X_OK
              Check for execute access.  Applied to a directory, execute
              permission allows the directory to be used in a pathname.

       W_OK
              Check for write access.  Applied to a directory, write
              permission allows the creation and deletion of links in the
              directory.

       R_OK
              Check for read access.  Applied to a directory, read
              permission allows the contents of the directory to be listed.

       EFF_ONLY_OK   Check using the effective ID.

       EXEC_OK   Check for a regular executable file.

       Some combination (logical OR) of X_OK, W_OK, and R_OK.

       Write access is categorically denied when the file is of type
       ordinary, directory, or FIFO and resides on a read-only file system
       device.  In this case, errno is set to EROFS.

       In all other situations, a process with a real user id of 0 is
       granted all access rights.  Other processes are granted access only
       if the file's mode gives them all types of access requested.

       When determined by the file's mode, access is checked with respect to
       only one of the owner, group, and other subsets of the mode.  If the
       process's real user id matches the file's user id, the owner bits of
       the file mode determine access.  If the process's real user id
       doesn't match, but its real group id matches the file's group id or
       one of the group ids in its group set matches the file's group id,
       the group bits of the file mode determine access.  In all other
       cases, the 'other' mode bits determine access.

       Note that this call does not guarantee that a file is writable or
       executable if write or execute access is granted.  For instance, a
       directory's mode may give the caller write access, indicating that
       files may be created in it, but an open of the directory for write
       intent will fail.

ACCESS CONTROL
       The caller must have permission to resolve path.  This call differs
       from others in that the process's real user id is used to determine
       permission to resolve a pathname, rather than its effective user id.

RETURN VALUE
       0              The requested access is permitted.

       -1             Access to the file is denied.  errno is set to
                      indicate the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EACCES         Permission bits of the file mode do not permit the
                      requested access or amode is invalid. Search
                      permissions are denied.

       EROFS          Write access is requested for a file of type ordinary,
                      directory, or FIFO that resides on a file system
                      device mounted read-only.

       ENOENT         The file the pathname resolved to does not exist.

       ENOENT         A non-terminal component of the pathname does not
                      exist.

       ENOTDIR        A non-terminal component of the pathname was not a
                      directory or symbolic link.

       ENAMETOOLONG   The pathname exceeds the length limit for pathnames.

       ENAMETOOLONG   A component of the pathname exceeds the length limit
                      for filenames.

       ENOMEM         There are not enough system resources to resolve the
                      pathname or to expand a symbolic link.

       ELOOP          The number of symbolic links encountered during
                      pathname resolution exceeded MAXSYMLINKS.  A symbolic
                      link cycle is suspected.

       EPERM          The pathname contains a character not in the allowed
                      character set.

       EFAULT         The pathname does not completely reside in the
                      process's address space or the pathname does not
                      terminate in the process's address space.

SEE ALSO
       chmod(2), fstat(2), stat(2), stat(5).


Licensed material--property of copyright holder(s)

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