Compaq Fortran for Tru64 UNIX Alpha Systems V5.4

rename (3f)


Syntax

  integer*4 rename, ierrno
  character*len from, to
  external rename
  ierrno = rename ( from, to )

Description

  The rename function causes the link named from to be renamed as to . If to
  exists, then it is first removed. Both from and to must be of the same file
  type (that is, both must be directories or both must not be directories),
  and must reside on the same file system.

  The rename function guarantees that an instance of to always exists, even
  if the system should crash in the middle of the operation.

Restrictions

  The system can deadlock if a loop in the file system graph is present. This
  loop takes the form of an entry in directory "a". For example, "a/foo" is a
  hard link to directory "b" and an entry in directory "b", and "b/bar" is a
  hard link to directory "a".

  When such a loop exists and two separate processes attempt to perform
  "rename a/foo b/bar" and "rename b/bar a/foo", respectively, the system can
  deadlock while attempting to lock both directories for modification.

Return Values

  If the rename function is successful, it returns a zero value; otherwise,
  rename returns -1 and the global variable errno indicates the reason for
  the failure.

See Also

  open(2), rename(2)