Determines the accessibility of a file.
Standard C Library (libc.a)
int access ( PathName, Mode)
int accessx (PathName, Mode, Who)
int Mode, Who;
int faccessx ( FileDescriptor, Mode, Who)
int Mode, Who;
The access, accessx, and faccessx subroutines determine the accessibility of a file system object. The accessx and faccessx subroutines allow the specification of a class of users or processes for whom access is to be checked.
The caller must have search permission for all components of the PathName parameter.
|PathName||Specifies the path name of the file. If the PathName parameter refers to a symbolic link, the access subroutine returns information about the file pointed to by the symbolic link.|
|FileDescriptor||Specifies the file descriptor of an open file.|
|Mode||Specifies the access modes to be checked. This parameter is a bit
mask containing 0 or more of the following values, which are defined in the
If none of these values are specified, the existence of a file is checked.
|Who||Specifies the class of users for whom access is to be checked.
This parameter must be one of the following values, which are defined in the
If the requested access is permitted, the access, accessx, and faccessx subroutines return a value of 0. If the requested access is not permitted or the function call fails, a value of -1 is returned and the errno global variable is set to indicate the error.
The access and
accessx subroutines fail if one or more of the following are
|EACCES||Search permission is denied on a component of the PathName prefix.|
|EFAULT||The PathName parameter points to a location outside the allocated address space of the process.|
|ELOOP||Too many symbolic links were encountered in translating the PathName parameter.|
|ENOENT||A component of the PathName does not exist or the process has the disallow truncation attribute set.|
|ENOTDIR||A component of the PathName is not a directory.|
|ESTALE||The process root or current directory is located in a virtual file system that has been unmounted.|
|ENOENT||The named file does not exist.|
|ENOENT||The PathName parameter was null.|
|ENOENT||A symbolic link was named, but the file to which it refers does not exist.|
|ENAMETOOLONG||A component of the PathName parameter exceeded 255 characters or the entire PathName parameter exceeded 1023 characters.|
The faccessx subroutine
fails if the following is true:
|EBADF||The value of the FileDescriptor parameter is not valid.|
accessx, and faccessx subroutines fail if one or more of
the following is true:
|EIO||An I/O error occurred during the operation.|
|EACCES||The file protection does not allow the requested access.|
|EROFS||Write access is requested for a file on a read-only file system.|
If Network File System (NFS) is
installed on your system, the accessx and faccessx
subroutines can also fail if the following is true:
|ETIMEDOUT||The connection timed out.|
|ETXTBSY||Write access is requested for a shared text file that is being executed.|
|EINVAL||The value of the Mode argument is invalid.|
These subroutines are part of Base Operating System (BOS) Runtime.
The acl_get (acl_get or acl_fget Subroutine) subroutine, chacl (chacl or fchacl Subroutine) subroutine, statx subroutine, statacl subroutine.
The aclget command, aclput command, chmod command, chown command.
Files, Directories, and File Systems for Programmers in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.