fcb70538cf18ac42cfdeb8bc75c91ded042867e4
[gnulib.git] / doc / posix-functions / renameat.texi
1 @node renameat
2 @section @code{renameat}
3 @findex renameat
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/renameat.html}
6
7 Gnulib module: renameat
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function does not reject trailing slashes on non-directories on
13 some platforms, as in @code{renameat(fd,"file",fd,"new/")}:
14 Solaris 11 2010-11.
15 @item
16 This function ignores trailing slashes on symlinks on some platforms,
17 such that @code{renameat(fd,"link/",fd,"new")} corrupts @file{link}:
18 Solaris 9.
19 @item
20 This function is declared in @code{<unistd.h>} instead of @code{<stdio.h>}
21 on some platforms:
22 Solaris 11 2010-11.
23 @item
24 This function is missing on some platforms:
25 glibc 2.3.6, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX
26 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw,
27 Interix 3.5, BeOS.
28 But the replacement function is not safe to be used in libraries and is not multithread-safe.
29 @end itemize
30
31 Portability problems not fixed by Gnulib:
32 @itemize
33 @item
34 POSIX requires that @code{renameat(fd,"symlink-to-dir/",fd,"dir2")} rename
35 @file{dir} and leave @file{symlink-to-dir} dangling; likewise, it
36 requires that @code{renameat(fd,"dir",fd,"dangling/")} rename @file{dir} so
37 that @file{dangling} is no longer a dangling symlink.  This behavior
38 is counter-intuitive, so on some systems, @code{renameat} fails with
39 @code{ENOTDIR} if either argument is a symlink with a trailing slash:
40 glibc, OpenBSD, Cygwin 1.7.
41 @item
42 After renaming a non-empty directory over an existing empty directory,
43 the old directory name is still visible through the @code{stat} function
44 for 30 seconds after the rename, on NFS file systems, on some platforms:
45 Linux 2.6.18.
46 @item
47 This function will not rename a source that is currently opened
48 by any process:
49 mingw.
50 @end itemize