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 <stdio.h>
11
12       int renameat(int olddirfd, const char *oldpath,
13                    int newdirfd, const char *newpath);
14

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

NOTES

50       See openat(2) for an explanation of the need for renameat().
51

CONFORMING TO

53       This  system  call  is  non-standard but is proposed for inclusion in a
54       future revision of POSIX.1.
55

VERSIONS

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

SEE ALSO

60       openat(2), rename(2), path_resolution(2)
61
62
63
64Linux 2.6.16                      2006-04-10                       RENAMEAT(2)
Impressum