Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(S)

stat(S)


 access(S)                      6 January 1993                      access(S)


 Name

    access, eaccess - determine accessibility of a file

 Syntax


    cc  . . .  -lc


    #include <unistd.h>

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

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


 Description

    The access function checks the file named by path 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.  access should only be used by set-UID and set-GID
    programs; access is not equivalent to eaccess even when the program is
    not being used by set-UID and set-GID.

    eaccess is similar to access except that the effective user ID and group
    ID are used.

    The value of amode is either the bitwise inclusive OR of the access per-
    missions to be checked or the existence test as follows:


    _________________________________________________________________________
    Name           Description
    _________________________________________________________________________
    ROK           test for read permission
    WOK           test for write permission
    XOK           test for execute (search) permission
    FOK           test for existence of file


    These values are defined in the unistd.h header file.

    If any access permissions are to be checked, each is checked individu-
    ally.

    Access to the file is denied if one or more of the following is true:


    [EACCES]       Search permission is denied on a component of the path
                   prefix, or permission bits of the file mode do not permit
                   the requested access.

    [EINTR]        A signal was caught during the access system call.

    [EINVAL]       The value of amode is invalid.

    [EMULTIHOP]    Components of path require hopping to multiple remote ma-
                   chines.

    [ENAMETOOLONG] The length of the path argument exceeds PATHMAX or a
                   pathname component is longer than NAMEMAX while
                   POSIXNOTRUNC is in effect.

    [ENOENT]       The path argument points to the name of a file that does
                   not exist or the path points to an empty string.

    [ENOLINK]      path points to a remote machine and the link to that ma-
                   chine is no longer active.

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

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

    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.  Other-
    wise, 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;
    X/Open Portability Guide, Issue 3, 1989;
    Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2);
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.

    eaccess is not part of any currently supported standard; it is an exten-
    sion of AT&T System V provided by The Santa Cruz Operation.



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