aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-08-16 09:33:29 +0100
committerRon Yorston <rmy@pobox.com>2019-08-16 09:33:29 +0100
commitae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51 (patch)
tree91cec33a60c2fc7fc90bd9bbd587b65eaf0e55d2 /include
parent01950ee1937fdb5172673afad5b65bdb48fe89de (diff)
downloadbusybox-w32-ae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51.tar.gz
busybox-w32-ae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51.tar.bz2
busybox-w32-ae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51.zip
win32: allow nanosecond precision in file times
Modern Linux kernels use struct timespec to represent file times, thus allowing nanosecond precision. Update the WIN32 emulation of struct stat and stat(2) to do the same.
Diffstat (limited to 'include')
-rw-r--r--include/mingw.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 07f9857e9..15ead7799 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -242,6 +242,19 @@ NOIMPL(mingw_sendto,SOCKET s UNUSED_PARAM, const char *buf UNUSED_PARAM, int len
242#define select mingw_select 242#define select mingw_select
243 243
244/* 244/*
245 * sys/time.h
246 */
247#ifndef _TIMESPEC_DEFINED
248#define _TIMESPEC_DEFINED
249struct timespec {
250 time_t tv_sec;
251 long int tv_nsec;
252};
253#endif
254
255int nanosleep(const struct timespec *req, struct timespec *rem);
256
257/*
245 * sys/stat.h 258 * sys/stat.h
246 */ 259 */
247#define S_ISUID 04000 260#define S_ISUID 04000
@@ -300,12 +313,15 @@ struct mingw_stat {
300 gid_t st_gid; 313 gid_t st_gid;
301 dev_t st_rdev; 314 dev_t st_rdev;
302 off_t st_size; 315 off_t st_size;
303 time_t st_atime; 316 struct timespec st_atim;
304 time_t st_mtime; 317 struct timespec st_mtim;
305 time_t st_ctime; 318 struct timespec st_ctim;
306 blksize_t st_blksize; 319 blksize_t st_blksize;
307 blkcnt_t st_blocks; 320 blkcnt_t st_blocks;
308}; 321};
322#define st_atime st_atim.tv_sec
323#define st_mtime st_mtim.tv_sec
324#define st_ctime st_ctim.tv_sec
309 325
310int mingw_lstat(const char *file_name, struct mingw_stat *buf); 326int mingw_lstat(const char *file_name, struct mingw_stat *buf);
311int mingw_stat(const char *file_name, struct mingw_stat *buf); 327int mingw_stat(const char *file_name, struct mingw_stat *buf);
@@ -325,19 +341,6 @@ int mingw_fstat(int fd, struct mingw_stat *buf);
325#define major(x) 0 341#define major(x) 0
326 342
327/* 343/*
328 * sys/time.h
329 */
330#ifndef _TIMESPEC_DEFINED
331#define _TIMESPEC_DEFINED
332struct timespec {
333 time_t tv_sec;
334 long int tv_nsec;
335};
336#endif
337
338int nanosleep(const struct timespec *req, struct timespec *rem);
339
340/*
341 * sys/wait.h 344 * sys/wait.h
342 */ 345 */
343#define WNOHANG 1 346#define WNOHANG 1