Bell 32V development
[unix-history] / usr / man / man2 / chmod.2
CommitLineData
cb67878b
TL
1.TH CHMOD 2
2.SH NAME
3chmod \- change mode of file
4.SH SYNOPSIS
5.B chmod(name, mode)
6.br
7.B char *name;
8.SH DESCRIPTION
9The file whose name
10is given as the null-terminated string pointed to by
11.I name
12has its mode changed to
13.IR mode .
14Modes are constructed by ORing together some
15combination 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
28If an executable file is set up for sharing
29(\fB\-n\fR option of
30.IR ld (1))
31then mode 1000 prevents the system from
32abandoning the swap-space image of the program-text portion
33of the file when its last user
34terminates.
35Thus when the next user of the file executes it,
36the text need not be read from the file
37system but can simply be swapped in,
38saving time.
39Ability to set this bit is restricted to the super-user
40since swap space is consumed
41by the images; it is only worth while for heavily used commands.
42.PP
43Only the owner of a file (or the super-user) may change the mode.
44Only the super-user can set the 1000 mode.
45.SH "SEE ALSO"
46chmod(1)
47.SH DIAGNOSTIC
48Zero is returned if the mode is changed;
49\-1 is returned if
50.I name
51cannot be found or if current user
52is 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