diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-06 07:50:21 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-06 07:50:21 +0100 |
commit | b9c3f062b605df1a34a198cfff4ae850484a110d (patch) | |
tree | a6dc5253940c7e7ca7df6f3bc25908604b4f80a2 /compat/mingw.h | |
parent | Merge branch 'md/exclude-promisor-objects-fix' (diff) | |
parent | mingw: implement nanosecond-precision file times (diff) | |
download | git-b9c3f062b605df1a34a198cfff4ae850484a110d.tar.xz git-b9c3f062b605df1a34a198cfff4ae850484a110d.zip |
Merge branch 'js/mingw-ns-filetime'
Windows port learned to use nano-second resolution file timestamps.
* js/mingw-ns-filetime:
mingw: implement nanosecond-precision file times
mingw: replace MSVCRT's fstat() with a Win32-based implementation
mingw: factor out code to set stat() data
Diffstat (limited to 'compat/mingw.h')
-rw-r--r-- | compat/mingw.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/compat/mingw.h b/compat/mingw.h index f31dcff2be..4c14e30835 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -327,18 +327,41 @@ static inline int getrlimit(int resource, struct rlimit *rlp) } /* - * Use mingw specific stat()/lstat()/fstat() implementations on Windows. + * Use mingw specific stat()/lstat()/fstat() implementations on Windows, + * including our own struct stat with 64 bit st_size and nanosecond-precision + * file times. */ #ifndef __MINGW64_VERSION_MAJOR #define off_t off64_t #define lseek _lseeki64 +struct timespec { + time_t tv_sec; + long tv_nsec; +}; #endif -/* use struct stat with 64 bit st_size */ +struct mingw_stat { + _dev_t st_dev; + _ino_t st_ino; + _mode_t st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + off64_t st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +}; + +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec + #ifdef stat #undef stat #endif -#define stat _stati64 +#define stat mingw_stat int mingw_lstat(const char *file_name, struct stat *buf); int mingw_stat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); @@ -351,13 +374,6 @@ int mingw_fstat(int fd, struct stat *buf); #endif #define lstat mingw_lstat -#ifndef _stati64 -# define _stati64(x,y) mingw_stat(x,y) -#elif defined (_USE_32BIT_TIME_T) -# define _stat32i64(x,y) mingw_stat(x,y) -#else -# define _stat64(x,y) mingw_stat(x,y) -#endif int mingw_utime(const char *file_name, const struct utimbuf *times); #define utime mingw_utime |