1RENAMEAT(2)                Linux Programmer's Manual               RENAMEAT(2)
2
3
4

NAME

6       renameat - rename a file relative to directory file descriptors
7

SYNOPSIS

9       #define _ATFILE_SOURCE
10       #include <fcntl.h> /* Definition of AT_* constants */
11       #include <stdio.h>
12
13       int renameat(int olddirfd, const char *oldpath,
14                    int newdirfd, const char *newpath);
15

DESCRIPTION

17       The  renameat()  system  call  operates  in  exactly  the  same  way as
18       rename(2), except for the differences described in this manual page.
19
20       If the pathname given in oldpath is relative, then  it  is  interpreted
21       relative  to  the directory referred to by the file descriptor olddirfd
22       (rather than relative to the current working directory of  the  calling
23       process, as is done by rename(2) for a relative pathname).
24
25       If oldpath is relative and olddirfd is the special value AT_FDCWD, then
26       oldpath is interpreted relative to the current working directory of the
27       calling process (like rename(2)).
28
29       If oldpath is absolute, then olddirfd is ignored.
30
31       The interpretation of newpath is as for oldpath, except that a relative
32       pathname is interpreted relative to the directory referred  to  by  the
33       file descriptor newdirfd.
34

RETURN VALUE

36       On  success,  renameat() returns 0.  On error, -1 is returned and errno
37       is set to indicate the error.
38

ERRORS

40       The same errors that occur for rename(2) can also occur for renameat().
41       The following additional errors can occur for renameat():
42
43       EBADF  olddirfd or newdirfd is not a valid file descriptor.
44
45       ENOTDIR
46              oldpath  is relative and olddirfd is a file descriptor referring
47              to a file other than a directory; or  similar  for  newpath  and
48              newdirfd
49

VERSIONS

51       renameat() was added to Linux in kernel 2.6.16.
52

CONFORMING TO

54       POSIX.1-2008.
55

NOTES

57       See openat(2) for an explanation of the need for renameat().
58

SEE ALSO

60       openat(2), rename(2), path_resolution(7)
61

COLOPHON

63       This  page  is  part of release 3.22 of the Linux man-pages project.  A
64       description of the project, and information about reporting  bugs,  can
65       be found at http://www.kernel.org/doc/man-pages/.
66
67
68
69Linux                             2008-08-21                       RENAMEAT(2)
Impressum