CHOWN(2-POSIX) RISC/os Reference Manual CHOWN(2-POSIX)
NAME
chown - change owner and group of a file
SYNOPSIS
int chown (path, owner, group)
char *path;
uidt owner;
gidt group;
DESCRIPTION
The owner ID and group ID of the named path are set to the
numeric values contained in owner and group respectively.
If chown is invoked by other than the super-user, the set-
user-ID (S_ISUID) and set-group-ID (S_ISGID) bits of the
file mode will be cleared.
If _posix_chown_restricted is in effect [see kopt(8)] for
path:
(1) Changing the ownership is restricted to the
superuser.
(2) Changing the group is permitted to a process with
an effective user ID equal to the user ID of the
file, but without superuser privileges, if and only
if owner is equal to the file's user ID and group
is equal to either the calling process' effective
group ID or to one of its supplementary group IDs.
Upon successful completion, the st_ctime field of the file
is marked for update.
ERRORS
chown will fail and the owner and group of the named file
will remain unchanged if one or more of the following are
true:
[ENOTDIR] A component of the path prefix is not a
directory.
[ENOENT] The named file does not exist, or path
is an empty string.
[EACCES] Search permission is denied on a com-
ponent of the path prefix.
[EPERM] The effective user ID does not match the
owner of the file or the calling is not
the superuser and
_posix_chown_restricted indicates that
such privilege is required.
Printed 1/15/91 Page 1
CHOWN(2-POSIX) RISC/os Reference Manual CHOWN(2-POSIX)
[EROFS] The named file resides on a read-only
file system.
[EFAULT] Path points outside the allocated
address space of the process.
[EINTR] A signal was caught during the chown
system call.
[ENAMETOOLONG] The length of path exceeds {PATH_MAX},
or a pathname component is longer than
{NAME_MAX} while {_POSIX_NO_TRUNC} is in
effect.
SEE ALSO
chmod(2), stat(5).
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
Page 2 Printed 1/15/91