aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tar/bsdtar_platform.h
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-05-02 18:10:35 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-05-02 18:10:35 +0000
commit732db834d2a0b46b92b17878a14014471c321d77 (patch)
treed0bd1a5814ead7afa9f770430f68c0ad359a543c /usr.bin/tar/bsdtar_platform.h
parent86bfa45446204027aadbfdb4db2ad9847cae97c1 (diff)
More of Juergen Lock's patches for Linux.
(fflags support on Linux, nanosecond timestamp portability, enable 64-bit file offsets)
Notes
Notes: svn path=/head/; revision=128837
Diffstat (limited to 'usr.bin/tar/bsdtar_platform.h')
-rw-r--r--usr.bin/tar/bsdtar_platform.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/tar/bsdtar_platform.h b/usr.bin/tar/bsdtar_platform.h
index fbabedb8a120..1c5a930e3671 100644
--- a/usr.bin/tar/bsdtar_platform.h
+++ b/usr.bin/tar/bsdtar_platform.h
@@ -41,6 +41,7 @@
#include <paths.h> /* For _PATH_DEFTAPE */
#define HAVE_CHFLAGS 1
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtimespec.tv_nsec
#if __FreeBSD__ > 4
#define HAVE_GETOPT_LONG 1
@@ -70,6 +71,7 @@
/* Linux */
#ifdef LINUX
+#define _FILE_OFFSET_BITS 64 /* For a 64-bit off_t */
#include <stdint.h> /* for uintmax_t */
#define BSDTAR_FILESIZE_TYPE uintmax_t
#define BSDTAR_FILESIZE_PRINTF "%ju"
@@ -78,9 +80,15 @@
#define _GNU_SOURCE
#define _PATH_DEFTAPE "/dev/st0"
#define HAVE_GETOPT_LONG 1
-#define st_atimespec st_atim
-#define st_mtimespec st_mtim
-#define st_ctimespec st_ctim
+
+#ifdef HAVE_STRUCT_STAT_TIMESPEC
+/* Fetch the nanosecond portion of the timestamp from a struct stat pointer. */
+#define ARCHIVE_STAT_MTIME_NANOS(pstat) (pstat)->st_mtim.tv_nsec
+#else
+/* High-res timestamps aren't available, so just use stubs here. */
+#define ARCHIVE_STAT_MTIME_NANOS(pstat) 0
+#endif
+
#endif
/*