📄 access.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>access</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_001_068"> </a>NAME</h4><blockquote>access - determine accessibility of a file</blockquote><h4><a name = "tag_000_001_069"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>int access(const char *<i>path</i>, int <i>amode</i>);</code></pre></blockquote><h4><a name = "tag_000_001_070"> </a>DESCRIPTION</h4><blockquote>The<i>access()</i>function checks the file named by the pathname pointed to by the<i>path</i>argument for accessibility according to the bit pattern contained in<i>amode</i>,using the real user IDin place of the effective userID and the real group IDin place of the effective group ID.<p>The value of<i>amode</i>is either the bitwise inclusive ORof the access permissions to be checked(R_OK, W_OK, X_OK)or the existence test, F_OK.<p>If any access permissions are to be checked, each will be checkedindividually, as described inthe <b>XBD</b> specification, <b>Chapter 2</b>, <b>Definitions</b>.If the process has appropriate privileges,an implementation may indicate success for X_OK even if none of theexecute file permission bits are set.</blockquote><h4><a name = "tag_000_001_071"> </a>RETURN VALUE</h4><blockquote>If the requested access is permitted,<i>access()</i>succeeds and returns 0. Otherwise, -1 is returned and<i>errno</i>is set to indicate the error.</blockquote><h4><a name = "tag_000_001_072"> </a>ERRORS</h4><blockquote>The<i>access()</i>function will fail if:<dl compact><dt>[EACCES]<dd>Permission bits of the file mode do not permit the requested access,or search permission is denied on a component of thepath prefix.<dt>[ELOOP]<dd>Too many symbolic links were encountered in resolving <i>path</i>.<dt>[ENAMETOOLONG]<dd>The length of the<i>path</i>argument exceeds {PATH_MAX}or a pathname component is longer than {NAME_MAX}.<dt>[ENOENT]<dd>A component of <i>path</i> does not name an existing fileor <i>path</i> is an empty string.<dt>[ENOTDIR]<dd>A component of the path prefix is not a directory.<dt>[EROFS]<dd>Write access is requested for a file on a read-only file system.</dl><p>The<i>access()</i>function may fail if:<dl compact><dt>[EINVAL]<dd>The value of the<i>amode</i>argument is invalid.<dt>[ENAMETOOLONG]<dd>Pathname resolution of a symbolic link produced an intermediate result whoselength exceeds {PATH_MAX}.<dt>[ETXTBSY]<dd>Write access is requested for a pure procedure (shared text)file that is being executed.</dl></blockquote><h4><a name = "tag_000_001_073"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_074"> </a>APPLICATION USAGE</h4><blockquote>Additional values of<i>amode</i>other than the set defined in the description may be valid, for example, ifa system has extended access controls.</blockquote><h4><a name = "tag_000_001_075"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_076"> </a>SEE ALSO</h4><blockquote><i><a href="chmod.html">chmod()</a></i>,<i><a href="stat.html">stat()</a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>.<br></blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -