1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-18 23:42:00 +03:00
Files
gnulib/doc/posix-functions/unlinkat.texi
Bruno Haible 84c3f9cf54 New module 'unlinkat', split off from module 'openat'.
* m4/unlinkat.m4: New file, extracted from m4/openat.m4.
* m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_UNLINKAT,
REPLACE_UNLINKAT, HAVE_UNLINKAT. Don't test for unlinkat.
* modules/unlinkat: New file, extracted from modules/openat. Correct
the dependency conditions.
* modules/openat (Files): Remove lib/unlinkat.c.
(Depends-on): Remove rmdir, unlink.
(configure.ac): Remove AC_LIBOBJ of unlinkat.
* modules/unlinkat-tests: New file, extracted from modules/openat-tests.
* modules/openat-tests (Files): Remove tests/test-unlinkat.c,
tests/test-rmdir.h, tests/test-unlink.h.
(Depends-on): Remove unlinkdir.
(Makefile.am): Remove rules for test-unlinkat.
* doc/posix-functions/unlinkat.texi: Mention module 'unlinkat' instead
of module 'openat'.
* NEWS: Mention the change.
* modules/linkat-tests (Depends-on): Add unlinkat.
* modules/mkfifoat-tests (Depends-on): Likewise.
* modules/readlinkat-tests (Depends-on): Likewise.
2011-11-02 22:55:16 +01:00

52 lines
2.0 KiB
Plaintext

@node unlinkat
@section @code{unlinkat}
@findex unlinkat
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html}
Gnulib module: unlinkat
Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
glibc 2.3.6, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
But the replacement function is not safe to be used in libraries and is not multithread-safe.
@item
Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}:
GNU/Hurd, Solaris 9.
@item
Some platforms declare this function in @code{fcntl.h} instead of
@code{unistd.h}:
Cygwin 1.7.1.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
When @code{unlinkat(fd,name,AT_REMOVEDIR)} fails because the specified
directory is not empty, the @code{errno} value is system dependent.
@item
POSIX requires that @code{unlinkdir(fd,"link-to-empty/",AT_REMOVEDIR)}
remove @file{empty} and leave @file{link-to-empty} as a dangling
symlink. This is counter-intuitive, so some systems fail with
@code{ENOTDIR} instead:
glibc
@item
Some systems allow a superuser to unlink directories, even though this
can cause file system corruption. The error given if a process is not
permitted to unlink directories varies across implementations; it is
not always the POSIX value of @code{EPERM}. Meanwhile, if a process
has the ability to unlink directories, POSIX requires that
@code{unlinkat(fd,"symlink-to-dir/",0)} remove @file{dir} and leave
@file{symlink-to-dir} dangling; this behavior is counter-intuitive.
The gnulib module unlinkdir can help determine whether code must be
cautious of unlinking directories.
@item
Removing an open file is non-portable: On Unix this allows the programs that
have the file already open to continue working with it; the file's storage
is only freed when the no process has the file open any more. On Windows,
the attempt to remove an open file fails.
@end itemize