01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ACCESS (2} ACCESS (2}<br />

NAME<br />

access - determine accessibility of a file<br />

SYNOPSIS<br />

int access (path , amode)<br />

char *path;<br />

int amode;<br />

DESCRIPTION<br />

Path points to a path name naming a file. Access checks the<br />

named file for accessibility according to the bit pattern contained<br />

in a mode, using the real user ID in place of the effective user ID<br />

and the real group ID in place of the effective group ID. The bit<br />

pattern contained in amode is constructed as follows:<br />

04 read<br />

02 write<br />

01 execute (search)<br />

00 check existence of file<br />

Access to the file is denied if one or more of the following are true:<br />

A component of the path prefix is not a directory.<br />

[ENOTDffi]<br />

Read, write, or execute (search) permission is requested for<br />

a null path name. [ENOENT]<br />

The named file does not exist. [ENOENT]<br />

Search permission is denied on a component of the path<br />

prefix. [EACCES]<br />

Write access is requested for a file on a read-only file system.<br />

[EROFS]<br />

Write access is requested for a pure procedure (shared<br />

text) file that is being executed. [ETXTBSY]<br />

Permission bits of the file mode do not permit the<br />

requested access. [EACCES]<br />

Path points outside the process's allocated address space.<br />

[EFAULT]<br />

The owner of a file has permission checked with respect to the<br />

"owner" read, write, and execute mode bits, members of the file's<br />

group other than the owner have permissions checked with respect<br />

to the "group" mode bits, and all others have permissions checked<br />

with respect to the "other" mode bits.<br />

RETURN VALUE<br />

If the requested access is permitted, a value of 0 is returned. Otherwise,<br />

a value of -1 is returned and errno is set to indicate the<br />

error.<br />

SEE ALSO<br />

chmod(2), stat(2).<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!