Implementation status: to be implemented
int fchmod(int fildes, mode_t mode);
The function changes the mode of a file.
fildes - the file descriptor.
mode - the new mode of a file.
fchmod() function is equivalent to
chmod() except that the file whose permissions are changed is specified by the file descriptor fildes.
If fildes references a shared memory object, the
fchmod() function need only affect the
S_IWOTH file permission bits.
If fildes references a typed memory object or a socket , the behavior of
fchmod() is unspecified.
If fildes refers to a STREAM (which is fattach()-ed into the file system name space) the call returns successfully, doing nothing.
Upon successful completion,
-1 is returned and
errno set to indicate the error.
EBADF] The fildes argument is not a valid open file descriptor.
EPERM] The effective user ID does not match the owner of the file and the process does not have appropriate privileges.
EROFS] The file referred to by fildes resides on a read-only file system.
The fchmod() function may fail if:
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.