1
0
Files
irix-657m-src/eoe/man/man2/access.2
2022-09-29 17:59:04 +03:00

125 lines
3.0 KiB
Groff

'\"! tbl | mmdoc
'\"macro stdmacro
.if n .pH g2.access @(#)access 41.9 of 5/26/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} access 2 "" "\&"
.if \nX=1 .ds x} access 2 ""
.if \nX=2 .ds x} access 2 "" "\&"
.if \nX=3 .ds x} access "" "" "\&"
.TH \*(x}
'\" t
.SH NAME
\f4access\f1 \- determine accessibility of a file
.SH SYNOPSIS
\f4#include <unistd.h>\f1
.PP
\f4int access(const char \(**path, int amode); \f1
.SH DESCRIPTION
\f2path\^\fP
points to a path name naming a file.
\f4access\fP
checks the named file
for accessibility according to the bit pattern contained in
\f2amode\fP,
using the real user
.SM ID
in place of the effective user
.SM ID
and
the real group
.SM ID
in place of the effective group
.SM ID\*S.
The bit pattern contained in
\f2amode\^\fP
is constructed by an OR of the following constants (defined in
<\f4unistd.h\f1>):
.PP
.RS
\f4R_OK\f1 test for read permission
.br
\f4W_OK\f1 test for write permission
.br
\f4X_OK\f1 test for execute (search) permission
.br
\f4F_OK\f1 test for existence of file
.br
\f4EX_OK\f1 test for regular, executable file
.br
\f4EFF_ONLY_OK\f1 test using effective IDs
.RE
.P
Note that successful checking of the \f4EX_OK\fP file does not imply
that the \f4exec\fP(2) system call will succeed on the file named by
\f2path\fP, since the check succeeds if at least one execute bit is
set; there are also additional checks made for execute permission by
\f4exec\fP.
.PP
Access to the file is denied if one or more of the following are true:
.TP 20
\f4EACCES\fP
Search permission is denied on a component of the path prefix.
.TP
\f4EACCES\fP
Access permission is denied.
.TP
\f4EACCES\fP
The file is not a regular file.
.TP
\f4EFAULT\fP
\f2path\fP
points outside the allocated address space for the process.
.TP
\f4EINTR\fP
A signal was caught during the \f4access\fP system call.
.TP
\f4EINVAL\fP
\f2amode\fP is invalid.
.TP
\f4ELOOP\fP
Too many symbolic links were encountered in translating
\f2path\fP.
.TP
\f4EMULTIHOP\fP
Components of
\f2path\fP
require hopping to multiple remote machines.
.TP
\f4ENAMETOOLONG\fP
The length of the
\f2path\fP
argument exceeds {\f4PATH_MAX\f1},
or the length of a \f2path\f1 component exceeds {\f4NAME_MAX\f1}
while \f4_POSIX_NO_TRUNC\f1 is in effect.
.TP
\f4ENOTDIR\fP
A component of the path prefix is not a directory.
.TP
\f4ENOENT\fP
Read, write, or execute (search) permission is requested for a null path name.
.TP
\f4ENOENT\fP
The named file does not exist.
.TP
\f4ENOLINK\fP
\f2path\f1 points to a remote machine and the link
to that machine is no longer active.
.TP
\f4ETIMEDOUT\fP
The named file
is located on a remote file system which is not available [see \f4intro\fP(2)].
.TP
\f4EROFS\fP
Write access is requested for a file on a read-only file system.
.SH SEE ALSO
\f4chmod\fP(2), \f4stat\fP(2)
.br
``File Access Permission'' in \f4intro\fP(2)
.SH "DIAGNOSTICS"
If the requested access is permitted, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
\f4errno\fP
is set to indicate the error.