V8/usr/man/man2/chmod.2

Compare this file to the similar file:
Show the results in this format:

.TH CHMOD 2 
.SH NAME
chmod, fchmod \- change mode of file
.SH SYNOPSIS
.nf
.B chmod(name, mode)
.B char *name;
.PP
.B fchmod(fd, mode)
.fi
.SH DESCRIPTION
.I Chmod
changes the mode of the file specified by the null-terminated string
.I name
to
.IR mode .
.I Fchmod
changes the mode of an open file referred to by a file descriptor.
Modes are constructed by
.IR or ing
together some
combination of the following:
.PP
.RS
 04000 set user ID on execution
 02000 set group ID on execution
 01000 save text image after execution
 00400 read by owner
 00200 write by owner
 00100 execute (search on directory) by owner
 00070 read, write, execute (search) by group
 00007 read, write, execute (search) by others
.RE
.PP
If an executable file is set up for sharing (this is the default)
then mode 1000 prevents the system from
abandoning the swap-space image of the program-text portion
of the file when its last user
terminates.
Ability to set this bit is restricted to the super-user
since swap space is consumed
by the images.
.PP
Only the owner of a file (or the super-user) may change the mode.
Only the super-user can set the 1000 mode.
.SH "SEE ALSO"
chmod(1)
.SH DIAGNOSTICS
Zero is returned if the mode is changed;
\-1 is returned if
.I name
cannot be found or if current user
is neither the owner of the file nor the super-user.