access [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
access
Check file accessibility
Syntax
#include <unistd.h>
int access (const char *path, init amode);
Parameters
path The pathname of a file.
amode One of the following file access permissions.
The bitwise inclusive OR of the following access permission
constants to be checked:
Access Descriptions
Permis-
sions
R_OK Test for read permission.
W_OK Test for write permission.
X_OK Test for execute or search permission.
Or the existence test (F_OK)
Other values of the amode argument are ignored.
Description
The access permissions of the filenamed path is checked by the access()
function. The path argument for file access permissions is indicated by
amode based on the real (not effective) user ID (UID) and group ID (GID).
The amode value is the bitwise inclusive OR of the access permissions or
the existence test checking if the file exists or not.
The three access permissions are checked individually, if they need to be
checked at all. If the process has appropriate privileges, execute file
permission will be granted.
Implementation Considerations
None.
Errors
If an error occurs, errno is set to one of the following values:
E2BIG CAUSE The number of bytes used by the new process image's
argument list and environment list combined is
greater than the limit of {ARG_MAX} (defined in
<limits.h>).
ACTION Reduce the size of the argument list or environment
list or both.
EACCES CAUSE One of the following:
* The calling process does not have search
permission to a component of the pathname.
* The calling process does not have execute
permission to the file.
ACTION One of the following:
* Make sure that the calling process has search
permission to all components of the pathname.
* Make sure that the calling process has execute
permission to the file.
EFAULT CAUSE The system detected a NULL or bad address in
attempting to use the pathname parameter, or the
pathname was not terminated by a null character.
ACTION Make sure that the pointer is correctly initialized.
EIMPL CAUSE The pathname did not resolve to a valid MPE/iX file,
group, and account, or the pathname begins with two
slashes.
ACTION Specify a valid pathname as described in the pathname
parameter description.
Table 4-0. (cont.)
ENAMETOOLONG CAUSE One of the following:
* The length of the pathname exceeds the
{PATH_MAX} limit (defined in the file
<limits.h>).
* A component of the pathname is longer than
{NAME_MAX} (defined in <limits.h>), and
{_POSIX_NO_TRUNC} is in effect for that
directory.
ACTION Make sure that both the component's length and the
full pathname length do not exceed the {NAME_MAX} or
{PATH_MAX} limits.
ENOENT CAUSE a component of the pathname for the executable file
does not exist, or pathname points to an empty
string.
ACTION Specify a valid pathname.
ENOEXEC CAUSE The program file does not have the NMPRG file code.
ACTION Make sure that the program file has the NMPRG file
code.
ENOMEM CAUSE The new process image requires more memory than the
system allows.
ACTION No action required. The new process image cannot be
created.
ENOTDIR CAUSE A component of the pathname is not a directory.
ACTION Specify a valid pathname.
Table 4-0. (cont.)
EPERM CAUSE One of the following:
* The calling process does not have the MPE/iX
process handling (PH) capability.
* The calling process has outstanding switches
to CM code, has set critical mode, has
outstanding NOWAITIO, or is holding an
operating system internal resource, or the
calling process is in a Procedure Exit
handler.
ACTION One of the following:
* Link the program file with the MPE/iX PH
capability.
* Do not execute execl() when the calling
process has outstanding switches to CM code,
has set critical mode, has outstanding
NOWAITIO, or is holding an operating system
internal resource, or in a Procedure Exit
handler.
See Also
chmod(), stat(), <unistd.h>
MPE/iX 5.0 Documentation