The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

fchmod - change mode of a file

 SYNOPSIS



#include <sys/stat.h>

int fchmod(int fildes, mode_t mode);

 DESCRIPTION

The fchmod() function has the same effect as chmod() except that the file whose permissions are to be changed is specified by the file descriptor fildes.

If the Shared Memory Objects option is supported, and fildes references a shared memory object, the fchmod() function need only affect the S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, and S_IWOTH file permission bits.

 RETURN VALUE

Upon successful completion, fchmod() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.

 ERRORS

The fchmod() function will fail if:
[EBADF]
The fildes argument is not an open file descriptor.
[EPERM]
The effective user ID does not match the owner of the file and the process does not have appropriate privilege.
[EROFS]
The file referred to by fildes resides on a read-only file system.

The fchmod() function may fail if:

[EINTR]
The fchmod() function was interrupted by a signal.
[EINVAL]
The value of the mode argument is invalid.
[EINVAL]
The fildes argument refers to a pipe and the implementation disallows execution of fchmod() on a pipe.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

chmod(),
chown(),
creat(),
fcntl(),
fstatvfs(),
mknod(),
open(),
read(),
stat(),
write(),
<sys/stat.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]