home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat2 / chmod.0 < prev    next >
Text File  |  1993-12-07  |  5KB  |  133 lines

  1.  
  2. CHMOD(2)                   UNIX Programmer's Manual                   CHMOD(2)
  3.  
  4. NNAAMMEE
  5.      cchhmmoodd, ffcchhmmoodd - change mode of file
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ssttaatt..hh>>
  9.  
  10.      _i_n_t
  11.      cchhmmoodd(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _m_o_d_e___t _m_o_d_e)
  12.  
  13.      _i_n_t
  14.      ffcchhmmoodd(_i_n_t _f_d, _m_o_d_e___t _m_o_d_e)
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The function cchhmmoodd() sets the file permission bits of the file specified
  18.      by the pathname _p_a_t_h to _m_o_d_e. FFcchhmmoodd() sets the permission bits of the
  19.      specified file descriptor _f_d. CChhmmoodd() verifies that the process owner
  20.      (user) either owns the file specified by _p_a_t_h (or _f_d), or is the super­
  21.      user.  A mode is created from _o_r'd permission bit masks defined in
  22.      <_s_y_s_/_s_t_a_t_._h>:
  23.            #define S_IRWXU 0000700    /* RWX mask for owner */
  24.            #define S_IRUSR 0000400    /* R for owner */
  25.            #define S_IWUSR 0000200    /* W for owner */
  26.            #define S_IXUSR 0000100    /* X for owner */
  27.  
  28.            #define S_IRWXG 0000070    /* RWX mask for group */
  29.            #define S_IRGRP 0000040    /* R for group */
  30.            #define S_IWGRP 0000020    /* W for group */
  31.            #define S_IXGRP 0000010    /* X for group */
  32.  
  33.            #define S_IRWXO 0000007    /* RWX mask for other */
  34.            #define S_IROTH 0000004    /* R for other */
  35.            #define S_IWOTH 0000002    /* W for other */
  36.            #define S_IXOTH 0000001    /* X for other */
  37.  
  38.            #define S_ISUID 0004000    /* set user id on execution */
  39.            #define S_ISGID 0002000    /* set group id on execution */
  40.            #define S_ISVTX 0001000    /* save swapped text even after use */
  41.  
  42.      The ISVTX (the _s_t_i_c_k_y _b_i_t) indicates to the system which executable files
  43.      are shareable (the default) and the system maintains the program text of
  44.      the files in the swap area. The sticky bit may only be set by the super
  45.      user on shareable executable files.
  46.  
  47.      If mode ISVTX (the `sticky bit') is set on a directory, an unprivileged
  48.      user may not delete or rename files of other users in that directory. The
  49.      sticky bit may be set by any user on a directory which the user owns or
  50.      has appropriate permissions.  For more details of the properties of the
  51.      sticky bit, see sticky(8).
  52.  
  53.      Writing or changing the owner of a file turns off the set­user­id and
  54.      set­group­id bits unless the user is the super­user.  This makes the sys­
  55.      tem somewhat more secure by protecting set­user­id (set­group­id) files
  56.      from remaining set­user­id (set­group­id) if they are modified, at the
  57.      expense of a degree of compatibility.
  58.  
  59. RREETTUURRNN VVAALLUUEESS
  60.      Upon successful completion, a value of 0 is returned.  Otherwise, a value
  61.      of ­1 is returned and _e_r_r_n_o is set to indicate the error.
  62.  
  63. EERRRROORRSS
  64.  
  65.  
  66.      CChhmmoodd() will fail and the file mode will be unchanged if:
  67.  
  68.      [ENOTDIR]     A component of the path prefix is not a directory.
  69.  
  70.      [EINVAL]      The pathname contains a character with the high­order bit
  71.                    set.
  72.  
  73.      [ENAMETOOLONG]
  74.                    A component of a pathname exceeded 255 characters, or an
  75.                    entire path name exceeded 1023 characters.
  76.  
  77.      [ENOENT]      The named file does not exist.
  78.  
  79.      [EACCES]      Search permission is denied for a component of the path
  80.                    prefix.
  81.  
  82.      [ELOOP]       Too many symbolic links were encountered in translating the
  83.                    pathname.
  84.  
  85.      [EPERM]       The effective user ID does not match the owner of the file
  86.                    and the effective user ID is not the super­user.
  87.  
  88.      [EROFS]       The named file resides on a read­only file system.
  89.  
  90.      [EFAULT]      _P_a_t_h points outside the process's allocated address space.
  91.  
  92.      [EIO]         An I/O error occurred while reading from or writing to the
  93.                    file system.
  94.  
  95.      FFcchhmmoodd() will fail if:
  96.  
  97.      [EBADF]       The descriptor is not valid.
  98.  
  99.      [EINVAL]      _F_d refers to a socket, not to a file.
  100.  
  101.      [EROFS]       The file resides on a read­only file system.
  102.  
  103.      [EIO]         An I/O error occurred while reading from or writing to the
  104.                    file system.
  105.  
  106. SSEEEE AALLSSOO
  107.      chmod(1),  open(2),  chown(2),  stat(2),  sticky(8)
  108.  
  109. SSTTAANNDDAARRDDSS
  110.      CChhmmoodd() is expected to conform to IEEE Std 1003.1­1988 (``POSIX'').
  111.  
  112. HHIISSTTOORRYY
  113.      The ffcchhmmoodd() function call appeared in 4.2BSD.
  114.  
  115. 4th Berkeley Distribution       March 10, 1991                               2
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.