source: trunk/minix/man/man2/rename.2@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 3.1 KB
Line 
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)rename.2 6.4 (Berkeley) 5/22/86
6.\"
7.TH RENAME 2 "May 22, 1986"
8.UC 5
9.SH NAME
10rename \- change the name of a file
11.SH SYNOPSIS
12.ft B
13.nf
14#include <stdio.h>
15
16int rename(const char *\fIfrom\fP, const char *\fIto\fP)
17.fi
18.ft R
19.SH DESCRIPTION
20.B Rename
21causes the link named
22.I from
23to be renamed as
24.IR to .
25If
26.I to
27exists, then it is first removed.
28Both
29.I from
30and
31.I to
32must be of the same type (that is, both directories or both
33non-directories), and must reside on the same file system.
34.PP
35.B Rename
36guarantees that an instance of
37.I to
38will always exist, even if the system should crash in
39the middle of the operation.
40.PP
41If the final component of
42.I from
43is a symbolic link,
44the symbolic link is renamed,
45not the file or directory to which it points.
46.SH "RETURN VALUE"
47A 0 value is returned if the operation succeeds, otherwise
48.B rename
49returns \-1 and the global variable
50.B errno
51indicates the reason for the failure.
52.SH "ERRORS
53.B Rename
54will fail and neither of the argument files will be
55affected if any of the following are true:
56.TP 15
57[ENAMETOOLONG]
58A path name exceeds PATH_MAX characters.
59.TP 15
60[ENOENT]
61A component of the \fIfrom\fP path does not exist,
62or a path prefix of \fIto\fP does not exist.
63.TP 15
64[EACCES]
65A component of either path prefix denies search permission.
66.TP 15
67[EACCES]
68The requested link requires writing in a directory with a mode
69that denies write permission.
70.TP 15
71[EPERM]
72The directory containing \fIfrom\fP is marked sticky,
73and neither the containing directory nor \fIfrom\fP
74are owned by the effective user ID.
75.TP 15
76[EPERM]
77The \fIto\fP file exists,
78the directory containing \fIto\fP is marked sticky,
79and neither the containing directory nor \fIto\fP
80are owned by the effective user ID.
81.TP 15
82[ELOOP]
83Too many symbolic links were encountered in translating either pathname.
84(Minix-vmd)
85.TP 15
86[ENOTDIR]
87A component of either path prefix is not a directory.
88.TP 15
89[ENOTDIR]
90.I From
91is a directory, but \fIto\fP is not a directory.
92.TP 15
93[EISDIR]
94.I To
95is a directory, but \fIfrom\fP is not a directory.
96.TP 15
97[EXDEV]
98The link named by \fIto\fP and the file named by \fIfrom\fP
99are on different logical devices (file systems).
100.TP 15
101[ENOSPC]
102The directory in which the entry for the new name is being placed
103cannot be extended because there is no space left on the file
104system containing the directory.
105.ig
106.TP 15
107[EDQUOT]
108The directory in which the entry for the new name
109is being placed cannot be extended because the
110user's quota of disk blocks on the file system
111containing the directory has been exhausted.
112..
113.TP 15
114[EIO]
115An I/O error occurred while making or updating a directory entry.
116.TP 15
117[EROFS]
118The requested link requires writing in a directory on a read-only file
119system.
120.TP 15
121[EFAULT]
122.I Path
123points outside the process's allocated address space.
124.TP 15
125[EINVAL]
126.I From
127is a parent directory of
128.IR to ,
129or an attempt is made to rename ``.'' or ``..''.
130.TP 15
131[ENOTEMPTY]
132.I To
133is a directory and is not empty.
134.SH "SEE ALSO"
135.BR open (2)
Note: See TracBrowser for help on using the repository browser.