Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (a - d) access(2)
NAME
access - Determines the accessibility of a le
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int access(
const char *path,
int access_mode);
PARAMETERS
path Points to the le pathname. When the path parameter refers to a symbolic link,
the access() function returns information about the le pointed to by the sym-
bolic link.
Permission to access all components of the path parameter is determined by
using a real user ID instead of an effective user ID, and by using a real group ID
instead of an effective group ID.
access_mode Species the type of access. The bit pattern contained in the access_mode
parameter is constructed by a logical OR of values from the following list:
F_OK Checks to see whether the le exists.
R_OK Checks read permission.
W_OK Checks write permission.
X_OK Checks execute (search) permission.
DESCRIPTION
The access() function checks the accessibility of a le specied by a pathname.
Only access bits are checked. A directory can be indicated as writable by access(), but an
attempt to open it for writing could fail (although les can be created there).
To override the le access control mechanism, a process must have a user ID of the super ID.
Access Control Lists (ACLs)
Read, write, and execute/search permissions are checked against the ACL for the le. |
To determine the permission granted to the real user ID (RUID) and real group ID (RGID) of the |
accessing process, the access() function checks these things in the ACL, in order:
1. If the RUID of the process is the same as the owner of the le, grant the permissions |
specied in the user:: entry. Otherwise, continue to the next check.
2. If the RUID matches the UID specied in one of the additional user:uid: entries, grant |
the permissions specied in that entry, bitwise-ANDed with the permissions specied in |
the class entry. Otherwise, continue to the next check.
3. If the RGID or a supplementary GID of the process matches the owning GID of the le |
or one of the GIDs specied in any additional group:gid: entries, grant the permissions |
specied in the class entry bitwise-ANDed with the result of bitwise-ORing together all |
of the permissions in all matching group entries. Otherwise, continue to the next check.
4. Otherwise, grant the permissions specied in the other entry. |
527186-007 Hewlett-Packard Company 15