Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ access(2) — Ultrix-11 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

stat(2)

access(2)

NAME

access − determine accessibility of a file

SYNTAX

int access(name, mode)
char *name;
int  mode;

DESCRIPTION

The access system call checks file name for access permission specified by mode.  The mode argument can be: 4 (read), 2 (write) or 1 (execute) or a combination thereof.  In addition, mode 0 tests if the directories leading to the file can be searched and if the file exists. 

The user and group IDs with respect to which permissions are checked are the real UID and GID of the process, so this call is useful to set-UID programs. 

Only the access bits are checked.  A directory may be announced as writable by the access call, but an attempt to open it for writing may fail (even though files may be created there).  That is, a file may look executable, but an exec call will fail unless it is in proper format. 

RETURN VALUE

If unsuccessful, returns a −1, and the global variable errno indicates the error condition. 

DIAGNOSTICS

The access call will fail if:

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

[ENOENT] Read, write, or execute (search) permission is requested for a null path name. 

[ENOENT] The specified name does not exist. 

[EACCES] Permission bits of file do not permit the requested access. 

[EACCES] Search permission is denied on a component of the path prefix.  The owner of a file has permission checked with respect to mode bits for the owner.  Members of the file’s group other than the owner have permission checked with respect to the mode bits for the group.  All others have permissions checked with respect to the mode bits for others. 

[EROFS] Write access is requested for a file on a read-only file system. 

[ETXTBSY] Write access is requested for a pure procedure (shared text) file that is being executed. 

[EFAULT] The specified name points outside the allocated address space for the process. 

ASSEMBLER

(access = 33.) 
sys access; name; mode

SEE ALSO

chmod(2), stat(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026