summaryrefslogtreecommitdiff
path: root/lib/sys_types.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-05-14 14:20:01 +0200
committerBruno Haible <bruno@clisp.org>2017-05-14 17:38:24 +0200
commit8123b614e616eaa951d842f10730ba7b914f75b3 (patch)
tree73e656f9915d2cf1a033e90641ef136d9420f273 /lib/sys_types.in.h
parentd75a6cfc4125de5b0ed14ca7d08e93ca98d5b16c (diff)
downloadgnulib-8123b614e616eaa951d842f10730ba7b914f75b3.tar.gz
windows-stat-inodes: New module.
* m4/windows-stat-inodes.m4: New file. * m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set WINDOWS_STAT_INODES. * modules/sys_types (Makefile.am): Substitute WINDOWS_STAT_INODES. * lib/sys_types.in.h [WINDOWS_STAT_INODES]: Override dev_t and ino_t. (_GL_WINDOWS_STAT_INODES): New macro. * lib/stat-w32.c: Set _WIN32_WINNT. Include <string.h>, verify.h. (GetFileInformationByHandleExFunc): New variable. (initialize): Initialize it. (_gl_fstat_by_handle) [_GL_WINDOWS_STAT_INODES]: Initialize st_dev and st_ino appropriately. * lib/stat.c (rpl_stat): Use the directory entry based approach only as a fallback, because it does not provide st_dev and st_ino values. * modules/fstat (Depends-on): Add 'verify'. * modules/windows-stat-inodes: New file. * doc/windows-stat-inodes.texi: New file. * doc/gnulib.texi: Include it. * doc/posix-headers/sys_stat.texi: Mention the new module.
Diffstat (limited to 'lib/sys_types.in.h')
-rw-r--r--lib/sys_types.in.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index c5fea83a01..fd11fdc098 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__) \