Annotation of 43BSDReno/lib/libc/sys/rename.2, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 The Regents of the University of California.
                      2: .\" All rights reserved.
                      3: .\"
                      4: .\" Redistribution and use in source and binary forms are permitted provided
                      5: .\" that: (1) source distributions retain this entire copyright notice and
                      6: .\" comment, and (2) distributions including binaries display the following
                      7: .\" acknowledgement:  ``This product includes software developed by the
                      8: .\" University of California, Berkeley and its contributors'' in the
                      9: .\" documentation or other materials provided with the distribution and in
                     10: .\" all advertising materials mentioning features or use of this software.
                     11: .\" Neither the name of the University nor the names of its contributors may
                     12: .\" be used to endorse or promote products derived from this software without
                     13: .\" specific prior written permission.
                     14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     17: .\"
                     18: .\"    @(#)rename.2    6.6 (Berkeley) 6/23/90
                     19: .\"
                     20: .TH RENAME 2 "June 23, 1990"
                     21: .UC 5
                     22: .SH NAME
                     23: rename \- change the name of a file
                     24: .SH SYNOPSIS
                     25: .ft B
                     26: .nf
                     27: rename(from, to)
                     28: char *from, *to;
                     29: .fi
                     30: .ft R
                     31: .SH DESCRIPTION
                     32: .I Rename
                     33: causes the link named
                     34: .I from
                     35: to be renamed as
                     36: .IR to .
                     37: If 
                     38: .I to
                     39: exists, then it is first removed.
                     40: Both 
                     41: .I from
                     42: and
                     43: .I to
                     44: must be of the same type (that is, both directories or both
                     45: non-directories), and must reside on the same file system.
                     46: .PP
                     47: .I Rename
                     48: guarantees that an instance of
                     49: .I to
                     50: will always exist, even if the system should crash in
                     51: the middle of the operation.
                     52: .PP
                     53: If the final component of
                     54: .I from
                     55: is a symbolic link,
                     56: the symbolic link is renamed,
                     57: not the file or directory to which it points.
                     58: .SH CAVEAT
                     59: The system can deadlock if a loop in the file system graph is present.
                     60: This loop takes the form of an entry in directory \*(lqa\*(rq,
                     61: say \*(lqa/foo\*(rq,
                     62: being a hard link to directory \*(lqb\*(rq, and an entry in
                     63: directory \*(lqb\*(rq, say \*(lqb/bar\*(rq, being a hard link
                     64: to directory \*(lqa\*(rq.
                     65: When such a loop exists and two separate processes attempt to
                     66: perform \*(lqrename a/foo b/bar\*(rq and \*(lqrename b/bar a/foo\*(rq,
                     67: respectively, 
                     68: the system may deadlock attempting to lock
                     69: both directories for modification.
                     70: Hard links to directories should be
                     71: replaced by symbolic links by the system administrator.
                     72: .SH "RETURN VALUE"
                     73: A 0 value is returned if the operation succeeds, otherwise
                     74: .I rename
                     75: returns \-1 and the global variable 
                     76: .I errno
                     77: indicates the reason for the failure.
                     78: .SH "ERRORS
                     79: .I Rename
                     80: will fail and neither of the argument files will be
                     81: affected if any of the following are true:
                     82: .TP 15
                     83: [EINVAL]
                     84: Either pathname contains a character with the high-order bit set.
                     85: .TP 15
                     86: [ENAMETOOLONG]
                     87: A component of either pathname exceeded 255 characters,
                     88: or the entire length of either path name exceeded 1023 characters.
                     89: .TP 15
                     90: [ENOENT]
                     91: A component of the \fIfrom\fP path does not exist,
                     92: or a path prefix of \fIto\fP does not exist.
                     93: .TP 15
                     94: [EACCES]
                     95: A component of either path prefix denies search permission.
                     96: .TP 15
                     97: [EACCES]
                     98: The requested link requires writing in a directory with a mode
                     99: that denies write permission.
                    100: .TP 15
                    101: [EPERM]
                    102: The directory containing \fIfrom\fP is marked sticky,
                    103: and neither the containing directory nor \fIfrom\fP
                    104: are owned by the effective user ID.
                    105: .TP 15
                    106: [EPERM]
                    107: The \fIto\fP file exists,
                    108: the directory containing \fIto\fP is marked sticky,
                    109: and neither the containing directory nor \fIto\fP
                    110: are owned by the effective user ID.
                    111: .TP 15
                    112: [ELOOP]
                    113: Too many symbolic links were encountered in translating either pathname.
                    114: .TP 15
                    115: [ENOTDIR]
                    116: A component of either path prefix is not a directory.
                    117: .TP 15
                    118: [ENOTDIR]
                    119: .I From
                    120: is a directory, but \fIto\fP is not a directory.
                    121: .TP 15
                    122: [EISDIR]
                    123: .I To
                    124: is a directory, but \fIfrom\fP is not a directory.
                    125: .TP 15
                    126: [EXDEV]
                    127: The link named by \fIto\fP and the file named by \fIfrom\fP
                    128: are on different logical devices (file systems).  Note that this error
                    129: code will not be returned if the implementation permits cross-device
                    130: links.
                    131: .TP 15
                    132: [ENOSPC]
                    133: The directory in which the entry for the new name is being placed
                    134: cannot be extended because there is no space left on the file
                    135: system containing the directory.
                    136: .TP 15
                    137: [EDQUOT]
                    138: The directory in which the entry for the new name
                    139: is being placed cannot be extended because the
                    140: user's quota of disk blocks on the file system
                    141: containing the directory has been exhausted.
                    142: .TP 15
                    143: [EIO]
                    144: An I/O error occurred while making or updating a directory entry.
                    145: .TP 15
                    146: [EROFS]
                    147: The requested link requires writing in a directory on a read-only file
                    148: system.
                    149: .TP 15
                    150: [EFAULT]
                    151: .I Path
                    152: points outside the process's allocated address space.
                    153: .TP 15
                    154: [EINVAL]
                    155: .I From
                    156: is a parent directory of
                    157: .IR to ,
                    158: or an attempt is made to rename ``.'' or ``..''.
                    159: .TP 15
                    160: [ENOTEMPTY]
                    161: .I To
                    162: is a directory and is not empty.
                    163: .SH "SEE ALSO"
                    164: open(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.