New module 'unlinkat', split off from module 'openat'.
authorBruno Haible <bruno@clisp.org>
Wed, 2 Nov 2011 21:34:51 +0000 (22:34 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 2 Nov 2011 21:55:16 +0000 (22:55 +0100)
* 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.

12 files changed:
ChangeLog
NEWS
doc/posix-functions/unlinkat.texi
m4/openat.m4
m4/unlinkat.m4 [new file with mode: 0644]
modules/linkat-tests
modules/mkfifoat-tests
modules/openat
modules/openat-tests
modules/readlinkat-tests
modules/unlinkat [new file with mode: 0644]
modules/unlinkat-tests [new file with mode: 0644]

index 4c743d9..4c1bde0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2011-11-03  Bruno Haible  <bruno@clisp.org>
+
+       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  Bruno Haible  <bruno@clisp.org>
 
        New module 'fchmodat', split off from module 'openat'.
diff --git a/NEWS b/NEWS
index ad6a468..045de1f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,11 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
-2011-11-01  openat          This module no longer provides the fchmodat()
+2011-11-03  openat          This module no longer provides the unlinkat()
+                            function. If you need this function, you now need
+                            to request the 'unlinkat' module.
+
+2011-11-02  openat          This module no longer provides the fchmodat()
                             function. If you need this function, you now need
                             to request the 'fchmodat' module.
 
index 40bc21b..6bb9436 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html}
 
-Gnulib module: openat
+Gnulib module: unlinkat
 
 Portability problems fixed by Gnulib:
 @itemize
index 5166caf..86e3144 100644 (file)
@@ -1,4 +1,4 @@
-# serial 39
+# serial 40
 # See if we need to use our replacement for Solaris' openat et al functions.
 
 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
@@ -17,28 +17,19 @@ AC_DEFUN([gl_FUNC_OPENAT],
   GNULIB_FSTATAT=1
   GNULIB_MKDIRAT=1
 
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  GNULIB_UNLINKAT=1
-
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([mkdirat openat unlinkat])
+  AC_CHECK_FUNCS_ONCE([mkdirat openat])
   AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
-  AC_REQUIRE([gl_FUNC_UNLINK])
   case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
   yes+yes)
-    # GNU/Hurd has unlinkat, but it has the same bug as unlink.
-    if test $REPLACE_UNLINK = 1; then
-      REPLACE_UNLINKAT=1
-    fi ;;
+    ;;
   yes+*)
     # Solaris 9 has *at functions, but uniformly mishandles trailing
     # slash in all of them.
     REPLACE_OPENAT=1
-    REPLACE_UNLINKAT=1
     ;;
   *)
     HAVE_OPENAT=0
-    HAVE_UNLINKAT=0 # No known system with unlinkat but not openat
     gl_PREREQ_OPENAT;;
   esac
   if test $ac_cv_func_mkdirat != yes; then
diff --git a/m4/unlinkat.m4 b/m4/unlinkat.m4
new file mode 100644 (file)
index 0000000..724d3cd
--- /dev/null
@@ -0,0 +1,30 @@
+# unlinkat.m4 serial 1
+dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_UNLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([unlinkat])
+  AC_REQUIRE([gl_FUNC_UNLINK])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  if test $ac_cv_func_unlinkat = no; then
+    HAVE_UNLINKAT=0
+  else
+    if test $gl_cv_func_lstat_dereferences_slashed_symlink != yes; then
+      # Solaris 9 has *at functions, but uniformly mishandles trailing
+      # slash in all of them.
+      REPLACE_UNLINKAT=1
+    else
+      # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+      if test $REPLACE_UNLINK = 1; then
+        REPLACE_UNLINKAT=1
+      fi
+    fi
+  fi
+])
index a65a382..92cb43f 100644 (file)
@@ -10,6 +10,7 @@ areadlink-with-size
 filenamecat-lgpl
 getcwd-lgpl
 same-inode
+unlinkat
 
 configure.ac:
 
