Bump to 1.14.1
[platform/upstream/augeas.git] / doc / posix-functions / unlinkat.texi
1 @node unlinkat
2 @section @code{unlinkat}
3 @findex unlinkat
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html}
6
7 Gnulib module: unlinkat
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function is missing on some platforms:
13 glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
14 AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
15 But the replacement function is not safe to be used in libraries and is not multithread-safe.
16 @item
17 On Mac OS X 10.10, in a writable HFS mount, @code{unlinkat(fd, "..", 0)} succeeds
18 without doing anything.
19 @item
20 Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}:
21 GNU/Hurd, Solaris 9.
22 @item
23 Some platforms declare this function in @code{fcntl.h} instead of
24 @code{unistd.h}:
25 Cygwin 1.7.1.
26 @end itemize
27
28 Portability problems not fixed by Gnulib:
29 @itemize
30 @item
31 When @code{unlinkat(fd,name,AT_REMOVEDIR)} fails because the specified
32 directory is not empty, the @code{errno} value is system dependent.
33 @item
34 POSIX requires that @code{unlinkdir(fd,"link-to-empty/",AT_REMOVEDIR)}
35 remove @file{empty} and leave @file{link-to-empty} as a dangling
36 symlink.  This is counter-intuitive, so some systems fail with
37 @code{ENOTDIR} instead:
38 glibc
39 @item
40 Some systems allow a superuser to unlink directories, even though this
41 can cause file system corruption.  The error given if a process is not
42 permitted to unlink directories varies across implementations; it is
43 not always the POSIX value of @code{EPERM}.  Meanwhile, if a process
44 has the ability to unlink directories, POSIX requires that
45 @code{unlinkat(fd,"symlink-to-dir/",0)} remove @file{dir} and leave
46 @file{symlink-to-dir} dangling; this behavior is counter-intuitive.
47 The gnulib module unlinkdir can help determine whether code must be
48 cautious of unlinking directories.
49 @item
50 Removing an open file is non-portable: On Unix this allows the programs that
51 have the file already open to continue working with it; the file's storage
52 is only freed when the no process has the file open any more.  On Windows,
53 the attempt to remove an open file fails.
54 @end itemize