summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rw-r--r--NEWS4
-rw-r--r--doc/posix-functions/fstatat.texi2
-rw-r--r--lib/openat.h4
-rw-r--r--m4/fstatat.m451
-rw-r--r--m4/openat.m448
-rw-r--r--modules/fstatat45
-rw-r--r--modules/fstatat-tests19
-rw-r--r--modules/getcwd1
-rw-r--r--modules/linkat1
-rw-r--r--modules/mkfifoat-tests1
-rw-r--r--modules/openat5
-rw-r--r--modules/openat-tests9
-rw-r--r--modules/utimensat2
14 files changed, 157 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c1bde0e58..ecdeedf676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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'.
diff --git a/NEWS b/NEWS
index 045de1f1d6..5cc3a6aaeb 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ User visible incompatible changes
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.
diff --git a/doc/posix-functions/fstatat.texi b/doc/posix-functions/fstatat.texi
index 4beb6058bd..fcb2b3052c 100644
--- a/doc/posix-functions/fstatat.texi
+++ b/doc/posix-functions/fstatat.texi
@@ -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
diff --git a/lib/openat.h b/lib/openat.h
index fcae664aee..03a513d16b 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -80,6 +80,8 @@ lchmodat (int fd, char const *file, mode_t mode)
#endif
+#if GNULIB_FSTATAT
+
static inline int
statat (int fd, char const *name, struct stat *st)
{
@@ -92,6 +94,8 @@ lstatat (int fd, char const *name, struct stat *st)
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,
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
new file mode 100644
index 0000000000..58025372e0
--- /dev/null
+++ b/m4/fstatat.m4
@@ -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
+])
diff --git a/m4/openat.m4 b/m4/openat.m4
index 86e3144771..86a8b629e1 100644
--- a/m4/openat.m4
+++ b/m4/openat.m4
@@ -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 @@ AC_DEFUN([gl_FUNC_OPENAT],
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 @@ AC_DEFUN([gl_FUNC_OPENAT],
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])
diff --git a/modules/fstatat b/modules/fstatat
new file mode 100644
index 0000000000..77e7a9b931
--- /dev/null
+++ b/modules/fstatat
@@ -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
diff --git a/modules/fstatat-tests b/modules/fstatat-tests
new file mode 100644
index 0000000000..f33ff11f0d
--- /dev/null
+++ b/modules/fstatat-tests
@@ -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@
diff --git a/modules/getcwd b/modules/getcwd
index aa3fe69a86..3bd2ba783e 100644
--- a/modules/getcwd
+++ b/modules/getcwd
@@ -17,6 +17,7 @@ d-ino [test $REPLACE_GETCWD = 1]
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]
diff --git a/modules/linkat b/modules/linkat
index 77f08d01b4..3902e35f9e 100644
--- a/modules/linkat
+++ b/modules/linkat
@@ -17,6 +17,7 @@ errno [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
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]
diff --git a/modules/mkfifoat-tests b/modules/mkfifoat-tests
index b50bbf5767..4c0e23fff2 100644
--- a/modules/mkfifoat-tests
+++ b/modules/mkfifoat-tests
@@ -5,6 +5,7 @@ tests/signature.h
tests/macros.h
Depends-on:
+fstatat
ignore-value
symlink
unlinkat
diff --git a/modules/openat b/modules/openat
index 167fa92147..503c12135e 100644
--- a/modules/openat
+++ b/modules/openat
@@ -3,7 +3,6 @@ Open a file at a directory.
Files:
lib/at-func.c
-lib/fstatat.c
lib/mkdirat.c
lib/openat.c
lib/openat.h
@@ -23,7 +22,6 @@ fstat
gettext-h
intprops
largefile
-lstat
mkdir [test $HAVE_MKDIRAT = 0]
open
openat-die
@@ -35,9 +33,6 @@ unistd
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
diff --git a/modules/openat-tests b/modules/openat-tests
index bdefca3f83..cb38d2e114 100644
--- a/modules/openat-tests
+++ b/modules/openat-tests
@@ -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 @@ configure.ac:
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@
diff --git a/modules/utimensat b/modules/utimensat
index a70ca8cbb2..9f3ec7efcf 100644
--- a/modules/utimensat
+++ b/modules/utimensat
@@ -8,7 +8,7 @@ m4/utimensat.m4
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: