changeset 16023:dc33aa820898

New module 'fstatat', split off from module 'openat'. * lib/openat.h (statat, lstatat): Enable only if GNULIB_FSTATAT is defined. * m4/fstatat.m4: New file. extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FSTATAT. Don't invoke gl_FUNC_FSTATAT. (gl_FUNC_FSTATAT): Moved to m4/fstatat.m4. * modules/fstatat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fstatat.c. (Depends-on): Remove lstat. (configure.ac): Remove AC_LIBOBJ of fstatat. * modules/fstatat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fstatat.c, tests/test-lstat.h, tests/test-stat.h. (Depends-on): Remove getcwd-lgpl. (Makefile.am): Remove rules for test-fstatat. * doc/posix-functions/fstatat.texi: Mention module 'fstatat' instead of module 'openat'. * NEWS: Mention the change. * modules/getcwd (Depends-on): Add fstatat. * modules/linkat (Depends-on): Likewise. * modules/mkfifoat-tests (Depends-on): Likewise. * modules/utimensat (Depends-on): Add fstatat. Remove openat.
author Bruno Haible <bruno@clisp.org>
date Thu, 03 Nov 2011 12:03:53 +0100
parents 08b63c40d129
children 1529bb1a37a5
files ChangeLog NEWS doc/posix-functions/fstatat.texi lib/openat.h m4/fstatat.m4 m4/openat.m4 modules/fstatat modules/fstatat-tests modules/getcwd modules/linkat modules/mkfifoat-tests modules/openat modules/openat-tests modules/utimensat
diffstat 14 files changed, 157 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 02 22:34:51 2011 +0100
+++ b/ChangeLog	Thu Nov 03 12:03:53 2011 +0100
@@ -1,3 +1,29 @@
+2011-11-04  Bruno Haible  <bruno@clisp.org>
+
+	New module 'fstatat', split off from module 'openat'.
+	* lib/openat.h (statat, lstatat): Enable only if GNULIB_FSTATAT is
+	defined.
+	* m4/fstatat.m4: New file. extracted from m4/openat.m4.
+	* m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FSTATAT. Don't invoke
+	gl_FUNC_FSTATAT.
+	(gl_FUNC_FSTATAT): Moved to m4/fstatat.m4.
+	* modules/fstatat: New file, extracted from modules/openat.
+	* modules/openat (Files): Remove lib/fstatat.c.
+	(Depends-on): Remove lstat.
+	(configure.ac): Remove AC_LIBOBJ of fstatat.
+	* modules/fstatat-tests: New file, extracted from modules/openat-tests.
+	* modules/openat-tests (Files): Remove tests/test-fstatat.c,
+	tests/test-lstat.h, tests/test-stat.h.
+	(Depends-on): Remove getcwd-lgpl.
+	(Makefile.am): Remove rules for test-fstatat.
+	* doc/posix-functions/fstatat.texi: Mention module 'fstatat' instead
+	of module 'openat'.
+	* NEWS: Mention the change.
+	* modules/getcwd (Depends-on): Add fstatat.
+	* modules/linkat (Depends-on): Likewise.
+	* modules/mkfifoat-tests (Depends-on): Likewise.
+	* modules/utimensat (Depends-on): Add fstatat. Remove openat.
+
 2011-11-03  Bruno Haible  <bruno@clisp.org>
 
 	New module 'unlinkat', split off from module 'openat'.
--- a/NEWS	Wed Nov 02 22:34:51 2011 +0100
+++ b/NEWS	Thu Nov 03 12:03:53 2011 +0100
@@ -12,6 +12,10 @@
 
 Date        Modules         Changes
 
+2011-11-04  openat          This module no longer provides the fstatat()
+                            function. If you need this function, you now need
+                            to request the 'fstatat' module.
+
 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.
--- a/doc/posix-functions/fstatat.texi	Wed Nov 02 22:34:51 2011 +0100
+++ b/doc/posix-functions/fstatat.texi	Thu Nov 03 12:03:53 2011 +0100
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fstatat.html}
 
-Gnulib module: openat
+Gnulib module: fstatat
 
 Portability problems fixed by Gnulib:
 @itemize
--- a/lib/openat.h	Wed Nov 02 22:34:51 2011 +0100
+++ b/lib/openat.h	Thu Nov 03 12:03:53 2011 +0100
@@ -80,6 +80,8 @@
 
 #endif
 
