fchown(2) DG/UX 5.4R3.00 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 (stuid) for the file. A value of -1
leaves the user id unchanged.
group is the new group id (stgid) for the file. A value of -1
leaves the group id unchanged.
If the call succeeds, the file's time of last attribute change
(stctime) 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 effective user id of the calling process must be superuser, or
match the file's user id.
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 the superuser 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
Licensed material--property of copyright holder(s) 1
fchown(2) DG/UX 5.4R3.00 fchown(2)
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).
Licensed material--property of copyright holder(s) 2