Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

access(2) OSS System Calls Reference Manual
NAME
access - Determines the accessibility of a file
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int access(
const char *path,
int access_mode);
PARAMETERS
path Points to the file pathname. When the path parameter refers to a symbolic link,
the access() function returns information about the file 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 Specifies 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 file 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 file specified 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 files can be created there).
A process with appropriate privilege can override the file permissions of a file. For files in unres-
tricted filesets, a process with the super ID has the appropriate privilege. However, for files in
restricted-access lesets, such special access privileges are restricted even for the super ID. For
information about restricted-access lesets, see the Open System Services Management and
Operations Guide.
Access Control Lists (ACLs)
Read, write, and execute/search permissions are checked against the ACL for the file.
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 file, grant the permissions
specified in the user:: entry. Otherwise, continue to the next check.
2. If the RUID matches the UID specified in one of the additional user:uid: entries, grant
the permissions specified in that entry, bitwise-ANDed with the permissions specified 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 file
or one of the GIDs specified in any additional group:gid: entries, grant the permissions
16 Hewlett-Packard Company 527186-023