chown(2)
_________________________________________________________________
chown System Call
Change user id and group id of a file.
_________________________________________________________________
SYNTAX
int chown (path, user, group)
char * path;
int user;
int group;
PARAMETERS
path Address of a pathname.
user File's new user id.
group File's new group id.
DESCRIPTION
<Path> points to a pathname naming a file of type ordinary,
directory, FIFO, block special, character special, or symbolic
link. If <path> refers to a symbolic link, the symbolic link is
handled, not the target of the symbolic link. The file cannot
reside on a file system device mounted read-only. Chown sets the
file's user id (st_uid) and group id (st_gid) to the numeric
values <user> and <group>, respectively.
If the value of <user> is -1, the user id of the file is left
unchanged. Similarly, if the value of <group> is -1, the group
id of the file is left unchanged.
The set-user-id and set-group-id bits of the file mode (st_mode)
are left unchanged unless the effective user id of the calling
process is not superuser, in which case they are cleared.
The file's time of last attribute change (st_ctime) is set to the
current time.
If chown fails, the user id, group id, and attributes of the file
remain unchanged.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
chown(2)
ACCESS CONTROL
The effective user id of the calling process must be superuser or
match the user id of the file.
The process must have permission to resolve <path>.
RETURN VALUE
0 The user id and group id of the file were
successfully changed.
-1 An error occurred. Errno is set to indicate the
error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EPERM Permission to change the file's user and group id
is denied.
EROFS The named file resides on a file system device
mounted read-only.
ENOENT The file the pathname resolved to does not exist.
ENOENT A non-terminal component of the pathname does not
exist.
ENOTDIR A non-terminal component of the pathname was not a
directory or symbolic link.
ENAMETOOLONG The pathname exceeds the length limit for
pathnames.
ENAMETOOLONG A component of the pathname exceeds the length
limit for filenames.
ENOMEM There are not enough system resources to resolve
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
chown(2)
the pathname or to expand a symbolic link.
ELOOP The number of symbolic links encountered during
pathname resolution exceeded MAXSYMLINKS. A
symbolic link cycle is suspected.
EPERM The pathname contains a character not in the
allowed character set.
EFAULT The pathname does not completely reside in the
process's address space or the pathname does not
terminate in the process's address space.
SEE ALSO
The related manual sections: chmod(1),
chmod(2), fchmod(2), fchown(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)