ACCESS(2)                        System Calls                        ACCESS(2)




NAME

       access - determine accessibility of file


SYNOPSIS

       #include <unistd.h>

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


DESCRIPTION

       path  points  to  a path name naming a file.  access() checks the named
       file for accessibility according to mode, which is an inclusive  or  of
       the following bits:

              R_OK   Test for read permission.

              W_OK   Test  for  write permission.  Under GNO, a file must have
                     all three of its GS/OS write, rename,  and  destroy  bits
                     set to be considered writable.

              X_OK   Test  for  execute  or search permission.  Under GNO, the
                     test will pass if the file is of type EXE, S16, a  direc-
                     tory, or of type SRC with an EXEC auxiliary type.

       The following value may also be supplied for mode:

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

       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  zero  on success.  On failure it returns -1 and sets
       errno.


ERRORS

       EACCES Search permission is denied for a component of the  path  prefix
              of path.

              The  file  access permissions do not permit the requested access
              to the file named by path.

       EFAULT path points outside the process's allocated address space.

       EINVAL An invalid value was specified for mode.

              The length of the path argument exceeds FILENAME_MAX.

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

       ELOOP  Too  many  symbolic  links were encountered in translating path.
              (Not currently possible under GNO.)

       ENOENT The file named by path does not exist.

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


SYSTEM V ERRORS

       In addtion to the above, the following may also occur:

       ENOENT path points to an empty string.


BUGS

       Nothing special is done for the AppleShare FST.


SEE ALSO

       chmod(2V), stat(2V)



GNO                             16 January 1997                      ACCESS(2)

Man(1) output converted with man2html