Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

stat(2)

ACCESS(2)  —  Silicon Graphics

NAME

access − determine accessibility of a file

SYNOPSIS

int access (path, amode)
char ∗path;
int amode;

DESCRIPTION

Path points to a path name naming a file.  Access checks the named file for accessibility according to the bit pattern contained in amode, using the real user ID in place of the effective user ID and the real group ID in place of the effective group ID.  The bit pattern contained in amode is constructed as follows:

04read
02write
01execute (search)
00check existence of file

Access to the file is denied if one or more of the following are true:

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

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

The named file does not exist.  ­[ENOENT]

Search permission is denied on a component of the path prefix.  ­[EACCES]

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

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

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

Path points outside the process’s allocated address space.  ­[EFAULT]

The owner of a file has permission checked with respect to the “owner” read, write, and execute mode bits, members of the file’s group other than the owner have permissions checked with respect to the “group” mode bits, and all others have permissions checked with respect to the “other” mode bits. 

Notice that it is only access bits that are checked.  A directory may be announced as writable by access, but an attempt to open it for writing will fail because it is not allowed to write into the directory structure itself, although files may be created there. A file may look executable, but exec will fail unless it is in proper format. 

RETURN VALUE

If the requested access is permitted, a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

SEE ALSO

chmod(2), stat(2). 

ASSEMBLER

moveq#33,D0
movlpath,A0
movlamode,D1
trap#0

Carry bit set on failure and cleared on success. 

Version 3.6  —  December 20, 1987

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