Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(2) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                access(2)



        _________________________________________________________________
        access                                                System Call
        Determine the accessibility of a file.
        _________________________________________________________________


        SYNTAX

        #include <sys/file.h>

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


        PARAMETERS

        path           Address of a pathname.


        amode          Access mode bit pattern.


        DESCRIPTION

        <Path> points to a pathname naming a file of type ordinary,
        directory, FIFO, block special, or character special, or symbolic
        link.  If <path> refers to a symbolic link, the target of the
        symbolic link is checked, not the symbolic link.  This function
        checks that the calling process has specified access rights to
        the file.  The types of access requested are indicated by
        <amode>, which can have the following values:


        F_OK    0
             Check the existence of a file.


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


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


        R_OK    4
             Check for read access.  Applied to a directory, read



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                access(2)



             permission allows the contents of the directory to be
             listed.

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

        Write access is categorically denied in two situations:

        *    The file has shared text that is currently being executed by
             some process in the system.  In this case, errno is set to
             ETXTBSY.

        *    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
        superuser 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



        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                access(2)



                       indicate the error.


        EXCEPTIONS

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


        EACCES         Permission bits of the file mode do not permit the
                       requested access.


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


        ETXTBSY        Write access is requested for a pure procedure
                       (shared text) file that is being executed by some
                       process in the system.


        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



        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                access(2)



                       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

        The related manual sections:  chmod(2), fstat(2), stat(2),
        stat(5).










































        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)



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