fchown(2) DG/UX R4.11MU05 fchown(2)
NAME
fchown - change user id and group id of a file
SYNOPSIS
#include <unistd.h>
int fchown (fildes, user, group)
int fildes;
int user;
int group;
DESCRIPTION
Use fchown to set the access of a file:
fildes is a valid, active descriptor for an open file of type
ordinary, directory, block special, block character, or
symbolic link. The file must reside on a file system device
mounted read-write.
user is the new user id (st_uid) for the file. A value of -1
leaves the user id unchanged.
group is the new group id (st_gid) for the file. A value of -1
leaves the group id unchanged.
If the call succeeds, the file's time of last attribute change
(st_ctime) is set to the current time. If the call fails, the user
id, group id, and attributes of the file remain unchanged.
ACCESS CONTROL
The calling process must have appropriate privilege or the effective
user id of the calling process must match the file's user id. For
systems supporting the DG/UX Capability Option, appropriate privilege
is defined as having one or more specific capabilities enabled in the
effective capability set of the calling process. See cap_defaults(5)
for the default capability for this system call.
On systems without the DG/UX Capability Option, appropriate privilege
means that the process has an effective UID of root. See the
appropriate_privilege(5) man page for more information.
When customizing the DG/UX system, the installer or administrator may
restrict access to any file. Use of fchown(2) with a restricted file
is limited as follows: (1) only a user with the appropriate privilege
can modify a restricted file's user id; (2) a process whose effective
user ID matches the user ID of the file may change the group ID, but
only to the process's effective group ID, or to one of the process's
supplementary IDs. To find out whether access to a file is
restricted, use pathconf(2) with the _PC_CHOWN_RESTRICTED argument.
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.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EBADF The descriptor does not refer to an open file.
EINVAL The descriptor refers to a pipe or an object that is not a
file.
EPERM Permission to change the file's user and group ids is
denied.
EROFS The named file resides on a file system device mounted
read-only.
SEE ALSO
chgrp(1), chmod(1), chown(1), chmod(2), chown(2), fchmod(2),
appropriate_privilege(5).
cap_defaults(5).
Licensed material--property of copyright holder(s)