+#if GNULIB_FSTATAT
+
 static inline int
 statat (int fd, char const *name, struct stat *st)
 {
@@ -92,6 +94,8 @@
   return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
 }
 
+#endif
+
 /* For now, there are no wrappers named laccessat or leuidaccessat,
    since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and
    since access rights on symlinks are of limited utility.  Likewise,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/fstatat.m4	Thu Nov 03 12:03:53 2011 +0100
@@ -0,0 +1,51 @@
+# fstatat.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.
+
+# If we have the fstatat function, and it has the bug (in AIX 7.1)
+# that it does not fill in st_size correctly, use the replacement function.
+AC_DEFUN([gl_FUNC_FSTATAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_CHECK_FUNCS_ONCE([fstatat])
+
+  if test $ac_cv_func_fstatat = no; then
+    HAVE_FSTATAT=0
+  else
+    dnl Test for an AIX 7.1 bug; see
+    dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>.
+    AC_CACHE_CHECK([whether fstatat (..., 0) works],
+      [gl_cv_func_fstatat_zero_flag],
+      [gl_cv_func_fstatat_zero_flag=no
+       AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+            [[
+              #include <fcntl.h>
+              #include <sys/stat.h>
+              int
+              main (void)
+              {
+                struct stat a;
+                return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+              }
+            ]])],
+         [gl_cv_func_fstatat_zero_flag=yes])])
+
+    case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+    yes+yes) ;;
+    *) REPLACE_FSTATAT=1
+       if test $gl_cv_func_fstatat_zero_flag != yes; then
+         AC_DEFINE([FSTATAT_ZERO_FLAG_BROKEN], [1],
+           [Define to 1 if fstatat (..., 0) does not work,
+            as in AIX 7.1.])
+       fi
+       ;;
+    esac
+  fi
+])
--- a/m4/openat.m4	Wed Nov 02 22:34:51 2011 +0100
+++ b/m4/openat.m4	Thu Nov 03 12:03:53 2011 +0100
@@ -1,4 +1,4 @@
-# serial 40
+# serial 41
 # See if we need to use our replacement for Solaris' openat et al functions.
 
 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
@@ -14,7 +14,6 @@
   GNULIB_OPENAT=1
 
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-  GNULIB_FSTATAT=1
   GNULIB_MKDIRAT=1
 
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -35,56 +34,11 @@
   if test $ac_cv_func_mkdirat != yes; then
     HAVE_MKDIRAT=0
   fi
-  gl_FUNC_FSTATAT
 
   dnl This is tested at least via getcwd.c.
   gl_MODULE_INDICATOR([openat])
 ])
 
-# If we have the fstatat function, and it has the bug (in AIX 7.1)
-# that it does not fill in st_size correctly, use the replacement function.
-AC_DEFUN([gl_FUNC_FSTATAT],
-[
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
-  AC_CHECK_FUNCS_ONCE([fstatat])
-
-  if test $ac_cv_func_fstatat = no; then
-    HAVE_FSTATAT=0
-  else
-    dnl Test for an AIX 7.1 bug; see
-    dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>.
-    AC_CACHE_CHECK([whether fstatat (..., 0) works],
-      [gl_cv_func_fstatat_zero_flag],
-      [gl_cv_func_fstatat_zero_flag=no
-       AC_RUN_IFELSE(
-         [AC_LANG_SOURCE(
-            [[
-              #include <fcntl.h>
-              #include <sys/stat.h>
-              int
-              main (void)
-              {
-                struct stat a;
-                return fstatat (AT_FDCWD, ".", &a, 0) != 0;
-              }
-            ]])],
-         [gl_cv_func_fstatat_zero_flag=yes])])
-
-    case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
-    yes+yes) ;;
-    *) REPLACE_FSTATAT=1
-       if test $gl_cv_func_fstatat_zero_flag != yes; then
-         AC_DEFINE([FSTATAT_ZERO_FLAG_BROKEN], [1],
-           [Define to 1 if fstatat (..., 0) does not work,
-            as in AIX 7.1.])
-       fi
-       ;;
-    esac
-  fi
-])
-
 AC_DEFUN([gl_PREREQ_OPENAT],
 [
   AC_REQUIRE([AC_C_INLINE])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/fstatat	Thu Nov 03 12:03:53 2011 +0100
@@ -0,0 +1,45 @@
+Description:
+fstatat() function: Return information about a file at a directory.
+
+Files:
+lib/fstatat.c
+lib/at-func.c
+lib/openat.h
+lib/openat-priv.h
+m4/fstatat.m4
+
+Depends-on:
+dirent
+dosname
+errno
+extensions
+fchdir
+fcntl-h
+fstat
+lstat
+openat
+openat-die
+save-cwd
+stdbool
+sys_stat
+unistd
+
+configure.ac:
+gl_FUNC_FSTATAT
+if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
+  AC_LIBOBJ([fstatat])
+fi
+AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
+gl_MODULE_INDICATOR([fstatat]) dnl for lib/openat.h
+gl_SYS_STAT_MODULE_INDICATOR([fstatat])
+
+Makefile.am:
+
+Include:
+<sys/stat.h>
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering, Eric Blake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/fstatat-tests	Thu Nov 03 12:03:53 2011 +0100
@@ -0,0 +1,19 @@
+Files:
+tests/test-fstatat.c
+tests/test-lstat.h
+tests/test-stat.h
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+getcwd-lgpl
+ignore-value
+progname
+symlink
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fstatat
+check_PROGRAMS += test-fstatat
+test_fstatat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/getcwd	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/getcwd	Thu Nov 03 12:03:53 2011 +0100
@@ -17,6 +17,7 @@
 memmove         [test $REPLACE_GETCWD = 1]
 openat          [test $REPLACE_GETCWD = 1]
 fstat           [test $REPLACE_GETCWD = 1]
+fstatat         [test $REPLACE_GETCWD = 1]
 opendir         [test $REPLACE_GETCWD = 1]
 closedir        [test $REPLACE_GETCWD = 1]
 stdbool         [test $REPLACE_GETCWD = 1]
--- a/modules/linkat	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/linkat	Thu Nov 03 12:03:53 2011 +0100
@@ -17,6 +17,7 @@
 fcntl-h          [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 fstat            [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+fstatat          [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 getcwd-lgpl      [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 openat           [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 link             [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
--- a/modules/mkfifoat-tests	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/mkfifoat-tests	Thu Nov 03 12:03:53 2011 +0100
@@ -5,6 +5,7 @@
 tests/macros.h
 
 Depends-on:
+fstatat
 ignore-value
 symlink
 unlinkat
--- a/modules/openat	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/openat	Thu Nov 03 12:03:53 2011 +0100
@@ -3,7 +3,6 @@
 
 Files:
 lib/at-func.c
-lib/fstatat.c
 lib/mkdirat.c
 lib/openat.c
 lib/openat.h
@@ -23,7 +22,6 @@
 gettext-h
 intprops
 largefile
-lstat
 mkdir           [test $HAVE_MKDIRAT = 0]
 open
 openat-die
@@ -35,9 +33,6 @@
 configure.ac:
 gl_FUNC_OPENAT
 AC_LIBOBJ([openat-proc])
-if test $ac_cv_func_fstatat = no || test $REPLACE_FSTATAT = 1; then
-  AC_LIBOBJ([fstatat])
-fi
 if test $HAVE_MKDIRAT = 0; then
   AC_LIBOBJ([mkdirat])
 fi
--- a/modules/openat-tests	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/openat-tests	Thu Nov 03 12:03:53 2011 +0100
@@ -1,15 +1,11 @@
 Files:
-tests/test-lstat.h
 tests/test-mkdir.h
-tests/test-stat.h
-tests/test-fstatat.c
 tests/test-mkdirat.c
 tests/test-openat.c
 tests/signature.h
 tests/macros.h
 
 Depends-on:
-getcwd-lgpl
 ignore-value
 progname
 symlink
@@ -18,9 +14,8 @@
 
 Makefile.am:
 TESTS += \
-  test-fstatat test-mkdirat test-openat
+  test-mkdirat test-openat
 check_PROGRAMS += \
-  test-fstatat test-mkdirat test-openat
-test_fstatat_LDADD = $(LDADD) @LIBINTL@
+  test-mkdirat test-openat
 test_mkdirat_LDADD = $(LDADD) @LIBINTL@
 test_openat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/utimensat	Wed Nov 02 22:34:51 2011 +0100
+++ b/modules/utimensat	Thu Nov 03 12:03:53 2011 +0100
@@ -8,7 +8,7 @@
 Depends-on:
 sys_stat
 extensions
-openat          [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]
+fstatat         [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]
 utimens         [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]
 
 configure.ac: