diff options
| author | Paul Eggert | 2017-05-14 01:29:05 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-05-14 01:29:29 -0700 |
| commit | 4132bd74e9816ca913f862835cc062e092ab8b79 (patch) | |
| tree | 7861e23ef6007320ca0417a147656cf9774473b7 /lib | |
| parent | 9a5e864de731e113badbe300b1e4174f103547fa (diff) | |
| download | emacs-4132bd74e9816ca913f862835cc062e092ab8b79.tar.gz emacs-4132bd74e9816ca913f862835cc062e092ab8b79.zip | |
Merge from gnulib
This incorporates:
2017-05-13 largefile: Simplify
2017-05-13 largefile: Improve and document
2017-05-13 truncate: New module
2017-05-13 windows-stat-timespec: New module
2017-05-13 windows-stat-override: New module
2017-05-11 getopt-posix: port to mingw
2017-05-11 gettimeofday: Increase precision on mingw
2017-05-10 time: Fix missing initialization of HAVE_TIMEZONE_T
2017-05-10 Implement a way to opt out from MSVC support
2017-05-09 tzset: Expand comment about TZ problem on native Windows
* build-aux/config.guess, lib/dup2.c, lib/fcntl.c, lib/fsync.c:
* lib/getdtablesize.c, lib/getopt.c, lib/gettimeofday.c:
* lib/mktime.c, lib/stat-time.h, lib/sys_stat.in.h, lib/unistd.in.h:
* lib/utimens.c, m4/gettimeofday.m4, m4/largefile.m4:
* m4/sys_stat_h.m4, m4/sys_time_h.m4, m4/time_h.m4, m4/time_rz.m4:
* m4/unistd_h.m4: Copy from gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dup2.c | 44 | ||||
| -rw-r--r-- | lib/fcntl.c | 6 | ||||
| -rw-r--r-- | lib/fsync.c | 6 | ||||
| -rw-r--r-- | lib/getdtablesize.c | 11 | ||||
| -rw-r--r-- | lib/getopt.c | 3 | ||||
| -rw-r--r-- | lib/gettimeofday.c | 71 | ||||
| -rw-r--r-- | lib/gnulib.mk.in | 10 | ||||
| -rw-r--r-- | lib/mktime.c | 25 | ||||
| -rw-r--r-- | lib/stat-time.h | 4 | ||||
| -rw-r--r-- | lib/sys_stat.in.h | 178 | ||||
| -rw-r--r-- | lib/unistd.in.h | 30 | ||||
| -rw-r--r-- | lib/utimens.c | 6 |
12 files changed, 290 insertions, 104 deletions
diff --git a/lib/dup2.c b/lib/dup2.c index c0c7cadf4a8..002dc8c76cb 100644 --- a/lib/dup2.c +++ b/lib/dup2.c | |||
| @@ -35,10 +35,39 @@ | |||
| 35 | # define WIN32_LEAN_AND_MEAN | 35 | # define WIN32_LEAN_AND_MEAN |
| 36 | # include <windows.h> | 36 | # include <windows.h> |
| 37 | 37 | ||
| 38 | # include "msvc-inval.h" | 38 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
| 39 | # include "msvc-inval.h" | ||
| 40 | # endif | ||
| 39 | 41 | ||
| 40 | /* Get _get_osfhandle. */ | 42 | /* Get _get_osfhandle. */ |
| 41 | # include "msvc-nothrow.h" | 43 | # if GNULIB_MSVC_NOTHROW |
| 44 | # include "msvc-nothrow.h" | ||
| 45 | # else | ||
| 46 | # include <io.h> | ||
| 47 | # endif | ||
| 48 | |||
| 49 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
| 50 | static int | ||
| 51 | dup2_nothrow (int fd, int desired_fd) | ||
| 52 | { | ||
| 53 | int result; | ||
| 54 | |||
| 55 | TRY_MSVC_INVAL | ||
| 56 | { | ||
| 57 | result = dup2 (fd, desired_fd); | ||
| 58 | } | ||
| 59 | CATCH_MSVC_INVAL | ||
| 60 | { | ||
| 61 | errno = EBADF; | ||
| 62 | result = -1; | ||
| 63 | } | ||
| 64 | DONE_MSVC_INVAL; | ||
| 65 | |||
| 66 | return result; | ||
| 67 | } | ||
| 68 | # else | ||
| 69 | # define dup2_nothrow dup2 | ||
| 70 | # endif | ||
| 42 | 71 | ||
| 43 | static int | 72 | static int |
| 44 | ms_windows_dup2 (int fd, int desired_fd) | 73 | ms_windows_dup2 (int fd, int desired_fd) |
| @@ -66,16 +95,7 @@ ms_windows_dup2 (int fd, int desired_fd) | |||
| 66 | return -1; | 95 | return -1; |
| 67 | } | 96 | } |
| 68 | 97 | ||
| 69 | TRY_MSVC_INVAL | 98 | result = dup2_nothrow (fd, desired_fd); |
| 70 | { | ||
| 71 | result = dup2 (fd, desired_fd); | ||
| 72 | } | ||
| 73 | CATCH_MSVC_INVAL | ||
| 74 | { | ||
| 75 | errno = EBADF; | ||
| 76 | result = -1; | ||
| 77 | } | ||
| 78 | DONE_MSVC_INVAL; | ||
| 79 | 99 | ||
| 80 | if (result == 0) | 100 | if (result == 0) |
| 81 | result = desired_fd; | 101 | result = desired_fd; |
diff --git a/lib/fcntl.c b/lib/fcntl.c index afe15468ffa..d4dd144e05d 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c | |||
| @@ -38,7 +38,11 @@ | |||
| 38 | # include <windows.h> | 38 | # include <windows.h> |
| 39 | 39 | ||
| 40 | /* Get _get_osfhandle. */ | 40 | /* Get _get_osfhandle. */ |
| 41 | # include "msvc-nothrow.h" | 41 | # if GNULIB_MSVC_NOTHROW |
| 42 | # include "msvc-nothrow.h" | ||
| 43 | # else | ||
| 44 | # include <io.h> | ||
| 45 | # endif | ||
| 42 | 46 | ||
| 43 | /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ | 47 | /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ |
| 44 | # define OPEN_MAX_MAX 0x10000 | 48 | # define OPEN_MAX_MAX 0x10000 |
diff --git a/lib/fsync.c b/lib/fsync.c index 46dd59b3d2c..5a4945ef2bf 100644 --- a/lib/fsync.c +++ b/lib/fsync.c | |||
| @@ -34,7 +34,11 @@ | |||
| 34 | # include <errno.h> | 34 | # include <errno.h> |
| 35 | 35 | ||
| 36 | /* Get _get_osfhandle. */ | 36 | /* Get _get_osfhandle. */ |
| 37 | # include "msvc-nothrow.h" | 37 | # if GNULIB_MSVC_NOTHROW |
| 38 | # include "msvc-nothrow.h" | ||
| 39 | # else | ||
| 40 | # include <io.h> | ||
| 41 | # endif | ||
| 38 | 42 | ||
| 39 | int | 43 | int |
| 40 | fsync (int fd) | 44 | fsync (int fd) |
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index 7fabb51e2c6..c356cf4aa97 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c | |||
| @@ -24,7 +24,9 @@ | |||
| 24 | 24 | ||
| 25 | # include <stdio.h> | 25 | # include <stdio.h> |
| 26 | 26 | ||
| 27 | # include "msvc-inval.h" | 27 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
| 28 | # include "msvc-inval.h" | ||
| 29 | # endif | ||
| 28 | 30 | ||
| 29 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER | 31 | # if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
| 30 | static int | 32 | static int |
| @@ -44,7 +46,8 @@ _setmaxstdio_nothrow (int newmax) | |||
| 44 | 46 | ||
| 45 | return result; | 47 | return result; |
| 46 | } | 48 | } |
| 47 | # define _setmaxstdio _setmaxstdio_nothrow | 49 | # else |
| 50 | # define _setmaxstdio_nothrow _setmaxstdio | ||
| 48 | # endif | 51 | # endif |
| 49 | 52 | ||
| 50 | /* Cache for the previous getdtablesize () result. Safe to cache because | 53 | /* Cache for the previous getdtablesize () result. Safe to cache because |
| @@ -76,9 +79,9 @@ getdtablesize (void) | |||
| 76 | freed when we call _setmaxstdio with the original value. */ | 79 | freed when we call _setmaxstdio with the original value. */ |
| 77 | int orig_max_stdio = _getmaxstdio (); | 80 | int orig_max_stdio = _getmaxstdio (); |
| 78 | unsigned int bound; | 81 | unsigned int bound; |
| 79 | for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2) | 82 | for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2) |
| 80 | ; | 83 | ; |
| 81 | _setmaxstdio (orig_max_stdio); | 84 | _setmaxstdio_nothrow (orig_max_stdio); |
| 82 | dtablesize = bound; | 85 | dtablesize = bound; |
| 83 | } | 86 | } |
| 84 | return dtablesize; | 87 | return dtablesize; |
diff --git a/lib/getopt.c b/lib/getopt.c index a7db39b68df..9a2867db277 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -45,7 +45,8 @@ | |||
| 45 | # define _(msgid) gettext (msgid) | 45 | # define _(msgid) gettext (msgid) |
| 46 | /* When used standalone, flockfile and funlockfile might not be | 46 | /* When used standalone, flockfile and funlockfile might not be |
| 47 | available. */ | 47 | available. */ |
| 48 | # ifndef _POSIX_THREAD_SAFE_FUNCTIONS | 48 | # if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ |
| 49 | || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) | ||
| 49 | # define flockfile(fp) /* nop */ | 50 | # define flockfile(fp) /* nop */ |
| 50 | # define funlockfile(fp) /* nop */ | 51 | # define funlockfile(fp) /* nop */ |
| 51 | # endif | 52 | # endif |
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 1039f77d182..8ae7622af31 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c | |||
| @@ -64,42 +64,20 @@ int | |||
| 64 | gettimeofday (struct timeval *restrict tv, void *restrict tz) | 64 | gettimeofday (struct timeval *restrict tv, void *restrict tz) |
| 65 | { | 65 | { |
| 66 | #undef gettimeofday | 66 | #undef gettimeofday |
| 67 | #if HAVE_GETTIMEOFDAY | 67 | #ifdef WINDOWS_NATIVE |
| 68 | # if GETTIMEOFDAY_CLOBBERS_LOCALTIME | ||
| 69 | /* Save and restore the contents of the buffer used for localtime's | ||
| 70 | result around the call to gettimeofday. */ | ||
| 71 | struct tm save = *localtime_buffer_addr; | ||
| 72 | # endif | ||
| 73 | |||
| 74 | # if defined timeval /* 'struct timeval' overridden by gnulib? */ | ||
| 75 | # undef timeval | ||
| 76 | struct timeval otv; | ||
| 77 | int result = gettimeofday (&otv, (struct timezone *) tz); | ||
| 78 | if (result == 0) | ||
| 79 | { | ||
| 80 | tv->tv_sec = otv.tv_sec; | ||
| 81 | tv->tv_usec = otv.tv_usec; | ||
| 82 | } | ||
| 83 | # else | ||
| 84 | int result = gettimeofday (tv, (struct timezone *) tz); | ||
| 85 | # endif | ||
| 86 | |||
| 87 | # if GETTIMEOFDAY_CLOBBERS_LOCALTIME | ||
| 88 | *localtime_buffer_addr = save; | ||
| 89 | # endif | ||
| 90 | |||
| 91 | return result; | ||
| 92 | |||
| 93 | #else | ||
| 94 | |||
| 95 | # ifdef WINDOWS_NATIVE | ||
| 96 | 68 | ||
| 97 | /* On native Windows, there are two ways to get the current time: | 69 | /* On native Windows, there are two ways to get the current time: |
| 98 | GetSystemTimeAsFileTime | 70 | GetSystemTimeAsFileTime |
| 99 | <https://msdn.microsoft.com/en-us/library/ms724397.aspx> | 71 | <https://msdn.microsoft.com/en-us/library/ms724397.aspx> |
| 100 | or | 72 | or |
| 101 | GetSystemTimePreciseAsFileTime | 73 | GetSystemTimePreciseAsFileTime |
| 102 | <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */ | 74 | <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. |
| 75 | GetSystemTimeAsFileTime produces values that jump by increments of | ||
| 76 | 15.627 milliseconds (!) on average. | ||
| 77 | Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2 | ||
| 78 | microseconds. | ||
| 79 | More discussion on this topic: | ||
| 80 | <http://www.windowstimestamp.com/description>. */ | ||
| 103 | FILETIME current_time; | 81 | FILETIME current_time; |
| 104 | 82 | ||
| 105 | if (!initialized) | 83 | if (!initialized) |
| @@ -122,6 +100,36 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) | |||
| 122 | tv->tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000; | 100 | tv->tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000; |
| 123 | tv->tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000; | 101 | tv->tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000; |
| 124 | 102 | ||
| 103 | return 0; | ||
| 104 | |||
| 105 | #else | ||
| 106 | |||
| 107 | # if HAVE_GETTIMEOFDAY | ||
| 108 | # if GETTIMEOFDAY_CLOBBERS_LOCALTIME | ||
| 109 | /* Save and restore the contents of the buffer used for localtime's | ||
| 110 | result around the call to gettimeofday. */ | ||
| 111 | struct tm save = *localtime_buffer_addr; | ||
| 112 | # endif | ||
| 113 | |||
| 114 | # if defined timeval /* 'struct timeval' overridden by gnulib? */ | ||
| 115 | # undef timeval | ||
| 116 | struct timeval otv; | ||
| 117 | int result = gettimeofday (&otv, (struct timezone *) tz); | ||
| 118 | if (result == 0) | ||
| 119 | { | ||
| 120 | tv->tv_sec = otv.tv_sec; | ||
| 121 | tv->tv_usec = otv.tv_usec; | ||
| 122 | } | ||
| 123 | # else | ||
| 124 | int result = gettimeofday (tv, (struct timezone *) tz); | ||
| 125 | # endif | ||
| 126 | |||
| 127 | # if GETTIMEOFDAY_CLOBBERS_LOCALTIME | ||
| 128 | *localtime_buffer_addr = save; | ||
| 129 | # endif | ||
| 130 | |||
| 131 | return result; | ||
| 132 | |||
| 125 | # else | 133 | # else |
| 126 | 134 | ||
| 127 | # if !defined OK_TO_USE_1S_CLOCK | 135 | # if !defined OK_TO_USE_1S_CLOCK |
| @@ -131,9 +139,8 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) | |||
| 131 | tv->tv_sec = time (NULL); | 139 | tv->tv_sec = time (NULL); |
| 132 | tv->tv_usec = 0; | 140 | tv->tv_usec = 0; |
| 133 | 141 | ||
| 134 | # endif | ||
| 135 | |||
| 136 | return 0; | 142 | return 0; |
| 137 | 143 | ||
| 144 | # endif | ||
| 138 | #endif | 145 | #endif |
| 139 | } | 146 | } |
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 51ae1891244..d4afafbecc9 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -225,6 +225,7 @@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ | |||
| 225 | GNULIB_OPEN = @GNULIB_OPEN@ | 225 | GNULIB_OPEN = @GNULIB_OPEN@ |
| 226 | GNULIB_OPENAT = @GNULIB_OPENAT@ | 226 | GNULIB_OPENAT = @GNULIB_OPENAT@ |
| 227 | GNULIB_OPENDIR = @GNULIB_OPENDIR@ | 227 | GNULIB_OPENDIR = @GNULIB_OPENDIR@ |
| 228 | GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 228 | GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ | 229 | GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ |
| 229 | GNULIB_PCLOSE = @GNULIB_PCLOSE@ | 230 | GNULIB_PCLOSE = @GNULIB_PCLOSE@ |
| 230 | GNULIB_PERROR = @GNULIB_PERROR@ | 231 | GNULIB_PERROR = @GNULIB_PERROR@ |
| @@ -306,6 +307,7 @@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ | |||
| 306 | GNULIB_TIME_R = @GNULIB_TIME_R@ | 307 | GNULIB_TIME_R = @GNULIB_TIME_R@ |
| 307 | GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ | 308 | GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ |
| 308 | GNULIB_TMPFILE = @GNULIB_TMPFILE@ | 309 | GNULIB_TMPFILE = @GNULIB_TMPFILE@ |
| 310 | GNULIB_TRUNCATE = @GNULIB_TRUNCATE@ | ||
| 309 | GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ | 311 | GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ |
| 310 | GNULIB_TZSET = @GNULIB_TZSET@ | 312 | GNULIB_TZSET = @GNULIB_TZSET@ |
| 311 | GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ | 313 | GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ |
| @@ -504,6 +506,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ | |||
| 504 | HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ | 506 | HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ |
| 505 | HAVE_TIMEGM = @HAVE_TIMEGM@ | 507 | HAVE_TIMEGM = @HAVE_TIMEGM@ |
| 506 | HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ | 508 | HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ |
| 509 | HAVE_TRUNCATE = @HAVE_TRUNCATE@ | ||
| 507 | HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ | 510 | HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ |
| 508 | HAVE_TZSET = @HAVE_TZSET@ | 511 | HAVE_TZSET = @HAVE_TZSET@ |
| 509 | HAVE_UNISTD_H = @HAVE_UNISTD_H@ | 512 | HAVE_UNISTD_H = @HAVE_UNISTD_H@ |
| @@ -781,6 +784,7 @@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ | |||
| 781 | REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ | 784 | REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ |
| 782 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ | 785 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ |
| 783 | REPLACE_TMPFILE = @REPLACE_TMPFILE@ | 786 | REPLACE_TMPFILE = @REPLACE_TMPFILE@ |
| 787 | REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ | ||
| 784 | REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ | 788 | REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ |
| 785 | REPLACE_TZSET = @REPLACE_TZSET@ | 789 | REPLACE_TZSET = @REPLACE_TZSET@ |
| 786 | REPLACE_UNLINK = @REPLACE_UNLINK@ | 790 | REPLACE_UNLINK = @REPLACE_UNLINK@ |
| @@ -834,6 +838,7 @@ WERROR_CFLAGS = @WERROR_CFLAGS@ | |||
| 834 | WIDGET_OBJ = @WIDGET_OBJ@ | 838 | WIDGET_OBJ = @WIDGET_OBJ@ |
| 835 | WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ | 839 | WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ |
| 836 | WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ | 840 | WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ |
| 841 | WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ | ||
| 837 | WINDOW_SYSTEM_OBJ = @WINDOW_SYSTEM_OBJ@ | 842 | WINDOW_SYSTEM_OBJ = @WINDOW_SYSTEM_OBJ@ |
| 838 | WINDRES = @WINDRES@ | 843 | WINDRES = @WINDRES@ |
| 839 | WINT_T_SUFFIX = @WINT_T_SUFFIX@ | 844 | WINT_T_SUFFIX = @WINT_T_SUFFIX@ |
| @@ -2586,6 +2591,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU | |||
| 2586 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 2591 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 2587 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | 2592 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ |
| 2588 | -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ | 2593 | -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ |
| 2594 | -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ | ||
| 2589 | -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ | 2595 | -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ |
| 2590 | -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ | 2596 | -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ |
| 2591 | -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ | 2597 | -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ |
| @@ -2599,6 +2605,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU | |||
| 2599 | -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ | 2605 | -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ |
| 2600 | -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ | 2606 | -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ |
| 2601 | -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ | 2607 | -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ |
| 2608 | -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ | ||
| 2602 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ | 2609 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ |
| 2603 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ | 2610 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ |
| 2604 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ | 2611 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ |
| @@ -2893,6 +2900,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 2893 | -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ | 2900 | -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ |
| 2894 | -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ | 2901 | -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ |
| 2895 | -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ | 2902 | -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ |
| 2903 | -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ | ||
| 2896 | -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ | 2904 | -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ |
| 2897 | -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ | 2905 | -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ |
| 2898 | -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ | 2906 | -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ |
| @@ -2930,6 +2938,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 2930 | -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ | 2938 | -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ |
| 2931 | -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ | 2939 | -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ |
| 2932 | -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ | 2940 | -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ |
| 2941 | -e 's|@''HAVE_TRUNCATE''@|$(HAVE_TRUNCATE)|g' \ | ||
| 2933 | -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ | 2942 | -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ |
| 2934 | -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ | 2943 | -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ |
| 2935 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ | 2944 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ |
| @@ -2971,6 +2980,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 2971 | -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ | 2980 | -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ |
| 2972 | -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ | 2981 | -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ |
| 2973 | -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ | 2982 | -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ |
| 2983 | -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ | ||
| 2974 | -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ | 2984 | -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ |
| 2975 | -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ | 2985 | -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ |
| 2976 | -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ | 2986 | -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ |
diff --git a/lib/mktime.c b/lib/mktime.c index 06d5916e910..058ab65c03e 100644 --- a/lib/mktime.c +++ b/lib/mktime.c | |||
| @@ -491,9 +491,28 @@ time_t | |||
| 491 | mktime (struct tm *tp) | 491 | mktime (struct tm *tp) |
| 492 | { | 492 | { |
| 493 | # if NEED_MKTIME_WINDOWS | 493 | # if NEED_MKTIME_WINDOWS |
| 494 | /* If the environment variable TZ has been set by Cygwin, neutralize it. | 494 | /* Rectify the value of the environment variable TZ. |
| 495 | The Microsoft CRT interprets TZ differently than Cygwin and produces | 495 | There are four possible kinds of such values: |
| 496 | incorrect results if TZ has the syntax used by Cygwin. */ | 496 | - Traditional US time zone names, e.g. "PST8PDT". Syntax: see |
| 497 | <https://msdn.microsoft.com/en-us/library/90s5c885.aspx> | ||
| 498 | - Time zone names based on geography, that contain one or more | ||
| 499 | slashes, e.g. "Europe/Moscow". | ||
| 500 | - Time zone names based on geography, without slashes, e.g. | ||
| 501 | "Singapore". | ||
| 502 | - Time zone names that contain explicit DST rules. Syntax: see | ||
| 503 | <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03> | ||
| 504 | The Microsoft CRT understands only the first kind. It produces incorrect | ||
| 505 | results if the value of TZ is of the other kinds. | ||
| 506 | But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value | ||
| 507 | of the second kind for most geographies, or of the first kind in a few | ||
| 508 | other geographies. If it is of the second kind, neutralize it. For the | ||
| 509 | Microsoft CRT, an absent or empty TZ means the time zone that the user | ||
| 510 | has set in the Windows Control Panel. | ||
| 511 | If the value of TZ is of the third or fourth kind -- Cygwin programs | ||
| 512 | understand these syntaxes as well --, it does not matter whether we | ||
| 513 | neutralize it or not, since these values occur only when a Cygwin user | ||
| 514 | has set TZ explicitly; this case is 1. rare and 2. under the user's | ||
| 515 | responsibility. */ | ||
| 497 | const char *tz = getenv ("TZ"); | 516 | const char *tz = getenv ("TZ"); |
| 498 | if (tz != NULL && strchr (tz, '/') != NULL) | 517 | if (tz != NULL && strchr (tz, '/') != NULL) |
| 499 | _putenv ("TZ="); | 518 | _putenv ("TZ="); |
diff --git a/lib/stat-time.h b/lib/stat-time.h index 154d62a01f5..88dcc7f3e0d 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h | |||
| @@ -43,8 +43,8 @@ extern "C" { | |||
| 43 | time respectively. | 43 | time respectively. |
| 44 | 44 | ||
| 45 | These macros are private to stat-time.h. */ | 45 | These macros are private to stat-time.h. */ |
| 46 | #if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC | 46 | #if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC |
| 47 | # ifdef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC | 47 | # if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC |
| 48 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) | 48 | # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) |
| 49 | # else | 49 | # else |
| 50 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) | 50 | # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) |
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index d5ca343437f..1831740900b 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Provide a more complete sys/stat header file. | 1 | /* Provide a more complete sys/stat.h header file. |
| 2 | Copyright (C) 2005-2017 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2017 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
| @@ -72,6 +72,75 @@ | |||
| 72 | # define stat _stati64 | 72 | # define stat _stati64 |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | /* Optionally, override 'struct stat' on native Windows. */ | ||
| 76 | #if @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 77 | |||
| 78 | # undef stat | ||
| 79 | # if @GNULIB_STAT@ | ||
| 80 | # define stat rpl_stat | ||
| 81 | # else | ||
| 82 | /* Provoke a clear link error if stat() is used as a function and | ||
| 83 | module 'stat' is not in use. */ | ||
| 84 | # define stat stat_used_without_requesting_gnulib_module_stat | ||
| 85 | # endif | ||
| 86 | |||
| 87 | # if !GNULIB_defined_struct_stat | ||
| 88 | struct stat | ||
| 89 | { | ||
| 90 | dev_t st_dev; | ||
| 91 | ino_t st_ino; | ||
| 92 | mode_t st_mode; | ||
| 93 | nlink_t st_nlink; | ||
| 94 | # if 0 | ||
| 95 | uid_t st_uid; | ||
| 96 | # else /* uid_t is not defined by default on native Windows. */ | ||
| 97 | short st_uid; | ||
| 98 | # endif | ||
| 99 | # if 0 | ||
| 100 | gid_t st_gid; | ||
| 101 | # else /* gid_t is not defined by default on native Windows. */ | ||
| 102 | short st_gid; | ||
| 103 | # endif | ||
| 104 | dev_t st_rdev; | ||
| 105 | off_t st_size; | ||
| 106 | # if 0 | ||
| 107 | blksize_t st_blksize; | ||
| 108 | blkcnt_t st_blocks; | ||
| 109 | # endif | ||
| 110 | |||
| 111 | # if @WINDOWS_STAT_TIMESPEC@ | ||
| 112 | struct timespec st_atim; | ||
| 113 | struct timespec st_mtim; | ||
| 114 | struct timespec st_ctim; | ||
| 115 | # else | ||
| 116 | time_t st_atime; | ||
| 117 | time_t st_mtime; | ||
| 118 | time_t st_ctime; | ||
| 119 | # endif | ||
| 120 | }; | ||
| 121 | # if @WINDOWS_STAT_TIMESPEC@ | ||
| 122 | # define st_atime st_atim.tv_sec | ||
| 123 | # define st_mtime st_mtim.tv_sec | ||
| 124 | # define st_ctime st_ctim.tv_sec | ||
| 125 | /* Indicator, for gnulib internal purposes. */ | ||
| 126 | # define _GL_WINDOWS_STAT_TIMESPEC 1 | ||
| 127 | # endif | ||
| 128 | # define GNULIB_defined_struct_stat 1 | ||
| 129 | # endif | ||
| 130 | |||
| 131 | /* Other possible values of st_mode. */ | ||
| 132 | # if 0 | ||
| 133 | # define _S_IFBLK 0x6000 | ||
| 134 | # endif | ||
| 135 | # if 0 | ||
| 136 | # define _S_IFLNK 0xA000 | ||
| 137 | # endif | ||
| 138 | # if 0 | ||
| 139 | # define _S_IFSOCK 0xC000 | ||
| 140 | # endif | ||
| 141 | |||
| 142 | #endif | ||
| 143 | |||
| 75 | #ifndef S_IFIFO | 144 | #ifndef S_IFIFO |
| 76 | # ifdef _S_IFIFO | 145 | # ifdef _S_IFIFO |
| 77 | # define S_IFIFO _S_IFIFO | 146 | # define S_IFIFO _S_IFIFO |
| @@ -345,6 +414,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); | |||
| 345 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); | 414 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); |
| 346 | # endif | 415 | # endif |
| 347 | _GL_CXXALIASWARN (fstat); | 416 | _GL_CXXALIASWARN (fstat); |
| 417 | #elif @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 418 | # undef fstat | ||
| 419 | # define fstat fstat_used_without_requesting_gnulib_module_fstat | ||
| 348 | #elif @WINDOWS_64_BIT_ST_SIZE@ | 420 | #elif @WINDOWS_64_BIT_ST_SIZE@ |
| 349 | /* Above, we define stat to _stati64. */ | 421 | /* Above, we define stat to _stati64. */ |
| 350 | # define fstat _fstati64 | 422 | # define fstat _fstati64 |
| @@ -378,6 +450,9 @@ _GL_CXXALIAS_SYS (fstatat, int, | |||
| 378 | (int fd, char const *name, struct stat *st, int flags)); | 450 | (int fd, char const *name, struct stat *st, int flags)); |
| 379 | # endif | 451 | # endif |
| 380 | _GL_CXXALIASWARN (fstatat); | 452 | _GL_CXXALIASWARN (fstatat); |
| 453 | #elif @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 454 | # undef fstatat | ||
| 455 | # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat | ||
| 381 | #elif defined GNULIB_POSIXCHECK | 456 | #elif defined GNULIB_POSIXCHECK |
| 382 | # undef fstatat | 457 | # undef fstatat |
| 383 | # if HAVE_RAW_DECL_FSTATAT | 458 | # if HAVE_RAW_DECL_FSTATAT |
| @@ -476,6 +551,9 @@ _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); | |||
| 476 | # if @HAVE_LSTAT@ | 551 | # if @HAVE_LSTAT@ |
| 477 | _GL_CXXALIASWARN (lstat); | 552 | _GL_CXXALIASWARN (lstat); |
| 478 | # endif | 553 | # endif |
| 554 | #elif @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 555 | # undef lstat | ||
| 556 | # define lstat lstat_used_without_requesting_gnulib_module_lstat | ||
| 479 | #elif defined GNULIB_POSIXCHECK | 557 | #elif defined GNULIB_POSIXCHECK |
| 480 | # undef lstat | 558 | # undef lstat |
| 481 | # if HAVE_RAW_DECL_LSTAT | 559 | # if HAVE_RAW_DECL_LSTAT |
| @@ -625,63 +703,69 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " | |||
| 625 | 703 | ||
| 626 | #if @GNULIB_STAT@ | 704 | #if @GNULIB_STAT@ |
| 627 | # if @REPLACE_STAT@ | 705 | # if @REPLACE_STAT@ |
| 628 | /* We can't use the object-like #define stat rpl_stat, because of | 706 | # if !@GNULIB_OVERRIDES_STRUCT_STAT@ |
| 629 | struct stat. This means that rpl_stat will not be used if the user | 707 | /* We can't use the object-like #define stat rpl_stat, because of |
| 630 | does (stat)(a,b). Oh well. */ | 708 | struct stat. This means that rpl_stat will not be used if the user |
| 631 | # if defined _AIX && defined stat && defined _LARGE_FILES | 709 | does (stat)(a,b). Oh well. */ |
| 632 | /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, | 710 | # if defined _AIX && defined stat && defined _LARGE_FILES |
| 633 | so we have to replace stat64() instead of stat(). */ | 711 | /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, |
| 634 | # undef stat64 | 712 | so we have to replace stat64() instead of stat(). */ |
| 635 | # define stat64(name, st) rpl_stat (name, st) | 713 | # undef stat64 |
| 636 | # elif @WINDOWS_64_BIT_ST_SIZE@ | 714 | # define stat64(name, st) rpl_stat (name, st) |
| 637 | /* Above, we define stat to _stati64. */ | 715 | # elif @WINDOWS_64_BIT_ST_SIZE@ |
| 638 | # if defined __MINGW32__ && defined _stati64 | 716 | /* Above, we define stat to _stati64. */ |
| 639 | # ifndef _USE_32BIT_TIME_T | 717 | # if defined __MINGW32__ && defined _stati64 |
| 640 | /* The system headers define _stati64 to _stat64. */ | 718 | # ifndef _USE_32BIT_TIME_T |
| 641 | # undef _stat64 | 719 | /* The system headers define _stati64 to _stat64. */ |
| 642 | # define _stat64(name, st) rpl_stat (name, st) | 720 | # undef _stat64 |
| 721 | # define _stat64(name, st) rpl_stat (name, st) | ||
| 722 | # endif | ||
| 723 | # elif defined _MSC_VER && defined _stati64 | ||
| 724 | # ifdef _USE_32BIT_TIME_T | ||
| 725 | /* The system headers define _stati64 to _stat32i64. */ | ||
| 726 | # undef _stat32i64 | ||
| 727 | # define _stat32i64(name, st) rpl_stat (name, st) | ||
| 728 | # else | ||
| 729 | /* The system headers define _stati64 to _stat64. */ | ||
| 730 | # undef _stat64 | ||
| 731 | # define _stat64(name, st) rpl_stat (name, st) | ||
| 732 | # endif | ||
| 733 | # else | ||
| 734 | # undef _stati64 | ||
| 735 | # define _stati64(name, st) rpl_stat (name, st) | ||
| 643 | # endif | 736 | # endif |
| 644 | # elif defined _MSC_VER && defined _stati64 | 737 | # elif defined __MINGW32__ && defined stat |
| 645 | # ifdef _USE_32BIT_TIME_T | 738 | # ifdef _USE_32BIT_TIME_T |
| 646 | /* The system headers define _stati64 to _stat32i64. */ | 739 | /* The system headers define stat to _stat32i64. */ |
| 647 | # undef _stat32i64 | 740 | # undef _stat32i64 |
| 648 | # define _stat32i64(name, st) rpl_stat (name, st) | 741 | # define _stat32i64(name, st) rpl_stat (name, st) |
| 649 | # else | 742 | # else |
| 650 | /* The system headers define _stati64 to _stat64. */ | 743 | /* The system headers define stat to _stat64. */ |
| 651 | # undef _stat64 | 744 | # undef _stat64 |
| 652 | # define _stat64(name, st) rpl_stat (name, st) | 745 | # define _stat64(name, st) rpl_stat (name, st) |
| 653 | # endif | 746 | # endif |
| 654 | # else | 747 | # elif defined _MSC_VER && defined stat |
| 655 | # undef _stati64 | 748 | # ifdef _USE_32BIT_TIME_T |
| 656 | # define _stati64(name, st) rpl_stat (name, st) | 749 | /* The system headers define stat to _stat32. */ |
| 657 | # endif | 750 | # undef _stat32 |
| 658 | # elif defined __MINGW32__ && defined stat | 751 | # define _stat32(name, st) rpl_stat (name, st) |
| 659 | # ifdef _USE_32BIT_TIME_T | 752 | # else |
| 660 | /* The system headers define stat to _stat32i64. */ | 753 | /* The system headers define stat to _stat64i32. */ |
| 661 | # undef _stat32i64 | 754 | # undef _stat64i32 |
| 662 | # define _stat32i64(name, st) rpl_stat (name, st) | 755 | # define _stat64i32(name, st) rpl_stat (name, st) |
| 663 | # else | 756 | # endif |
| 664 | /* The system headers define stat to _stat64. */ | 757 | # else /* !(_AIX || __MINGW32__ || _MSC_VER) */ |
| 665 | # undef _stat64 | 758 | # undef stat |
| 666 | # define _stat64(name, st) rpl_stat (name, st) | 759 | # define stat(name, st) rpl_stat (name, st) |
| 667 | # endif | 760 | # endif /* !_LARGE_FILES */ |
| 668 | # elif defined _MSC_VER && defined stat | 761 | # endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ |
| 669 | # ifdef _USE_32BIT_TIME_T | ||
| 670 | /* The system headers define stat to _stat32. */ | ||
| 671 | # undef _stat32 | ||
| 672 | # define _stat32(name, st) rpl_stat (name, st) | ||
| 673 | # else | ||
| 674 | /* The system headers define stat to _stat64i32. */ | ||
| 675 | # undef _stat64i32 | ||
| 676 | # define _stat64i32(name, st) rpl_stat (name, st) | ||
| 677 | # endif | ||
| 678 | # else /* !(_AIX ||__MINGW32__ || _MSC_VER) */ | ||
| 679 | # undef stat | ||
| 680 | # define stat(name, st) rpl_stat (name, st) | ||
| 681 | # endif /* !_LARGE_FILES */ | ||
| 682 | _GL_EXTERN_C int stat (const char *name, struct stat *buf) | 762 | _GL_EXTERN_C int stat (const char *name, struct stat *buf) |
| 683 | _GL_ARG_NONNULL ((1, 2)); | 763 | _GL_ARG_NONNULL ((1, 2)); |
| 684 | # endif | 764 | # endif |
| 765 | #elif @GNULIB_OVERRIDES_STRUCT_STAT@ | ||
| 766 | /* see above: | ||
| 767 | #define stat stat_used_without_requesting_gnulib_module_stat | ||
| 768 | */ | ||
| 685 | #elif defined GNULIB_POSIXCHECK | 769 | #elif defined GNULIB_POSIXCHECK |
| 686 | # undef stat | 770 | # undef stat |
| 687 | # if HAVE_RAW_DECL_STAT | 771 | # if HAVE_RAW_DECL_STAT |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index cb9321e502d..f366caffa55 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -1457,6 +1457,36 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " | |||
| 1457 | #endif | 1457 | #endif |
| 1458 | 1458 | ||
| 1459 | 1459 | ||
| 1460 | #if @GNULIB_TRUNCATE@ | ||
| 1461 | /* Change the size of the file designated by FILENAME to become equal to LENGTH. | ||
| 1462 | Return 0 if successful, otherwise -1 and errno set. | ||
| 1463 | See the POSIX:2008 specification | ||
| 1464 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ | ||
| 1465 | # if @REPLACE_TRUNCATE@ | ||
| 1466 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1467 | # undef truncate | ||
| 1468 | # define truncate rpl_truncate | ||
| 1469 | # endif | ||
| 1470 | _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) | ||
| 1471 | _GL_ARG_NONNULL ((1))); | ||
| 1472 | _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); | ||
| 1473 | # else | ||
| 1474 | # if !@HAVE_TRUNCATE@ | ||
| 1475 | _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) | ||
| 1476 | _GL_ARG_NONNULL ((1))); | ||
| 1477 | # endif | ||
| 1478 | _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); | ||
| 1479 | # endif | ||
| 1480 | _GL_CXXALIASWARN (truncate); | ||
| 1481 | #elif defined GNULIB_POSIXCHECK | ||
| 1482 | # undef truncate | ||
| 1483 | # if HAVE_RAW_DECL_TRUNCATE | ||
| 1484 | _GL_WARN_ON_USE (truncate, "truncate is unportable - " | ||
| 1485 | "use gnulib module truncate for portability"); | ||
| 1486 | # endif | ||
| 1487 | #endif | ||
| 1488 | |||
| 1489 | |||
| 1460 | #if @GNULIB_TTYNAME_R@ | 1490 | #if @GNULIB_TTYNAME_R@ |
| 1461 | /* Store at most BUFLEN characters of the pathname of the terminal FD is | 1491 | /* Store at most BUFLEN characters of the pathname of the terminal FD is |
| 1462 | open on in BUF. Return 0 on success, otherwise an error number. */ | 1492 | open on in BUF. Return 0 on success, otherwise an error number. */ |
diff --git a/lib/utimens.c b/lib/utimens.c index b4bfa8e3222..ff4eab073c1 100644 --- a/lib/utimens.c +++ b/lib/utimens.c | |||
| @@ -44,7 +44,11 @@ | |||
| 44 | # define USE_SETFILETIME | 44 | # define USE_SETFILETIME |
| 45 | # define WIN32_LEAN_AND_MEAN | 45 | # define WIN32_LEAN_AND_MEAN |
| 46 | # include <windows.h> | 46 | # include <windows.h> |
| 47 | # include "msvc-nothrow.h" | 47 | # if GNULIB_MSVC_NOTHROW |
| 48 | # include "msvc-nothrow.h" | ||
| 49 | # else | ||
| 50 | # include <io.h> | ||
| 51 | # endif | ||
| 48 | #endif | 52 | #endif |
| 49 | 53 | ||
| 50 | /* Avoid recursion with rpl_futimens or rpl_utimensat. */ | 54 | /* Avoid recursion with rpl_futimens or rpl_utimensat. */ |