diff options
author | Ron Yorston <rmy@pobox.com> | 2012-09-19 14:59:27 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-09-19 14:59:27 +0100 |
commit | 01366408c9df773897bdd669cd4371d099f483bb (patch) | |
tree | c1d13925de12079f0d1d6fda5e8d5b8ae902ee2a | |
parent | 5ed71a92bd9c23b8bffb5e3529a611a83d98cf5f (diff) | |
download | busybox-w32-01366408c9df773897bdd669cd4371d099f483bb.tar.gz busybox-w32-01366408c9df773897bdd669cd4371d099f483bb.tar.bz2 busybox-w32-01366408c9df773897bdd669cd4371d099f483bb.zip |
mingw.h: fixes for MinGW-w64
-rw-r--r-- | include/mingw.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/include/mingw.h b/include/mingw.h index fdcd7f709..b39fcae3d 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -1,17 +1,5 @@ | |||
1 | #include <sys/utime.h> | 1 | #include <sys/utime.h> |
2 | 2 | ||
3 | /* | ||
4 | * MS Windows has broken versions of snprintf/vsnprintf that return -1 if | ||
5 | * the string is too large for the buffer and don't null terminate the | ||
6 | * string if it fills the buffer. However, if we're using a sufficiently | ||
7 | * modern version of MinGW and have an appropriate source code qualifier | ||
8 | * (such as _GNU_SOURCE) MinGW will use its own standards-compliant | ||
9 | * implementation. Check for this. | ||
10 | */ | ||
11 | #if !defined(__USE_MINGW_ANSI_STDIO) | ||
12 | #error "Must use MinGW stdio for snprintf/vsnprintf" | ||
13 | #endif | ||
14 | |||
15 | #define NOIMPL(name,...) static inline int name(__VA_ARGS__) { errno = ENOSYS; return -1; } | 3 | #define NOIMPL(name,...) static inline int name(__VA_ARGS__) { errno = ENOSYS; return -1; } |
16 | #define IMPL(name,ret,retval,...) static inline ret name(__VA_ARGS__) { return retval; } | 4 | #define IMPL(name,ret,retval,...) static inline ret name(__VA_ARGS__) { return retval; } |
17 | 5 | ||
@@ -142,6 +130,8 @@ int mingw_rename(const char*, const char*); | |||
142 | 130 | ||
143 | FILE *mingw_popen(const char *cmd, const char *mode); | 131 | FILE *mingw_popen(const char *cmd, const char *mode); |
144 | int mingw_pclose(FILE *fd); | 132 | int mingw_pclose(FILE *fd); |
133 | #undef popen | ||
134 | #undef pclose | ||
145 | #define popen mingw_popen | 135 | #define popen mingw_popen |
146 | #define pclose mingw_pclose | 136 | #define pclose mingw_pclose |
147 | 137 | ||
@@ -268,10 +258,13 @@ int mingw_fstat(int fd, struct stat *buf); | |||
268 | /* | 258 | /* |
269 | * sys/time.h | 259 | * sys/time.h |
270 | */ | 260 | */ |
261 | #ifndef _TIMESPEC_DEFINED | ||
262 | #define _TIMESPEC_DEFINED | ||
271 | struct timespec { | 263 | struct timespec { |
272 | time_t tv_sec; | 264 | time_t tv_sec; |
273 | long int tv_nsec; | 265 | long int tv_nsec; |
274 | }; | 266 | }; |
267 | #endif | ||
275 | struct itimerval { | 268 | struct itimerval { |
276 | struct timeval it_value, it_interval; | 269 | struct timeval it_value, it_interval; |
277 | }; | 270 | }; |