Files
oldlinux-files/Ref-docs/syscalls/syscalls_7.html
2024-02-19 00:21:47 -05:00

55 lines
2.4 KiB
HTML

<html><!-- This HTML file has been created by texi2html 1.29
from syscalls.texi on 4 June 1994 -->
<TITLE>Syscall specifications of Linux - chown</TITLE>
<P>Go to the <A HREF="syscalls_6.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_6.html">previous</A>, <A HREF="syscalls_8.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_8.html">next</A> section.<P>
<H2><A NAME="SEC7" HREF="syscalls_toc.html#SEC7" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC7">chown and fchown</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int chown(const char *<VAR>path</VAR>, uid_t <VAR>owner</VAR>, gid_t <VAR>group</VAR>);</CODE>
<P>
<CODE>int fchown(int <VAR>fd</VAR>, uid_t <VAR>owner</VAR>, gid_t <VAR>group</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>owner</VAR>: [in] the new uid. -1 for no change.
<P>
<VAR>group</VAR>: [in] the new gid. -1 for no change.
<P>
<H3>DESCRIPTION</H3>
<P>
<CODE>chown</CODE> changes the uid and gid of file specified by <VAR>path</VAR> to
<VAR>owner</VAR> and <VAR>group</VAR>. <CODE>fchown</CODE> changes the uid and gid of
file descriptor <VAR>fd</VAR> to <VAR>owner</VAR> and <VAR>group</VAR>. The superuser
may do whatever he wishes with the uid and gid of a file. The owner of a
file may only change the gid of the file to any group he belongs to.
<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>chown</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>fchown</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_6.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_6.html">previous</A>, <A HREF="syscalls_8.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_8.html">next</A> section.<P>