+2005-09-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ Merge changes from gnulib for file system sub-second time stamps.
+ * configure.ac: Remove checks for struct stat.st_spare1, struct
+ stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct
+ stat.st_atimensec, as gnulib now does this for us.
+ Similarly for LIB_CLOCK_GETTIME.
+ * gnulib.modules: Add stat-time.
+ * lib/.cvsignore: Add stat-time.h.
+ * src/common.h: Include stat-time.h.
+ (timespec_lt): Remove. All callers changed to use timespec_cmp.
+ (get_stat_atime, get_stat_ctime, get_stat_mtime):
+ (set_stat_atime, set_stat_ctime, set_stat_mtime):
+ Remove; now defined by stat-time.h.
+
2005-09-14 Sergey Poznyakoff <gray@gnu.org.ua>
* src/incremen.c (list_dumpdir): New function. Used to dump
# paxutils modules
tar_PAXUTILS
-AC_CHECK_MEMBERS([struct stat.st_spare1, struct stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct stat.st_atimensec], , ,
- [
-#include <sys/types.h>
-#include <sys/stat.h>])
-
-# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
-# programs in the package would end up linked with that potentially-shared
-# library, inducing unnecessary run-time overhead.
-
-# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
-# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-tar_save_LIBS=$LIBS
- LIB_CLOCK_GETTIME=
- AC_SEARCH_LIBS(clock_gettime, [rt posix4])
- case "$ac_cv_search_clock_gettime" in
- -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
- esac
- AC_SUBST(LIB_CLOCK_GETTIME)
- AC_CHECK_FUNCS(clock_gettime)
-LIBS=$tar_save_LIBS
-
AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
#include <modechange.h>
#include <quote.h>
#include <safe-read.h>
+#include <stat-time.h>
#include <timespec.h>
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
/* Return true if the struct stat ST's M time is less than
newer_mtime_option. */
#define OLDER_STAT_TIME(st, m) \
- timespec_lt (get_stat_##m##time (&st), newer_mtime_option)
-
-/* Return true if A < B. */
-static inline bool
-timespec_lt (struct timespec a, struct timespec b)
-{
- return (a.tv_sec < b.tv_sec
- || (a.tv_sec == b.tv_sec && a.tv_nsec < b.tv_nsec));
-}
+ (timespec_cmp (get_stat_##m##time (&st), newer_mtime_option) < 0)
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
GLOBAL int recursion_option;
/* Module utf8.c */
bool string_ascii_p (const char *str);
bool utf8_convert (bool to_utf, char const *input, char **output);
-
-
-/* FIXME: The following should get moved into gnulib. */
-
-static inline struct timespec
-get_stat_atime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_atim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_atimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_atime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_atimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline struct timespec
-get_stat_ctime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_ctim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_ctimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_ctime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_ctimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline struct timespec
-get_stat_mtime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_mtim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_mtimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_mtime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_mtimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline void
-set_stat_atime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_atim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_atimespec = t;
-#else
- st->st_atime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_atimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}
-
-static inline void
-set_stat_ctime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_ctim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_ctimespec = t;
-#else
- st->st_ctime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_ctimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}
-
-static inline void
-set_stat_mtime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_mtim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_mtimespec = t;
-#else
- st->st_mtime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_mtimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}