Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chmod(2) — Ultrix-11 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

CHMOD(2)

NAME

chmod − change mode of file

SYNOPSIS

chmod(name, mode)
char *name;

DESCRIPTION

The file whose name is given as the null-terminated string pointed to by name has its mode changed to mode. Modes are constructed by ORing together some combination of the following:

 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

If an executable file is set up for sharing (−n or −i option of ld(1)) 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. Thus when the next user of the file executes it, the text need not be read from the file system but can simply be swapped in, saving time. Ability to set this bit is restricted to the superuser since swap space is consumed by the images; it is only worth while for heavily used commands.

Only the owner of a file (or the superuser) may change the mode.  Only the superuser can set the 1000 mode. 

RETURN VALUE

Zero is returned if the mode is changed; −1 is returned if name cannot be found or if current user is neither the owner of the file nor the superuser. 

DIAGNOSTICS

Chmod will fail and the file mode will be unchanged if:

[EACCES] Search permission is denied on a component of the path prefix. 

[EFAULT] Name points outside the process’s allocated address space. 

[ENFILE] Insufficient system space to contain i-node. 

[ENOENT] The named file, or an element within the named file, does not exist. 

[ENOTDIR] A component of the path prefix is not a directory. 

[EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the superuser. 

[EROFS] The named file resides on a read-only file system. 

SEE ALSO

chmod(1)

ASSEMBLER

(chmod = 15.) 
sys chmod; name; mode

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026