bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

split off module fchmodat from module openat


From: Bruno Haible
Subject: split off module fchmodat from module openat
Date: Tue, 1 Nov 2011 19:08:01 +0100
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi Jim,

The next split-off from module 'openat' is 'fchmodat'. Here's the proposed
patch. Tested on a number of platforms.


2011-11-01  Bruno Haible  <address@hidden>

        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.

================================ m4/fchmodat.m4 ================================
# 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
])
=============================== modules/fchmodat ===============================
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
============================ modules/fchmodat-tests ============================
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@
================================================================================
--- NEWS.orig   Tue Nov  1 19:04:42 2011
+++ NEWS        Tue Nov  1 16:19:30 2011
@@ -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.
 
--- doc/posix-functions/fchmodat.texi.orig      Tue Nov  1 19:04:42 2011
+++ doc/posix-functions/fchmodat.texi   Tue Nov  1 16:19:01 2011
@@ -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
--- lib/openat.h.orig   Tue Nov  1 19:04:42 2011
+++ lib/openat.h        Tue Nov  1 16:20:02 2011
@@ -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)
 {
--- m4/openat.m4.orig   Tue Nov  1 19:04:42 2011
+++ m4/openat.m4        Tue Nov  1 16:22:37 2011
@@ -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
--- modules/openat.orig Tue Nov  1 19:04:42 2011
+++ modules/openat      Tue Nov  1 16:35:10 2011
@@ -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
--- modules/openat-tests.orig   Tue Nov  1 19:04:42 2011
+++ modules/openat-tests        Tue Nov  1 19:04:37 2011
@@ -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@

-- 
In memoriam Stefano Peluffo 
<http://www.marxists.org/history/international/comintern/sections/italy/1944/partisans.htm>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]