summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-05-14 12:39:26 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-05-14 12:40:03 -0700
commit10037e4be2358597125a05db93f6fee551131d83 (patch)
tree530267b3b43f51075373af50bab6e994ce8f0764 /lib
parent792ffa022380e05d49437e47823cfdf82337a253 (diff)
downloademacs-10037e4be2358597125a05db93f6fee551131d83.tar.gz
Merge from gnulib
This incorporates: 2017-05-14 same-inode: Adapt for windows-stat-inodes 2017-05-14 windows-stat-inodes: New module 2017-05-14 stat-time: Adapt for windows-stat-timespec * lib/gnulib.mk.in: Regenerate. * lib/stat-time.h, lib/sys_types.in.h, m4/sys_types_h.m4: Copy from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk.in2
-rw-r--r--lib/stat-time.h4
-rw-r--r--lib/sys_types.in.h42
3 files changed, 48 insertions, 0 deletions
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index d4afafbecc9..6d85dc59585 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -838,6 +838,7 @@ WERROR_CFLAGS = @WERROR_CFLAGS@
WIDGET_OBJ = @WIDGET_OBJ@
WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
+WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@
WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@
WINDOW_SYSTEM_OBJ = @WINDOW_SYSTEM_OBJ@
WINDRES = @WINDRES@
@@ -2693,6 +2694,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
+ -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
< $(srcdir)/sys_types.in.h; \
} > $@-t && \
mv $@-t $@
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 88dcc7f3e0d..9e45e855655 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -170,8 +170,12 @@ get_stat_birthtime (struct stat const *st)
/* Native Windows platforms (but not Cygwin) put the "file creation
time" in st_ctime (!). See
<https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */
+# if _GL_WINDOWS_STAT_TIMESPEC
+ t = st->st_ctim;
+# else
t.tv_sec = st->st_ctime;
t.tv_nsec = 0;
+# endif
#else
/* Birth time is not supported. */
t.tv_sec = -1;
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 30ebfbdd294..3cea44884e3 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -42,6 +42,48 @@
# define _GL_WINDOWS_64_BIT_OFF_T 1
#endif
+/* Override dev_t and ino_t if distinguishable inodes support is requested
+ on native Windows. */
+#if @WINDOWS_STAT_INODES@
+
+# if @WINDOWS_STAT_INODES@ == 2
+/* Experimental, not useful in Windows 10. */
+
+/* Define dev_t to a 64-bit type. */
+# if !defined GNULIB_defined_dev_t
+typedef unsigned long long int rpl_dev_t;
+# undef dev_t
+# define dev_t rpl_dev_t
+# define GNULIB_defined_dev_t 1
+# endif
+
+/* Define ino_t to a 128-bit type. */
+# if !defined GNULIB_defined_ino_t
+/* MSVC does not have a 128-bit integer type.
+ GCC has a 128-bit integer type __int128, but only on 64-bit targets. */
+typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t;
+# undef ino_t
+# define ino_t rpl_ino_t
+# define GNULIB_defined_ino_t 1
+# endif
+
+# else /* @WINDOWS_STAT_INODES@ == 1 */
+
+/* Define ino_t to a 64-bit type. */
+# if !defined GNULIB_defined_ino_t
+typedef unsigned long long int rpl_ino_t;
+# undef ino_t
+# define ino_t rpl_ino_t
+# define GNULIB_defined_ino_t 1
+# endif
+
+# endif
+
+/* Indicator, for gnulib internal purposes. */
+# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@
+
+#endif
+
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \