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

📄 syscalls_6.html

📁 Linux系统调用
💻 HTML
字号:
<!-- This HTML file has been created by texi2html 1.29
     from syscalls.texi on 4 June 1994 -->

<TITLE>Syscall specifications of Linux - chmod</TITLE>
<P>Go to the <A HREF="syscalls_5.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_5.html">previous</A>, <A HREF="syscalls_7.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_7.html">next</A> section.<P>
<H2><A NAME="SEC6" HREF="syscalls_toc.html#SEC6" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC6">chmod and fchmod</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int chmod(const char *<VAR>path</VAR>, mode_t <VAR>mode</VAR>);</CODE>
<P>
<CODE>int fchmod(int <VAR>fd</VAR>, mode_t <VAR>mode</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>path</VAR>: [in] points to the path of the file to modify.
<P>
<VAR>fd</VAR>: [in] the file descriptor to modify.
<P>
<VAR>mode</VAR>: [in] the new mode.
<P>
<H3>DESCRIPTION</H3>
<P>
<CODE>chmod</CODE> changes the mode of the file specified by <VAR>path</VAR> to
<VAR>mode</VAR>. <CODE>fchmod</CODE> changes the mode of the file descriptor
specified by <VAR>fd</VAR> to <VAR>mode</VAR>.The possible values of <VAR>mode</VAR>
are obtained by or'ing the following constants:
<P>
<UL>
<LI><CODE>S_ISUID</CODE>: set uid on execution.
<LI><CODE>S_ISGID</CODE>: set gid on execution.
<LI><CODE>S_ISVTX</CODE>: sticky bit.
<LI><CODE>S_IRUSR</CODE>: readable by owner.
<LI><CODE>S_IWUSR</CODE>: writable by owner.
<LI><CODE>S_IXUSR</CODE>: executable by owner.
<LI><CODE>S_IRGRP</CODE>: readable by group.
<LI><CODE>S_IWGRP</CODE>: writable by group.
<LI><CODE>S_IXGRP</CODE>: executable by group.
<LI><CODE>S_IROTH</CODE>: readable by the world.
<LI><CODE>S_IWOTH</CODE>: writable by the world.
<LI><CODE>S_IXOTH</CODE>: executable by the world.
</UL>
<P>
<H3>RETURN VALUE</H3>
<P>
On success zero is returned. On error, -1 is returned and <CODE>errno</CODE> is
set to one of the following values:
<P>
for <CODE>chmod</CODE>:
<P>
<UL>
<LI><CODE>EPERM</CODE>: the effective uid of the task is not equal the the
uid of the file and the task does not have superuser privileges.
<LI><CODE>ENOTDIR</CODE>, <CODE>EACCESS</CODE>, <CODE>EFAULT</CODE>, <CODE>ENOENT</CODE>,
<CODE>ENOMEM</CODE> <CODE>ENAMETOOLONG</CODE>, <CODE>EROFS</CODE> or <CODE>ELOOP</CODE>.
</UL>
<P>
for <CODE>fchmod</CODE>:
<P>
<UL>
<LI><CODE>EPERM</CODE>: the effective uid of the task is not equal the the
uid of the file and the task does not have superuser privileges.
<LI><CODE>ENOENT</CODE>, <CODE>EROFS</CODE> or <CODE>EBADF</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_5.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_5.html">previous</A>, <A HREF="syscalls_7.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_7.html">next</A> section.<P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -