Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rename(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod, fchmod

mkdir

chmod

mkdir

mknod

mvdir



RENAME(2,L)                 AIX Technical Reference                 RENAME(2,L)



-------------------------------------------------------------------------------
rename



PURPOSE

Renames a directory or a file within a file system.

SYNTAX

int rename (frompath, topath)
char *frompath, *topath;

DESCRIPTION

The rename system call renames a directory or a file within a file system.  The
frompath and topath parameters must both be either files or directories.

For rename to execute successfully, the calling process must have write
permission to the parent directories of both frompath and topath, if it already
exists.

If topath exists, and the parent directory of topath has the sticky attribute
bit set, the calling process must have an effective user ID equal to:

  o the owner ID of topath, or to

  o the owner ID of the parent directory of topath.

The file or directory named by frompath cannot contain the file or directory
named by topath.  If topath is an existing file or empty directory, it is
replaced by frompath.  If topath is a nonempty directory, rename exits with an
error.

If the file named by frompath is a symbolic link, the symbolic link is renamed.
If the file named by topath is an existing symbolic link, the symbolic link is
destroyed.

RETURN VALUE

Upon successful completion, the rename system call returns a value of 0.  If
the rename system call fails, a value of -1 is returned, and errno is set to
indicate the error.

ERROR CONDITIONS

The rename system call fails and the file or directory name remains unchanged
if one or more of the following are true:






Processed November 7, 1990        RENAME(2,L)                                 1





RENAME(2,L)                 AIX Technical Reference                 RENAME(2,L)



ENOTDIR   A component of either path prefix is not a directory or frompath
          names a directory and topath names a nondirectory.

EISDIR    The topath parameter names a directory and the frompath parameter
          names a nondirectory.

ENAMETOOLONG
          A component of either the frompath parameter or the topath parameter
          exceeded NAME_MAX characters or the entire parameter exceeded
          PATH_MAX characters.

ENOENT    A component of either path does not exist or the file named by
          frompath does not exist.

EACCES    Creating the requested link or removing the old link requires writing
          in a directory with a mode that denies write permission.

EACCES    Search permission is denied on a component of either frompath or
          topath.

EPERM     The file named by the topath parameter is in a directory with the
          sticky attribute bit set, and the effective user ID of the calling
          process is not equal to the owner of the file or of the parent
          directory.

EXDEV     The link named by topath and the file named by frompath are on
          different file systems.

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

EFAULT    Either frompath or topath points outside of the process's allocated
          address space.

EBUSY     The frompath or topath directory is currently in use by the system or
          by another process.

EINVAL    The frompath or the topath is either the current directory or the
          parent of the current directory.

EINVAL    frompath is an ancestor directory of topath.

EEXIST    The topath parameter is an existing nonempty directory.

EINTR     A signal was caught during the system call.

ESTALE    The process's root or current directory is located in an NFS virtual
          file system that has been unmounted.

EDQUOT    The directory in which the entry for the new link is being placed
          cannot be extended because the user's quota of disk blocks on the
          file system containing the directory has been exhausted.




Processed November 7, 1990        RENAME(2,L)                                 2





RENAME(2,L)                 AIX Technical Reference                 RENAME(2,L)



RELATED INFORMATION

In this book:  "chmod, fchmod" and "mkdir."

The chmod, mkdir, and mknod, and mvdir commands in AIX Operating System
Commands Reference.

















































Processed November 7, 1990        RENAME(2,L)                                 3



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