diff options
author | Ron Yorston <rmy@pobox.com> | 2014-01-30 21:03:07 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-01-30 21:03:07 +0000 |
commit | 0a2a7b55a9212d8fc708fd564407e5505b5e8363 (patch) | |
tree | 1db3e0b2a8df9f5e80648519aa9d75531333696c | |
parent | 91229e15fe0cbc76eeae6f389879a42bff443f70 (diff) | |
download | busybox-w32-0a2a7b55a9212d8fc708fd564407e5505b5e8363.tar.gz busybox-w32-0a2a7b55a9212d8fc708fd564407e5505b5e8363.tar.bz2 busybox-w32-0a2a7b55a9212d8fc708fd564407e5505b5e8363.zip |
mingw: dummy implementation of times/sysconf
-rw-r--r-- | include/mingw.h | 17 | ||||
-rw-r--r-- | shell/ash.c | 9 | ||||
-rw-r--r-- | win32/mingw.c | 19 |
3 files changed, 36 insertions, 9 deletions
diff --git a/include/mingw.h b/include/mingw.h index 9f2e192b5..ede7a72f5 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -307,10 +307,26 @@ int stime(time_t *t); | |||
307 | #define strftime mingw_strftime | 307 | #define strftime mingw_strftime |
308 | 308 | ||
309 | /* | 309 | /* |
310 | * times.h | ||
311 | */ | ||
312 | #define clock_t long | ||
313 | |||
314 | struct tms { | ||
315 | clock_t tms_utime; /* user CPU time */ | ||
316 | clock_t tms_stime; /* system CPU time */ | ||
317 | clock_t tms_cutime; /* user CPU time of children */ | ||
318 | clock_t tms_cstime; /* system CPU time of children */ | ||
319 | }; | ||
320 | |||
321 | clock_t times(struct tms *buf); | ||
322 | |||
323 | /* | ||
310 | * unistd.h | 324 | * unistd.h |
311 | */ | 325 | */ |
312 | #define PIPE_BUF 8192 | 326 | #define PIPE_BUF 8192 |
313 | 327 | ||
328 | #define _SC_CLK_TCK 2 | ||
329 | |||
314 | IMPL(alarm,unsigned int,0,unsigned int seconds UNUSED_PARAM); | 330 | IMPL(alarm,unsigned int,0,unsigned int seconds UNUSED_PARAM); |
315 | NOIMPL(chown,const char *path UNUSED_PARAM, uid_t uid UNUSED_PARAM, gid_t gid UNUSED_PARAM); | 331 | NOIMPL(chown,const char *path UNUSED_PARAM, uid_t uid UNUSED_PARAM, gid_t gid UNUSED_PARAM); |
316 | NOIMPL(chroot,const char *root UNUSED_PARAM); | 332 | NOIMPL(chroot,const char *root UNUSED_PARAM); |
@@ -349,6 +365,7 @@ NOIMPL(seteuid,uid_t gid UNUSED_PARAM); | |||
349 | unsigned int sleep(unsigned int seconds); | 365 | unsigned int sleep(unsigned int seconds); |
350 | NOIMPL(symlink,const char *oldpath UNUSED_PARAM, const char *newpath UNUSED_PARAM); | 366 | NOIMPL(symlink,const char *oldpath UNUSED_PARAM, const char *newpath UNUSED_PARAM); |
351 | static inline void sync(void) {} | 367 | static inline void sync(void) {} |
368 | long sysconf(int name); | ||
352 | NOIMPL(ttyname_r,int fd UNUSED_PARAM, char *buf UNUSED_PARAM, int sz UNUSED_PARAM); | 369 | NOIMPL(ttyname_r,int fd UNUSED_PARAM, char *buf UNUSED_PARAM, int sz UNUSED_PARAM); |
353 | int mingw_unlink(const char *pathname); | 370 | int mingw_unlink(const char *pathname); |
354 | NOIMPL(vfork,void); | 371 | NOIMPL(vfork,void); |
diff --git a/shell/ash.c b/shell/ash.c index 40660dad5..3d9af3891 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -13278,8 +13278,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
13278 | return ret & 1; | 13278 | return ret & 1; |
13279 | } | 13279 | } |
13280 | 13280 | ||
13281 | #if !ENABLE_PLATFORM_MINGW32 | ||
13282 | |||
13283 | static const unsigned char timescmd_str[] ALIGN1 = { | 13281 | static const unsigned char timescmd_str[] ALIGN1 = { |
13284 | ' ', offsetof(struct tms, tms_utime), | 13282 | ' ', offsetof(struct tms, tms_utime), |
13285 | '\n', offsetof(struct tms, tms_stime), | 13283 | '\n', offsetof(struct tms, tms_stime), |
@@ -13311,13 +13309,6 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
13311 | 13309 | ||
13312 | return 0; | 13310 | return 0; |
13313 | } | 13311 | } |
13314 | #else | ||
13315 | static int FAST_FUNC | ||
13316 | timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | ||
13317 | { | ||
13318 | return 0; | ||
13319 | } | ||
13320 | #endif | ||
13321 | 13312 | ||
13322 | #if ENABLE_SH_MATH_SUPPORT | 13313 | #if ENABLE_SH_MATH_SUPPORT |
13323 | /* | 13314 | /* |
diff --git a/win32/mingw.c b/win32/mingw.c index eb0f77a28..d5a4d6297 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -583,6 +583,25 @@ struct passwd *getpwuid(int uid UNUSED_PARAM) | |||
583 | return &p; | 583 | return &p; |
584 | } | 584 | } |
585 | 585 | ||
586 | long sysconf(int name) | ||
587 | { | ||
588 | if ( name == _SC_CLK_TCK ) { | ||
589 | return 100; | ||
590 | } | ||
591 | errno = EINVAL; | ||
592 | return -1; | ||
593 | } | ||
594 | |||
595 | clock_t times(struct tms *buf) | ||
596 | { | ||
597 | buf->tms_utime = 0; | ||
598 | buf->tms_stime = 0; | ||
599 | buf->tms_cutime = 0; | ||
600 | buf->tms_cstime = 0; | ||
601 | |||
602 | return 0; | ||
603 | } | ||
604 | |||
586 | static HANDLE timer_event; | 605 | static HANDLE timer_event; |
587 | static HANDLE timer_thread; | 606 | static HANDLE timer_thread; |
588 | static int timer_interval; | 607 | static int timer_interval; |