


ACCESS(2V)                SYSTEM CALLS                 ACCESS(2V)



NAME
     access - determine accessibility of file

SYNOPSIS
     #include <unistd.h>

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

DESCRIPTION
     _p_a_t_h points to a path name naming a file.   access()  checks
     the named file for accessibility according to _m_o_d_e, which is
     an inclusive or of the following bits:

          R_OK           test for read permission

          W_OK           test for write permission

          X_OK           test for execute or search permission

     The following value may also be supplied for _m_o_d_e:

          F_OK           test whether the directories leading  to
                         the  file  can  be searched and the file
                         exists.

     The real user ID and the supplementary group IDs  (including
     the real group ID) are used in verifying permission, so this
     call is useful to set-UID programs.

     Notice that only access bits are checked.  A  directory  may
     be indicated as writable by access(), but an attempt to open
     it for writing will fail  (although  files  may  be  created
     there);  a  file may look executable, but execve() will fail
     unless it is in proper format.

RETURN VALUES
     access() returns:

     0    on success.

     -1   on failure and sets errno to indicate the error.

ERRORS
     EACCES              Search permission is denied for  a  com-
                         ponent of the path prefix of _p_a_t_h.

                         The file access permissions do not  per-
                         mit  the  requested  access  to the file
                         named by _p_a_t_h.




Sun Release 4.1   Last change: 21 January 1990                  1






ACCESS(2V)                SYSTEM CALLS                 ACCESS(2V)



     EFAULT              _p_a_t_h points outside the process's  allo-
                         cated address space.

     EINVAL              An invalid value was specified for _m_o_d_e.

     EIO                 An I/O error occurred while reading from
                         or writing to the file system.

     ELOOP               Too many symbolic links were encountered
                         in translating _p_a_t_h.

     ENAMETOOLONG        The length of the path argument  exceeds
                         {PATH_MAX}.

                         A  pathname  component  is  longer  than
                         {NAME_MAX} while {_POSIX_NO_TRUNC} is in
                         effect (see pathconf(2V)).

     ENOENT              The file named by _p_a_t_h does not exist.

     ENOTDIR             A component of the path prefix  of  _p_a_t_h
                         is not a directory.

     EROFS               The file named by _p_a_t_h is on a read-only
                         file   system   and   write  access  was
                         requested.

SYSTEM V ERRORS
     In addtion to the above, the following may also occur:

     ENOENT              _p_a_t_h points to an empty string.

SEE ALSO
     chmod(2V), stat(2V)





















Sun Release 4.1   Last change: 21 January 1990                  2



