+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'.
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.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fstatat.html}
-Gnulib module: openat
+Gnulib module: fstatat
Portability problems fixed by Gnulib:
@itemize
#endif
+#if GNULIB_FSTATAT
+
static inline int
statat (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,
--- /dev/null
+# 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
+])
-# 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.
GNULIB_OPENAT=1
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
- GNULIB_FSTATAT=1
GNULIB_MKDIRAT=1
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
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
+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
+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@
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]
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]
tests/macros.h
Depends-on:
+fstatat
ignore-value
symlink
unlinkat
Files:
lib/at-func.c
-lib/fstatat.c
lib/mkdirat.c
lib/openat.c
lib/openat.h
gettext-h
intprops
largefile
-lstat
mkdir [test $HAVE_MKDIRAT = 0]
open
openat-die
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
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
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@
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: