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: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
19       Before glibc 2.10: _ATFILE_SOURCE
20

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

56       renameat() was added to Linux in kernel 2.6.16.
57

CONFORMING TO

59       POSIX.1-2008.
60

NOTES

62       See openat(2) for an explanation of the need for renameat().
63

SEE ALSO

65       openat(2), rename(2), path_resolution(7)
66

COLOPHON

68       This  page  is  part of release 3.25 of the Linux man-pages project.  A
69       description of the project, and information about reporting  bugs,  can
70       be found at http://www.kernel.org/doc/man-pages/.
71
72
73
74Linux                             2009-12-13                       RENAMEAT(2)
Impressum