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

  1.  
  2. RENAME(2)                  UNIX Programmer's Manual                  RENAME(2)
  3.  
  4. NNAAMMEE
  5.      rreennaammee - change the name of a file
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssttddiioo..hh>>
  9.  
  10.      _i_n_t
  11.      rreennaammee(_c_o_n_s_t _c_h_a_r _*_f_r_o_m, _c_o_n_s_t _c_h_a_r _*_t_o)
  12.  
  13. DDEESSCCRRIIPPTTIIOONN
  14.      RReennaammee() causes the link named _f_r_o_m to be renamed as _t_o. If _t_o exists, it
  15.      is first removed.  Both _f_r_o_m and _t_o must be of the same type (that is,
  16.      both directories or both non­directories), and must reside on the same
  17.      file system.
  18.  
  19.      RReennaammee() guarantees that an instance of _t_o will always exist, even if the
  20.      system should crash in the middle of the operation.
  21.  
  22.      If the final component of _f_r_o_m is a symbolic link, the symbolic link is
  23.      renamed, not the file or directory to which it points.
  24.  
  25. CCAAVVEEAATT
  26.      The system can deadlock if a loop in the file system graph is present.
  27.      This loop takes the form of an entry in directory `_a', say `_a_/_f_o_o', being
  28.      a hard link to directory `_b', and an entry in directory `_b', say `_b_/_b_a_r',
  29.      being a hard link to directory `_a'. When such a loop exists and two sepa­
  30.      rate processes attempt to perform `rename a/foo b/bar' and `rename b/bar
  31.      a/foo', respectively, the system may deadlock attempting to lock both di­
  32.      rectories for modification.  Hard links to directories should be replaced
  33.      by symbolic links by the system administrator.
  34.  
  35. RREETTUURRNN VVAALLUUEESS
  36.      A 0 value is returned if the operation succeeds, otherwise rreennaammee() re­
  37.      turns ­1 and the global variable _e_r_r_n_o indicates the reason for the fail­
  38.      ure.
  39.  
  40. EERRRROORRSS
  41.      RReennaammee() will fail and neither of the argument files will be affected if:
  42.  
  43.      [EINVAL]      Either pathname contains a character with the high­order
  44.                    bit set.
  45.  
  46.      [ENAMETOOLONG]
  47.                    A component of either pathname exceeded 255 characters, or
  48.                    the entire length of either path name exceeded 1023 charac­
  49.                    ters.
  50.  
  51.      [ENOENT]      A component of the _f_r_o_m path does not exist, or a path pre­
  52.                    fix of _t_o does not exist.
  53.  
  54.      [EACCES]      A component of either path prefix denies search permission.
  55.  
  56.      [EACCES]      The requested link requires writing in a directory with a
  57.                    mode that denies write permission.
  58.  
  59.      [EPERM]       The directory containing _f_r_o_m is marked sticky, and neither
  60.                    the containing directory nor _f_r_o_m are owned by the effec­
  61.                    tive user ID.
  62.  
  63.      [EPERM]       The _t_o file exists, the directory containing _t_o is marked
  64.                    sticky, and neither the containing directory nor _t_o are
  65.  
  66.                    owned by the effective user ID.
  67.  
  68.      [ELOOP]       Too many symbolic links were encountered in translating ei­
  69.                    ther pathname.
  70.  
  71.      [ENOTDIR]     A component of either path prefix is not a directory.
  72.  
  73.      [ENOTDIR]     _f_r_o_m is a directory, but _t_o is not a directory.
  74.  
  75.      [EISDIR]      _t_o is a directory, but _f_r_o_m is not a directory.
  76.  
  77.      [EXDEV]       The link named by _t_o and the file named by _f_r_o_m are on dif­
  78.                    ferent logical devices (file systems).  Note that this er­
  79.                    ror code will not be returned if the implementation permits
  80.                    cross­device links.
  81.  
  82.      [ENOSPC]      The directory in which the entry for the new name is being
  83.                    placed cannot be extended because there is no space left on
  84.                    the file system containing the directory.
  85.  
  86.      [EDQUOT]      The directory in which the entry for the new name is being
  87.                    placed cannot be extended because the user's quota of disk
  88.                    blocks on the file system containing the directory has been
  89.                    exhausted.
  90.  
  91.      [EIO]         An I/O error occurred while making or updating a directory
  92.                    entry.
  93.  
  94.      [EROFS]       The requested link requires writing in a directory on a
  95.                    read­only file system.
  96.  
  97.      [EFAULT]      _P_a_t_h points outside the process's allocated address space.
  98.  
  99.      [EINVAL]      _F_r_o_m is a parent directory of _t_o, or an attempt is made to
  100.                    rename `.' or `..'.
  101.  
  102.      [ENOTEMPTY]   _T_o is a directory and is not empty.
  103.  
  104. SSEEEE AALLSSOO
  105.      open(2)
  106.  
  107. SSTTAANNDDAARRDDSS
  108.      RReennaammee() conforms to IEEE Std 1003.1­1988 (``POSIX'').
  109.  
  110. 4.2 Berkeley Distribution       March 10, 1991                               2
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.