⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chown.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>chown</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_001_449">&nbsp;</a>NAME</h4><blockquote>chown - change owner and group of a file</blockquote><h4><a name = "tag_000_001_450">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="systypes.h.html">sys/types.h</a>&gt;#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;int chown(const char *<i>path</i>, uid_t <i>owner</i>, gid_t <i>group</i>);</code></pre></blockquote><h4><a name = "tag_000_001_451">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>path</i>argument points to a pathname naming a file.  The user ID and group IDof the named file are set to the numeric values contained in<i>owner</i>and<i>group</i>respectively.<p>On XSI-conformant systems {_POSIX_CHOWN_RESTRICTED} is alwaysdefined, therefore:<ul><p><li>Changing the user ID is restricted to processes with appropriateprivileges.<p><li>Changing the group ID is permitted to a process with an effective userID equal to the user ID of the file, but without appropriateprivileges, if and only if<i>owner</i>is equal to the file's user IDor (<b> uid_t</b> )-1and<i>group</i>is equal either to the calling process' effective group ID or toone of its supplementary group IDs.<p></ul><p>If the<i>path</i>argument refers to a regular file, the set-user-ID (S_ISUID) andset-group-ID (S_ISGID) bits of the file mode are clearedupon successful return from<i>chown()</i>,unless the call is made by a process with appropriate privileges,in which case it is implementation-dependent whether these bits arealtered.If<i>chown()</i>is successfully invoked on a file that is not a regularfile, these bits may be cleared.These bits are defined in<i><a href="sysstat.h.html">&lt;sys/stat.h&gt;</a></i>.<p>If<i>owner</i>or<i>group</i>is specified as (<b>uid_t</b>)-1 or (<b>gid_t</b>)-1respectively, the corresponding ID of the file is unchanged.<p>Upon successful completion,<i>chown()</i>will mark for update the<i>st_ctime</i>field of the file.</blockquote><h4><a name = "tag_000_001_452">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion, 0 is returned.Otherwise, -1 is returned and<i>errno</i>is set to indicate the error.If -1 is returned, no changes are made in the user IDand group ID of the file.</blockquote><h4><a name = "tag_000_001_453">&nbsp;</a>ERRORS</h4><blockquote>The<i>chown()</i>function will fail if:<dl compact><dt>[EACCES]<dd>Search permission is denied on a component of the path 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>[ENOTDIR]<dd>A component of the path prefix is not a directory.<dt>[ENOENT]<dd>A component of <i>path</i> does not name an existing fileor <i>path</i> is an empty string.<dt>[EPERM]<dd>The effective user IDdoes not match the owner of the file, or thecalling process does not have appropriate privileges.<dt>[EROFS]<dd>The named file resides on a read-only file system.</dl><p>The<i>chown()</i>function may fail if:<dl compact><dt>[EIO]<dd>An I/O error occurred while reading or writing to the file system.<dt>[EINTR]<dd>The<i>chown()</i>function was interrupted by a signal which was caught.<dt>[EINVAL]<dd>The owner or group IDsupplied is not a value supported by the implementation.<dt>[ENAMETOOLONG]<dd>Pathname resolution of a symbolic link produced an intermediate result whoselength exceeds {PATH_MAX}.</dl></blockquote><h4><a name = "tag_000_001_454">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_455">&nbsp;</a>APPLICATION USAGE</h4><blockquote>Because {_POSIX_CHOWN_RESTRICTED} is always definedwith a value other than -1 on XSI-conformantsystems, the error [EPERM] is always returned if the effective user ID doesnot match the owner of the file, or the calling process does not haveappropriate privileges.</blockquote><h4><a name = "tag_000_001_456">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_457">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="chmod.html">chmod()</a></i>,<i><a href="systypes.h.html">&lt;sys/types.h&gt;</a></i>,<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 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 + -