index 8be33df..b50bbf5 100644 (file)
@@ -7,6 +7,7 @@ tests/macros.h
 Depends-on:
 ignore-value
 symlink
+unlinkat
 
 configure.ac:
 
index a25e83d..167fa92 100644 (file)
@@ -9,7 +9,6 @@ lib/openat.c
 lib/openat.h
 lib/openat-priv.h
 lib/openat-proc.c
-lib/unlinkat.c
 m4/openat.m4
 m4/mode_t.m4
 
@@ -28,12 +27,10 @@ lstat
 mkdir           [test $HAVE_MKDIRAT = 0]
 open
 openat-die
-rmdir           [test $REPLACE_UNLINKAT = 1]
 save-cwd
 stdbool
 sys_stat
 unistd
-unlink          [test $REPLACE_UNLINKAT = 1]
 
 configure.ac:
 gl_FUNC_OPENAT
@@ -47,9 +44,6 @@ fi
 if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
   AC_LIBOBJ([openat])
 fi
-if test $ac_cv_func_unlinkat = no || test $REPLACE_UNLINKAT = 1; then
-  AC_LIBOBJ([unlinkat])
-fi
 
 Makefile.am:
 
index 8000033..bdefca3 100644 (file)
@@ -1,13 +1,10 @@
 Files:
 tests/test-lstat.h
 tests/test-mkdir.h
-tests/test-rmdir.h
 tests/test-stat.h
-tests/test-unlink.h
 tests/test-fstatat.c
 tests/test-mkdirat.c
 tests/test-openat.c
-tests/test-unlinkat.c
 tests/signature.h
 tests/macros.h
 
@@ -16,16 +13,14 @@ getcwd-lgpl
 ignore-value
 progname
 symlink
-unlinkdir
 
 configure.ac:
 
 Makefile.am:
 TESTS += \
-  test-fstatat test-mkdirat test-openat test-unlinkat
+  test-fstatat test-mkdirat test-openat
 check_PROGRAMS += \
-  test-fstatat test-mkdirat test-openat test-unlinkat
+  test-fstatat test-mkdirat test-openat
 test_fstatat_LDADD = $(LDADD) @LIBINTL@
 test_mkdirat_LDADD = $(LDADD) @LIBINTL@
 test_openat_LDADD = $(LDADD) @LIBINTL@
-test_unlinkat_LDADD = $(LDADD) @LIBINTL@
index de23df8..6c57fdf 100644 (file)
@@ -7,6 +7,7 @@ tests/macros.h
 Depends-on:
 ignore-value
 symlinkat
+unlinkat
 
 configure.ac:
 
diff --git a/modules/unlinkat b/modules/unlinkat
new file mode 100644 (file)
index 0000000..b01d91e
--- /dev/null
@@ -0,0 +1,43 @@
+Description:
+unlinkat() function: Remove a file at a directory.
+
+Files:
+lib/unlinkat.c
+lib/at-func.c
+lib/openat.h
+lib/openat-priv.h
+m4/unlinkat.m4
+
+Depends-on:
+dirent
+dosname
+errno
+extensions
+fchdir
+fcntl-h
+openat
+openat-die
+rmdir           [test $HAVE_UNLINKAT = 0]
+save-cwd
+stdbool
+sys_stat
+unistd
+unlink          [test $HAVE_UNLINKAT = 0]
+
+configure.ac:
+gl_FUNC_UNLINKAT
+if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+  AC_LIBOBJ([unlinkat])
+fi
+gl_UNISTD_MODULE_INDICATOR([unlinkat])
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering, Eric Blake
diff --git a/modules/unlinkat-tests b/modules/unlinkat-tests
new file mode 100644 (file)
index 0000000..266ead7
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/test-unlinkat.c
+tests/test-rmdir.h
+tests/test-unlink.h
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+ignore-value
+progname
+symlink
+unlinkdir
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-unlinkat
+check_PROGRAMS += test-unlinkat
+test_unlinkat_LDADD = $(LDADD) @LIBINTL@