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       #include <fcntl.h> /* Definition of AT_* constants */
10       #include <stdio.h>
11
12       int renameat(int olddirfd, const char *oldpath,
13                    int newdirfd, const char *newpath);
14
15   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17       renameat():
18           Since glibc 2.10:
19               _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
20           Before glibc 2.10:
21               _ATFILE_SOURCE
22

DESCRIPTION

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

RETURN VALUE

43       On  success,  renameat() returns 0.  On error, -1 is returned and errno
44       is set to indicate the error.
45

ERRORS

47       The same errors that occur for rename(2) can also occur for renameat().
48       The following additional errors can occur for renameat():
49
50       EBADF  olddirfd or newdirfd is not a valid file descriptor.
51
52       ENOTDIR
53              oldpath  is relative and olddirfd is a file descriptor referring
54              to a file other than a directory; or  similar  for  newpath  and
55              newdirfd
56

VERSIONS

58       renameat()  was  added  to  Linux in kernel 2.6.16; library support was
59       added to glibc in version 2.4.
60

CONFORMING TO

62       POSIX.1-2008.
63

NOTES

65       See openat(2) for an explanation of the need for renameat().
66

SEE ALSO

68       openat(2), rename(2), path_resolution(7)
69

COLOPHON

71       This page is part of release 3.53 of the Linux  man-pages  project.   A
72       description  of  the project, and information about reporting bugs, can
73       be found at http://www.kernel.org/doc/man-pages/.
74
75
76
77Linux                             2012-05-04                       RENAMEAT(2)
Impressum