Commit | Line | Data |
---|---|---|
cb67878b TL |
1 | .TH CHMOD 2 |
2 | .SH NAME | |
3 | chmod \- change mode of file | |
4 | .SH SYNOPSIS | |
5 | .B chmod(name, mode) | |
6 | .br | |
7 | .B char *name; | |
8 | .SH DESCRIPTION | |
9 | The file whose name | |
10 | is given as the null-terminated string pointed to by | |
11 | .I name | |
12 | has its mode changed to | |
13 | .IR mode . | |
14 | Modes are constructed by ORing together some | |
15 | combination of the following: | |
16 | .PP | |
17 | .RS | |
18 | 04000 set user ID on execution | |
19 | 02000 set group ID on execution | |
20 | 01000 save text image after execution | |
21 | 00400 read by owner | |
22 | 00200 write by owner | |
23 | 00100 execute (search on directory) by owner | |
24 | 00070 read, write, execute (search) by group | |
25 | 00007 read, write, execute (search) by others | |
26 | .RE | |
27 | .PP | |
28 | If an executable file is set up for sharing | |
29 | (\fB\-n\fR option of | |
30 | .IR ld (1)) | |
31 | then mode 1000 prevents the system from | |
32 | abandoning the swap-space image of the program-text portion | |
33 | of the file when its last user | |
34 | terminates. | |
35 | Thus when the next user of the file executes it, | |
36 | the text need not be read from the file | |
37 | system but can simply be swapped in, | |
38 | saving time. | |
39 | Ability to set this bit is restricted to the super-user | |
40 | since swap space is consumed | |
41 | by the images; it is only worth while for heavily used commands. | |
42 | .PP | |
43 | Only the owner of a file (or the super-user) may change the mode. | |
44 | Only the super-user can set the 1000 mode. | |
45 | .SH "SEE ALSO" | |
46 | chmod(1) | |
47 | .SH DIAGNOSTIC | |
48 | Zero is returned if the mode is changed; | |
49 | \-1 is returned if | |
50 | .I name | |
51 | cannot be found or if current user | |
52 | is neither the owner of the file nor the super-user. | |
53 | .SH "ASSEMBLER (PDP-11)" | |
54 | (chmod = 15.) | |
55 | .br | |
56 | .B sys chmod; name; mode |