Penguin
Annotated edit history of fchmod(2) version 4, including all changes. View license author blame.
Rev Author # Line
1 perry 1 CHMOD
2
2 PerryLorier 3 !!NAME
1 perry 4
2 PerryLorier 5 fchmod - change permissions of a file
1 perry 6 !!SYNOPSIS
7
2 PerryLorier 8 __#include <sys/stat.h>__
3 PerryLorier 9 __#include <sys/types.h>__
1 perry 10
11
3 PerryLorier 12 __int fchmod(int__ ''fildes''__, mode_t__ ''mode''__);__
1 perry 13
14 !!DESCRIPTION
15
16
2 PerryLorier 17 The mode of the file referenced by ''fildes'' is changed.
1 perry 18
19
2 PerryLorier 20 Modes are specified by ''or'ing'' the following:
21 |S_ISUID|04000|set user ID on execution
22 |S_ISGID|02000|set group ID on execution
23 |S_ISVTX|01000|sticky bit
24 |S_IRUSR (S_IREAD)|00400|read by owner
25 |S_IWUSR (S_IWRITE)|00200|write by owner
26 |S_IXUSR (S_IEXEC)|00100|execute/search by owner
27 |S_IRGRP|00040|read by group
28 |S_IWGRP|00020|write by group
29 |S_IXGRP|00010|execute/search by group
30 |S_IROTH|00004|read by others
31 |S_IWOTH|00002|write by others
32 |S_IXOTH|00001|execute/search by others
1 perry 33
2 PerryLorier 34 The effective UID of the process must be zero or must match the owner of the file.
1 perry 35
2 PerryLorier 36 If the effective UID of the process is not zero and the group of the file does not match the effective group ID of the process or one of its supplementary group IDs, the S_ISGID bit will be turned off, but this will not cause an error to be returned.
1 perry 37
2 PerryLorier 38 Depending on the file system, set user ID and set group ID execution bits may be turned off if a file is written. On some file systems, only the super-user can set the sticky bit, which may have a special meaning. For the sticky bit, and for set user ID and set group ID bits on directories, see stat(2).
1 perry 39
2 PerryLorier 40 On NFS file systems, restricting the permissions will immediately influence already open files, because the access control is done on the server, but open files are maintained by the client. Widening the permissions may be delayed for other clients if attribute caching is enabled on them.
1 perry 41
42 !!RETURN VALUE
43
2 PerryLorier 44 On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately.
1 perry 45
46 !!ERRORS
2 PerryLorier 47 Depending on the file system, other errors can be returned. The more general errors for __chmod__ are listed below:
1 perry 48
49
2 PerryLorier 50 ;[EPERM]: The effective UID does not match the owner of the file, and is not zero.
51 ;[EROFS]: The named file resides on a read-only file system.
52 ;[ENOMEM]: Insufficient kernel memory was available.
53 ;[ENOTDIR]: A component of the path prefix is not a directory.
54 ;[EIO]: An I/O error occurred.
55 ;[EBADF]: The file descriptor ''fildes'' is not valid.
1 perry 56 !!CONFORMING TO
57
2 PerryLorier 58 The fchmod(2) call conforms to 4.4BSD and SVr4. SVr4 documents additional [EINTR] and [ENOLINK] error conditions. POSIX requires the fchmod(2) function if at least one of POSIX_MAPPED_FILES and _POSIX_SHARED_MEMORY_OBJECTS is defined, and documents additional [ENOSYS] and [EINVAL] error conditions, but does not document [EIO].
1 perry 59
4 JohnMcPherson 60 [POSIX] and X/OPEN do not document the sticky bit.
1 perry 61 !!SEE ALSO
62
2 PerryLorier 63 open(2), chown(2), execve(2), stat(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 5 times)