Documentation about Minix.
[gnulib.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: openat
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function is missing on some platforms:
13 glibc 2.3.6, MacOS 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, 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 Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}:
18 GNU/Hurd, Solaris 9.
19 @item
20 Some platforms declare this function in @code{fcntl.h} instead of
21 @code{unistd.h}:
22 Cygwin 1.7.1.
23 @end itemize
24
25 Portability problems not fixed by Gnulib:
26 @itemize
27 @item
28 When @code{unlinkat(fd,name,AT_REMOVEDIR)} fails because the specified
29 directory is not empty, the @code{errno} value is system dependent.
30 @item
31 POSIX requires that @code{unlinkdir(fd,"link-to-empty/",AT_REMOVEDIR)}
32 remove @file{empty} and leave @file{link-to-empty} as a dangling
33 symlink.  This is counter-intuitive, so some systems fail with
34 @code{ENOTDIR} instead:
35 glibc
36 @item
37 Some systems allow a superuser to unlink directories, even though this
38 can cause file system corruption.  The error given if a process is not
39 permitted to unlink directories varies across implementations; it is
40 not always the POSIX value of @code{EPERM}.  Meanwhile, if a process
41 has the ability to unlink directories, POSIX requires that
42 @code{unlinkat(fd,"symlink-to-dir/",0)} remove @file{dir} and leave
43 @file{symlink-to-dir} dangling; this behavior is counter-intuitive.
44 The gnulib module unlinkdir can help determine whether code must be
45 cautious of unlinking directories.
46 @item
47 Removing an open file is non-portable: On Unix this allows the programs that
48 have the file already open to continue working with it; the file's storage
49 is only freed when the no process has the file open any more.  On Windows,
50 the attempt to remove an open file fails.
51 @end itemize