changeset 16021:ab92e00caa02

New module 'fchmodat', split off from module 'openat'. * lib/openat.h (chmodat, lchmodat): Enable only if GNULIB_FCHMODAT is defined. * m4/fchmodat.m4: New file, extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FCHMODAT. Don't test for fchmodat, lchmod. Don't set HAVE_FCHMODAT. * modules/fchmodat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fchmodat.c. (configure.ac): Remove AC_LIBOBJ of fchmodat. * modules/fchmodat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fchmodat.c. (Makefile.am): Remove rules for test-fchmodat. * doc/posix-functions/fchmodat.texi: Mention module 'fchmodat' instead of module 'openat'. * NEWS: Mention the change.
author Bruno Haible <bruno@clisp.org>
date Wed, 02 Nov 2011 10:07:20 +0100
parents af314a807a78
children 08b63c40d129
files ChangeLog NEWS doc/posix-functions/fchmodat.texi lib/openat.h m4/fchmodat.m4 m4/openat.m4 modules/fchmodat modules/fchmodat-tests modules/openat modules/openat-tests
diffstat 10 files changed, 103 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 02 09:15:34 2011 +0100
+++ b/ChangeLog	Wed Nov 02 10:07:20 2011 +0100
@@ -1,3 +1,21 @@
+2011-11-02  Bruno Haible  <bruno@clisp.org>
+
+	New module 'fchmodat', split off from module 'openat'.
+	* lib/openat.h (chmodat, lchmodat): Enable only if GNULIB_FCHMODAT is
+	defined.
+	* m4/fchmodat.m4: New file, extracted from m4/openat.m4.
+	* m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FCHMODAT. Don't test
+	for fchmodat, lchmod. Don't set HAVE_FCHMODAT.
+	* modules/fchmodat: New file, extracted from modules/openat.
+	* modules/openat (Files): Remove lib/fchmodat.c.
+	(configure.ac): Remove AC_LIBOBJ of fchmodat.
+	* modules/fchmodat-tests: New file, extracted from modules/openat-tests.
+	* modules/openat-tests (Files): Remove tests/test-fchmodat.c.
+	(Makefile.am): Remove rules for test-fchmodat.
+	* doc/posix-functions/fchmodat.texi: Mention module 'fchmodat' instead
+	of module 'openat'.
+	* NEWS: Mention the change.
+
 2011-11-02  Jim Meyering  <meyering@redhat.com>
 
 	putenv: indent #definition of "environ" to placate cppi
--- a/NEWS	Wed Nov 02 09:15:34 2011 +0100
+++ b/NEWS	Wed Nov 02 10:07:20 2011 +0100
@@ -12,6 +12,10 @@
 
 Date        Modules         Changes
 
+2011-11-01  openat          This module no longer provides the fchmodat()
+                            function. If you need this function, you now need
+                            to request the 'fchmodat' module.
+
 2011-11-01  alignof         This module no longer provides the alignof() macro.
                             Use either alignof_slot() or alignof_type() instead.
 
--- a/doc/posix-functions/fchmodat.texi	Wed Nov 02 09:15:34 2011 +0100
+++ b/doc/posix-functions/fchmodat.texi	Wed Nov 02 10:07:20 2011 +0100
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html}
 
-Gnulib module: openat
+Gnulib module: fchmodat
 
 Portability problems fixed by Gnulib:
 @itemize
--- a/lib/openat.h	Wed Nov 02 09:15:34 2011 +0100
+++ b/lib/openat.h	Wed Nov 02 10:07:20 2011 +0100
@@ -64,6 +64,8 @@
 
 #endif
 
+#if GNULIB_FCHMODAT
+
 static inline int
 chmodat (int fd, char const *file, mode_t mode)
 {
@@ -76,6 +78,8 @@
   return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
 }
 
+#endif
+
 static inline int
 statat (int fd, char const *name, struct stat *st)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/fchmodat.m4	Wed Nov 02 10:07:20 2011 +0100
