|
|
1.1 ! root 1: ! 2: ! 3: chmod() COHERENT System Call chmod() ! 4: ! 5: ! 6: ! 7: ! 8: Change file-protection modes ! 9: ! 10: #include <sys/stat.h> ! 11: cchhmmoodd(_f_i_l_e, _m_o_d_e) ! 12: cchhaarr *_f_i_l_e; iinntt _m_o_d_e; ! 13: ! 14: chmod sets the mode bits for file. The mode bits include protec- ! 15: tion bits, the set-user-id bit, and the sticky bit. ! 16: ! 17: mode is constructed from the logical OR of the following, which ! 18: are defined symbolically in the header file stat.h: ! 19: ! 20: ! 21: 04000 Set user identifier ! 22: 02000 Set group identifier ! 23: 01000 Save file on swap device (``sticky bit'') ! 24: 00400 Read permission for owner ! 25: 00200 Write permission for owner ! 26: 00100 Execute permission for owner ! 27: 00040 Read permission for members of owner's group ! 28: 00020 Write permission for members of owner's group ! 29: 00010 Execute permission for members of owner's group ! 30: 00004 Read permission for other users ! 31: 00002 Write permission for other users ! 32: 00001 Execute permission for other users ! 33: ! 34: ! 35: For directories, some protection bits have a different meaning: ! 36: write permission means files may be created and removed, whereas ! 37: execute permission means that the directory may be searched. ! 38: ! 39: The save-text bit (or ``sticky bit'') is a flag to the system ! 40: when it executes a shared for of a load module. After the system ! 41: runs the program, it leaves shared segments on the swap device to ! 42: speed subsequent reinvocation of the program. Setting this bit ! 43: is restricted to the superuser (to control depletion of swap ! 44: space which might result from overuse). ! 45: ! 46: Only the owner of a file or the superuser may change its mode. ! 47: ! 48: ***** See Also ***** ! 49: ! 50: COHERENT system calls, creat() ! 51: ! 52: ***** Diagnostics ***** ! 53: ! 54: chmod returns -1 for errors, such as file being nonexistent or ! 55: the invoker being neither the owner nor the superuser. ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.