|
| 1 | +#ifdef __MINGW64_VERSION_MAJOR |
| 2 | +#include <stdint.h> |
| 3 | +#include <wchar.h> |
| 4 | +typedef _sigset_t sigset_t; |
| 5 | +#endif |
1 | 6 | #include <winsock2.h>
|
2 | 7 | #include <ws2tcpip.h>
|
3 | 8 |
|
| 9 | +/* MinGW-w64 reports to have flockfile, but it does not actually have it. */ |
| 10 | +#ifdef __MINGW64_VERSION_MAJOR |
| 11 | +#undef _POSIX_THREAD_SAFE_FUNCTIONS |
| 12 | +#endif |
| 13 | + |
4 | 14 | /*
|
5 | 15 | * things that are not available in header files
|
6 | 16 | */
|
7 | 17 |
|
8 |
| -typedef int pid_t; |
9 | 18 | typedef int uid_t;
|
10 | 19 | typedef int socklen_t;
|
| 20 | +#ifndef __MINGW64_VERSION_MAJOR |
| 21 | +typedef int pid_t; |
11 | 22 | #define hstrerror strerror
|
| 23 | +#endif |
12 | 24 |
|
13 | 25 | #define S_IFLNK 0120000 /* Symbolic link */
|
14 | 26 | #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
|
@@ -100,8 +112,10 @@ static inline int symlink(const char *oldpath, const char *newpath)
|
100 | 112 | { errno = ENOSYS; return -1; }
|
101 | 113 | static inline int fchmod(int fildes, mode_t mode)
|
102 | 114 | { errno = ENOSYS; return -1; }
|
| 115 | +#ifndef __MINGW64_VERSION_MAJOR |
103 | 116 | static inline pid_t fork(void)
|
104 | 117 | { errno = ENOSYS; return -1; }
|
| 118 | +#endif |
105 | 119 | static inline unsigned int alarm(unsigned int seconds)
|
106 | 120 | { return 0; }
|
107 | 121 | static inline int fsync(int fd)
|
@@ -176,8 +190,10 @@ int pipe(int filedes[2]);
|
176 | 190 | unsigned int sleep (unsigned int seconds);
|
177 | 191 | int mkstemp(char *template);
|
178 | 192 | int gettimeofday(struct timeval *tv, void *tz);
|
| 193 | +#ifndef __MINGW64_VERSION_MAJOR |
179 | 194 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
180 | 195 | struct tm *localtime_r(const time_t *timep, struct tm *result);
|
| 196 | +#endif |
181 | 197 | int getpagesize(void); /* defined in MinGW's libgcc.a */
|
182 | 198 | struct passwd *getpwuid(uid_t uid);
|
183 | 199 | int setitimer(int type, struct itimerval *in, struct itimerval *out);
|
@@ -301,8 +317,10 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
|
301 | 317 | /*
|
302 | 318 | * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
|
303 | 319 | */
|
| 320 | +#ifndef __MINGW64_VERSION_MAJOR |
304 | 321 | #define off_t off64_t
|
305 | 322 | #define lseek _lseeki64
|
| 323 | +#endif |
306 | 324 |
|
307 | 325 | /* use struct stat with 64 bit st_size */
|
308 | 326 | #ifdef stat
|
@@ -375,8 +393,12 @@ static inline char *mingw_find_last_dir_sep(const char *path)
|
375 | 393 | int mingw_offset_1st_component(const char *path);
|
376 | 394 | #define offset_1st_component mingw_offset_1st_component
|
377 | 395 | #define PATH_SEP ';'
|
| 396 | +#ifndef __MINGW64_VERSION_MAJOR |
378 | 397 | #define PRIuMAX "I64u"
|
379 | 398 | #define PRId64 "I64d"
|
| 399 | +#else |
| 400 | +#include <inttypes.h> |
| 401 | +#endif |
380 | 402 |
|
381 | 403 | void mingw_open_html(const char *path);
|
382 | 404 | #define open_html mingw_open_html
|
|
0 commit comments