@@ -0,0 +1,17 @@
+# fchmodat.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_FCHMODAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([fchmodat lchmod])
+  if test $ac_cv_func_fchmodat != yes; then
+    HAVE_FCHMODAT=0
+  fi
+])
--- a/m4/openat.m4	Wed Nov 02 09:15:34 2011 +0100
+++ b/m4/openat.m4	Wed Nov 02 10:07:20 2011 +0100
@@ -1,4 +1,4 @@
-# serial 38
+# serial 39
 # 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_FCHMODAT=1
   GNULIB_FSTATAT=1
   GNULIB_MKDIRAT=1
 
@@ -22,7 +21,7 @@
   GNULIB_UNLINKAT=1
 
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([fchmodat lchmod mkdirat openat unlinkat])
+  AC_CHECK_FUNCS_ONCE([mkdirat openat unlinkat])
   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
@@ -42,9 +41,6 @@
     HAVE_UNLINKAT=0 # No known system with unlinkat but not openat
     gl_PREREQ_OPENAT;;
   esac
-  if test $ac_cv_func_fchmodat != yes; then
-    HAVE_FCHMODAT=0
-  fi
   if test $ac_cv_func_mkdirat != yes; then
     HAVE_MKDIRAT=0
   fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/fchmodat	Wed Nov 02 10:07:20 2011 +0100
@@ -0,0 +1,42 @@
+Description:
+fchmodat() function: Change access permissions of a file at a directory.
+
+Files:
+lib/fchmodat.c
+lib/at-func.c
+lib/openat.h
+lib/openat-priv.h
+m4/fchmodat.m4
+
+Depends-on:
+dirent
+dosname
+errno
+extensions
+fchdir
+fcntl-h
+openat
+save-cwd
+stdbool
+sys_stat
+unistd
+
+configure.ac:
+gl_FUNC_FCHMODAT
+if test $HAVE_FCHMODAT = 0; then
+  AC_LIBOBJ([fchmodat])
+fi
+AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
+gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
+gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
+
+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/fchmodat-tests	Wed Nov 02 10:07:20 2011 +0100
@@ -0,0 +1,13 @@
+Files:
+tests/test-fchmodat.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fchmodat
+check_PROGRAMS += test-fchmodat
+test_fchmodat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/openat	Wed Nov 02 09:15:34 2011 +0100
+++ b/modules/openat	Wed Nov 02 10:07:20 2011 +0100
@@ -3,7 +3,6 @@
 
 Files:
 lib/at-func.c
-lib/fchmodat.c
 lib/fstatat.c
 lib/mkdirat.c
 lib/openat.c
@@ -39,9 +38,6 @@
 configure.ac:
 gl_FUNC_OPENAT
 AC_LIBOBJ([openat-proc])
-if test $HAVE_FCHMODAT = 0; then
-  AC_LIBOBJ([fchmodat])
-fi
 if test $ac_cv_func_fstatat = no || test $REPLACE_FSTATAT = 1; then
   AC_LIBOBJ([fstatat])
 fi
--- a/modules/openat-tests	Wed Nov 02 09:15:34 2011 +0100
+++ b/modules/openat-tests	Wed Nov 02 10:07:20 2011 +0100
@@ -8,7 +8,6 @@
 tests/test-mkdirat.c
 tests/test-openat.c
 tests/test-unlinkat.c
-tests/test-fchmodat.c
 tests/signature.h
 tests/macros.h
 
@@ -23,10 +22,9 @@
 
 Makefile.am:
 TESTS += \
-  test-fchmodat test-fstatat test-mkdirat test-openat test-unlinkat
+  test-fstatat test-mkdirat test-openat test-unlinkat
 check_PROGRAMS += \
-  test-fchmodat test-fstatat test-mkdirat test-openat test-unlinkat
-test_fchmodat_LDADD = $(LDADD) @LIBINTL@
+  test-fstatat test-mkdirat test-openat test-unlinkat
 test_fstatat_LDADD = $(LDADD) @LIBINTL@
 test_mkdirat_LDADD = $(LDADD) @LIBINTL@
 test_openat_LDADD = $(LDADD) @LIBINTL@