diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bb_archive.h | 21 | ||||
-rw-r--r-- | include/libbb.h | 69 | ||||
-rw-r--r-- | include/mingw.h | 533 | ||||
-rw-r--r-- | include/platform.h | 41 |
4 files changed, 661 insertions, 3 deletions
diff --git a/include/bb_archive.h b/include/bb_archive.h index 9b1db5b3e..58e4c21bb 100644 --- a/include/bb_archive.h +++ b/include/bb_archive.h | |||
@@ -2,6 +2,16 @@ | |||
2 | #ifndef UNARCHIVE_H | 2 | #ifndef UNARCHIVE_H |
3 | #define UNARCHIVE_H 1 | 3 | #define UNARCHIVE_H 1 |
4 | 4 | ||
5 | #if !defined(BB_ARCHIVE_PUBLIC) && ENABLE_PLATFORM_MINGW32 | ||
6 | /* treat mingw as a non-MMU platform */ | ||
7 | #undef BB_MMU | ||
8 | #undef USE_FOR_NOMMU | ||
9 | #undef USE_FOR_MMU | ||
10 | #define BB_MMU 0 | ||
11 | #define USE_FOR_NOMMU(...) __VA_ARGS__ | ||
12 | #define USE_FOR_MMU(...) | ||
13 | #endif | ||
14 | |||
5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | 15 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
6 | 16 | ||
7 | enum { | 17 | enum { |
@@ -203,11 +213,18 @@ void seek_by_jump(int fd, off_t amount) FAST_FUNC; | |||
203 | void seek_by_read(int fd, off_t amount) FAST_FUNC; | 213 | void seek_by_read(int fd, off_t amount) FAST_FUNC; |
204 | 214 | ||
205 | const char *strip_unsafe_prefix(const char *str) FAST_FUNC; | 215 | const char *strip_unsafe_prefix(const char *str) FAST_FUNC; |
216 | #if ENABLE_PLATFORM_MINGW32 | ||
217 | #define create_or_remember_link(lp, t, ln, hl) create_or_remember_link(t, ln) | ||
218 | #endif | ||
206 | void create_or_remember_link(llist_t **link_placeholders, | 219 | void create_or_remember_link(llist_t **link_placeholders, |
207 | const char *target, | 220 | const char *target, |
208 | const char *linkname, | 221 | const char *linkname, |
209 | int hard_link) FAST_FUNC; | 222 | int hard_link) FAST_FUNC; |
223 | #if !ENABLE_PLATFORM_MINGW32 | ||
210 | void create_links_from_list(llist_t *list) FAST_FUNC; | 224 | void create_links_from_list(llist_t *list) FAST_FUNC; |
225 | #else | ||
226 | #define create_links_from_list(l) (void)0 | ||
227 | #endif | ||
211 | 228 | ||
212 | void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC; | 229 | void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC; |
213 | const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC; | 230 | const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC; |
@@ -277,7 +294,11 @@ enum { | |||
277 | BBUNPK_SEAMLESS_MAGIC = (1 << 31) * ENABLE_ZCAT * SEAMLESS_COMPRESSION, | 294 | BBUNPK_SEAMLESS_MAGIC = (1 << 31) * ENABLE_ZCAT * SEAMLESS_COMPRESSION, |
278 | }; | 295 | }; |
279 | 296 | ||
297 | #if !ENABLE_PLATFORM_MINGW32 | ||
280 | void check_errors_in_children(int signo); | 298 | void check_errors_in_children(int signo); |
299 | #else | ||
300 | #define check_errors_in_children(s) ((void)0) | ||
301 | #endif | ||
281 | #if BB_MMU | 302 | #if BB_MMU |
282 | void fork_transformer(int fd, | 303 | void fork_transformer(int fd, |
283 | int signature_skipped, | 304 | int signature_skipped, |
diff --git a/include/libbb.h b/include/libbb.h index 33766e989..9da94638b 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -139,6 +139,12 @@ | |||
139 | # include <arpa/inet.h> | 139 | # include <arpa/inet.h> |
140 | #elif defined __APPLE__ | 140 | #elif defined __APPLE__ |
141 | # include <netinet/in.h> | 141 | # include <netinet/in.h> |
142 | #elif ENABLE_PLATFORM_MINGW32 | ||
143 | # ifndef WINVER | ||
144 | # define WINVER 0x0501 | ||
145 | # endif | ||
146 | # include <winsock2.h> | ||
147 | # include <ws2tcpip.h> | ||
142 | #else | 148 | #else |
143 | # include <arpa/inet.h> | 149 | # include <arpa/inet.h> |
144 | //This breaks on bionic: | 150 | //This breaks on bionic: |
@@ -178,7 +184,9 @@ | |||
178 | 184 | ||
179 | /* Some libc's forget to declare these, do it ourself */ | 185 | /* Some libc's forget to declare these, do it ourself */ |
180 | 186 | ||
187 | #if !ENABLE_PLATFORM_MINGW32 | ||
181 | extern char **environ; | 188 | extern char **environ; |
189 | #endif | ||
182 | /* klogctl is in libc's klog.h, but we cheat and not #include that */ | 190 | /* klogctl is in libc's klog.h, but we cheat and not #include that */ |
183 | int klogctl(int type, char *b, int len); | 191 | int klogctl(int type, char *b, int len); |
184 | #ifndef PATH_MAX | 192 | #ifndef PATH_MAX |
@@ -188,6 +196,9 @@ int klogctl(int type, char *b, int len); | |||
188 | # define BUFSIZ 4096 | 196 | # define BUFSIZ 4096 |
189 | #endif | 197 | #endif |
190 | 198 | ||
199 | #if ENABLE_PLATFORM_MINGW32 | ||
200 | # include "mingw.h" | ||
201 | #endif | ||
191 | 202 | ||
192 | /* Busybox does not use threads, we can speed up stdio. */ | 203 | /* Busybox does not use threads, we can speed up stdio. */ |
193 | #ifdef HAVE_UNLOCKED_STDIO | 204 | #ifdef HAVE_UNLOCKED_STDIO |
@@ -250,6 +261,13 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | |||
250 | : ((T)1 << (sizeof(T)*8-1)) \ | 261 | : ((T)1 << (sizeof(T)*8-1)) \ |
251 | ) | 262 | ) |
252 | 263 | ||
264 | #if ENABLE_PLATFORM_MINGW32 && \ | ||
265 | (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) | ||
266 | #define LL_FMT "I64" | ||
267 | #else | ||
268 | #define LL_FMT "ll" | ||
269 | #endif | ||
270 | |||
253 | /* Large file support */ | 271 | /* Large file support */ |
254 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops | 272 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops |
255 | * (stat, lseek etc) mapped to "largefile" variants by libc. | 273 | * (stat, lseek etc) mapped to "largefile" variants by libc. |
@@ -275,7 +293,7 @@ typedef unsigned long long uoff_t; | |||
275 | # define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) | 293 | # define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) |
276 | # define BB_STRTOOFF bb_strtoull | 294 | # define BB_STRTOOFF bb_strtoull |
277 | # define STRTOOFF strtoull | 295 | # define STRTOOFF strtoull |
278 | # define OFF_FMT "ll" | 296 | # define OFF_FMT LL_FMT |
279 | # endif | 297 | # endif |
280 | #else | 298 | #else |
281 | /* CONFIG_LFS is off */ | 299 | /* CONFIG_LFS is off */ |
@@ -513,20 +531,37 @@ enum { | |||
513 | * Dance around with long long to guard against that... | 531 | * Dance around with long long to guard against that... |
514 | */ | 532 | */ |
515 | BB_FATAL_SIGS = (int)(0 | 533 | BB_FATAL_SIGS = (int)(0 |
534 | #ifdef SIGHUP | ||
516 | + (1LL << SIGHUP) | 535 | + (1LL << SIGHUP) |
536 | #endif | ||
517 | + (1LL << SIGINT) | 537 | + (1LL << SIGINT) |
518 | + (1LL << SIGTERM) | 538 | + (1LL << SIGTERM) |
519 | + (1LL << SIGPIPE) // Write to pipe with no readers | 539 | + (1LL << SIGPIPE) // Write to pipe with no readers |
540 | #ifdef SIGQUIT | ||
520 | + (1LL << SIGQUIT) // Quit from keyboard | 541 | + (1LL << SIGQUIT) // Quit from keyboard |
542 | #endif | ||
521 | + (1LL << SIGABRT) // Abort signal from abort(3) | 543 | + (1LL << SIGABRT) // Abort signal from abort(3) |
544 | #ifdef SIGALRM | ||
522 | + (1LL << SIGALRM) // Timer signal from alarm(2) | 545 | + (1LL << SIGALRM) // Timer signal from alarm(2) |
546 | #endif | ||
547 | #ifdef SIGVTALRM | ||
523 | + (1LL << SIGVTALRM) // Virtual alarm clock | 548 | + (1LL << SIGVTALRM) // Virtual alarm clock |
549 | #endif | ||
550 | #ifdef SIGXCPU | ||
524 | + (1LL << SIGXCPU) // CPU time limit exceeded | 551 | + (1LL << SIGXCPU) // CPU time limit exceeded |
552 | #endif | ||
553 | #ifdef SIGXFSZ | ||
525 | + (1LL << SIGXFSZ) // File size limit exceeded | 554 | + (1LL << SIGXFSZ) // File size limit exceeded |
555 | #endif | ||
556 | #ifdef SIGUSR1 | ||
526 | + (1LL << SIGUSR1) // Yes kids, these are also fatal! | 557 | + (1LL << SIGUSR1) // Yes kids, these are also fatal! |
558 | #endif | ||
559 | #ifdef SIGUSR1 | ||
527 | + (1LL << SIGUSR2) | 560 | + (1LL << SIGUSR2) |
561 | #endif | ||
528 | + 0), | 562 | + 0), |
529 | }; | 563 | }; |
564 | #if !ENABLE_PLATFORM_MINGW32 | ||
530 | void bb_signals(int sigs, void (*f)(int)) FAST_FUNC; | 565 | void bb_signals(int sigs, void (*f)(int)) FAST_FUNC; |
531 | /* Unlike signal() and bb_signals, sets handler with sigaction() | 566 | /* Unlike signal() and bb_signals, sets handler with sigaction() |
532 | * and in a way that while signal handler is run, no other signals | 567 | * and in a way that while signal handler is run, no other signals |
@@ -546,6 +581,10 @@ int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; | |||
546 | int sigprocmask_allsigs(int how) FAST_FUNC; | 581 | int sigprocmask_allsigs(int how) FAST_FUNC; |
547 | /* Return old set in the same set: */ | 582 | /* Return old set in the same set: */ |
548 | int sigprocmask2(int how, sigset_t *set) FAST_FUNC; | 583 | int sigprocmask2(int how, sigset_t *set) FAST_FUNC; |
584 | #else | ||
585 | #define bb_signals(s, f) | ||
586 | #define kill_myself_with_sig(s) | ||
587 | #endif | ||
549 | /* Standard handler which just records signo */ | 588 | /* Standard handler which just records signo */ |
550 | extern smallint bb_got_signal; | 589 | extern smallint bb_got_signal; |
551 | void record_signo(int signo); /* not FAST_FUNC! */ | 590 | void record_signo(int signo); /* not FAST_FUNC! */ |
@@ -625,7 +664,7 @@ char *strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; | |||
625 | int xsocket(int domain, int type, int protocol) FAST_FUNC; | 664 | int xsocket(int domain, int type, int protocol) FAST_FUNC; |
626 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC; | 665 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC; |
627 | void xlisten(int s, int backlog) FAST_FUNC; | 666 | void xlisten(int s, int backlog) FAST_FUNC; |
628 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; | 667 | void xconnect(int s, const struct sockaddr *saddr, socklen_t addrlen) FAST_FUNC; |
629 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, | 668 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, |
630 | socklen_t tolen) FAST_FUNC; | 669 | socklen_t tolen) FAST_FUNC; |
631 | 670 | ||
@@ -1132,6 +1171,7 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | |||
1132 | 1171 | ||
1133 | /* xvfork() can't be a _function_, return after vfork in child mangles stack | 1172 | /* xvfork() can't be a _function_, return after vfork in child mangles stack |
1134 | * in the parent. It must be a macro. */ | 1173 | * in the parent. It must be a macro. */ |
1174 | #if !ENABLE_PLATFORM_MINGW32 | ||
1135 | #define xvfork() \ | 1175 | #define xvfork() \ |
1136 | ({ \ | 1176 | ({ \ |
1137 | pid_t bb__xvfork_pid = vfork(); \ | 1177 | pid_t bb__xvfork_pid = vfork(); \ |
@@ -1139,6 +1179,9 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | |||
1139 | bb_perror_msg_and_die("vfork"); \ | 1179 | bb_perror_msg_and_die("vfork"); \ |
1140 | bb__xvfork_pid; \ | 1180 | bb__xvfork_pid; \ |
1141 | }) | 1181 | }) |
1182 | #else | ||
1183 | #define xvfork() vfork() | ||
1184 | #endif | ||
1142 | #if BB_MMU | 1185 | #if BB_MMU |
1143 | pid_t xfork(void) FAST_FUNC; | 1186 | pid_t xfork(void) FAST_FUNC; |
1144 | #endif | 1187 | #endif |
@@ -1683,9 +1726,15 @@ int bb_xioctl(int fd, unsigned request, void *argp) FAST_FUNC; | |||
1683 | #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) | 1726 | #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) |
1684 | #endif | 1727 | #endif |
1685 | 1728 | ||
1729 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA | ||
1686 | char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; | 1730 | char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; |
1687 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; | 1731 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; |
1688 | void reset_ino_dev_hashtable(void) FAST_FUNC; | 1732 | void reset_ino_dev_hashtable(void) FAST_FUNC; |
1733 | #else | ||
1734 | #define add_to_ino_dev_hashtable(s, n) (void)0 | ||
1735 | #define is_in_ino_dev_hashtable(s) NULL | ||
1736 | #define reset_ino_dev_hashtable() | ||
1737 | #endif | ||
1689 | #ifdef __GLIBC__ | 1738 | #ifdef __GLIBC__ |
1690 | /* At least glibc has horrendously large inline for this, so wrap it */ | 1739 | /* At least glibc has horrendously large inline for this, so wrap it */ |
1691 | unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC; | 1740 | unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC; |
@@ -1860,7 +1909,11 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
1860 | void (*cb)(struct smaprec *, void *), void *data); | 1909 | void (*cb)(struct smaprec *, void *), void *data); |
1861 | 1910 | ||
1862 | typedef struct procps_status_t { | 1911 | typedef struct procps_status_t { |
1912 | #if !ENABLE_PLATFORM_MINGW32 | ||
1863 | DIR *dir; | 1913 | DIR *dir; |
1914 | #else | ||
1915 | HANDLE snapshot; | ||
1916 | #endif | ||
1864 | IF_FEATURE_SHOW_THREADS(DIR *task_dir;) | 1917 | IF_FEATURE_SHOW_THREADS(DIR *task_dir;) |
1865 | uint8_t shift_pages_to_bytes; | 1918 | uint8_t shift_pages_to_bytes; |
1866 | uint8_t shift_pages_to_kb; | 1919 | uint8_t shift_pages_to_kb; |
@@ -2084,12 +2137,24 @@ extern const char bb_path_wtmp_file[] ALIGN1; | |||
2084 | #define bb_path_motd_file "/etc/motd" | 2137 | #define bb_path_motd_file "/etc/motd" |
2085 | 2138 | ||
2086 | #define bb_dev_null "/dev/null" | 2139 | #define bb_dev_null "/dev/null" |
2140 | #if ENABLE_PLATFORM_MINGW32 | ||
2141 | #define bb_busybox_exec_path get_busybox_exec_path() | ||
2142 | extern char bb_comm[]; | ||
2143 | extern char bb_command_line[]; | ||
2144 | #else | ||
2087 | extern const char bb_busybox_exec_path[] ALIGN1; | 2145 | extern const char bb_busybox_exec_path[] ALIGN1; |
2146 | #endif | ||
2088 | /* allow default system PATH to be extended via CFLAGS */ | 2147 | /* allow default system PATH to be extended via CFLAGS */ |
2089 | #ifndef BB_ADDITIONAL_PATH | 2148 | #ifndef BB_ADDITIONAL_PATH |
2090 | #define BB_ADDITIONAL_PATH "" | 2149 | #define BB_ADDITIONAL_PATH "" |
2091 | #endif | 2150 | #endif |
2151 | #if !ENABLE_PLATFORM_MINGW32 | ||
2092 | #define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH | 2152 | #define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH |
2153 | #define PATH_SEP ':' | ||
2154 | #else | ||
2155 | #define BB_PATH_ROOT_PATH "PATH=/sbin;/usr/sbin;/bin;/usr/bin" BB_ADDITIONAL_PATH | ||
2156 | #define PATH_SEP ';' | ||
2157 | #endif | ||
2093 | extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */ | 2158 | extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */ |
2094 | #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH")) | 2159 | #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH")) |
2095 | /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, | 2160 | /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, |
diff --git a/include/mingw.h b/include/mingw.h new file mode 100644 index 000000000..07f9857e9 --- /dev/null +++ b/include/mingw.h | |||
@@ -0,0 +1,533 @@ | |||
1 | |||
2 | #define NOIMPL(name,...) static inline int name(__VA_ARGS__) { errno = ENOSYS; return -1; } | ||
3 | #define IMPL(name,ret,retval,...) static inline ret name(__VA_ARGS__) { return retval; } | ||
4 | |||
5 | /* | ||
6 | * sys/types.h | ||
7 | */ | ||
8 | typedef int gid_t; | ||
9 | typedef int uid_t; | ||
10 | |||
11 | #define DEFAULT_UID 4095 | ||
12 | #define DEFAULT_GID DEFAULT_UID | ||
13 | |||
14 | /* | ||
15 | * arpa/inet.h | ||
16 | */ | ||
17 | static inline unsigned int git_ntohl(unsigned int x) { return (unsigned int)ntohl(x); } | ||
18 | #define ntohl git_ntohl | ||
19 | int inet_aton(const char *cp, struct in_addr *inp); | ||
20 | int inet_pton(int af, const char *src, void *dst); | ||
21 | |||
22 | /* | ||
23 | * fcntl.h | ||
24 | */ | ||
25 | #define F_DUPFD 0 | ||
26 | #define F_GETFD 1 | ||
27 | #define F_SETFD 2 | ||
28 | #define F_GETFL 3 | ||
29 | #define F_SETFL 3 | ||
30 | #define FD_CLOEXEC 0x1 | ||
31 | #define O_NONBLOCK 0 | ||
32 | #define O_NOFOLLOW 0 | ||
33 | #define O_NOCTTY 0 | ||
34 | #define O_SPECIAL 0x800000 | ||
35 | |||
36 | /* | ||
37 | * grp.h | ||
38 | */ | ||
39 | |||
40 | struct group { | ||
41 | char *gr_name; | ||
42 | char *gr_passwd; | ||
43 | gid_t gr_gid; | ||
44 | char **gr_mem; | ||
45 | }; | ||
46 | IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); | ||
47 | struct group *getgrgid(gid_t gid); | ||
48 | NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); | ||
49 | static inline void endgrent(void) {} | ||
50 | int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups); | ||
51 | |||
52 | /* | ||
53 | * limits.h | ||
54 | */ | ||
55 | #define NAME_MAX 255 | ||
56 | #define MAXSYMLINKS 20 | ||
57 | |||
58 | #ifdef LONG_MAX | ||
59 | # if LONG_MAX == 2147483647 | ||
60 | # define LONG_BIT 32 | ||
61 | # else | ||
62 | /* Safe assumption. */ | ||
63 | # define LONG_BIT 64 | ||
64 | # endif | ||
65 | #elif defined __LONG_MAX__ | ||
66 | # if __LONG_MAX__ == 2147483647 | ||
67 | # define LONG_BIT 32 | ||
68 | # else | ||
69 | /* Safe assumption. */ | ||
70 | # define LONG_BIT 64 | ||
71 | # endif | ||
72 | #endif | ||
73 | |||
74 | /* | ||
75 | * netdb.h | ||
76 | */ | ||
77 | |||
78 | typedef int sa_family_t; | ||
79 | |||
80 | /* | ||
81 | * linux/un.h | ||
82 | */ | ||
83 | struct sockaddr_un { | ||
84 | sa_family_t sun_family; | ||
85 | char sun_path[1]; /* to make compiler happy, don't bother */ | ||
86 | }; | ||
87 | |||
88 | /* | ||
89 | * pwd.h | ||
90 | */ | ||
91 | struct passwd { | ||
92 | char *pw_name; | ||
93 | char *pw_passwd; | ||
94 | char *pw_gecos; | ||
95 | char *pw_dir; | ||
96 | char *pw_shell; | ||
97 | uid_t pw_uid; | ||
98 | gid_t pw_gid; | ||
99 | }; | ||
100 | |||
101 | struct passwd *getpwnam(const char *name); | ||
102 | struct passwd *getpwuid(uid_t uid); | ||
103 | static inline void setpwent(void) {} | ||
104 | static inline void endpwent(void) {} | ||
105 | IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM); | ||
106 | IMPL(getpwent,struct passwd *,NULL,void) | ||
107 | |||
108 | /* | ||
109 | * signal.h | ||
110 | */ | ||
111 | #define SIGKILL 9 | ||
112 | #define SIGPIPE 13 | ||
113 | |||
114 | #define SIG_UNBLOCK 1 | ||
115 | |||
116 | NOIMPL(FAST_FUNC sigprocmask_allsigs, int how UNUSED_PARAM); | ||
117 | typedef void (*sighandler_t)(int); | ||
118 | sighandler_t winansi_signal(int signum, sighandler_t handler); | ||
119 | #define signal(s, h) winansi_signal(s, h) | ||
120 | |||
121 | /* | ||
122 | * stdio.h | ||
123 | */ | ||
124 | #undef fseeko | ||
125 | #define fseeko(f,o,w) fseek(f,o,w) | ||
126 | |||
127 | int fdprintf(int fd, const char *format, ...); | ||
128 | FILE* mingw_fopen(const char *filename, const char *mode); | ||
129 | int mingw_rename(const char*, const char*); | ||
130 | #define fopen mingw_fopen | ||
131 | #define rename mingw_rename | ||
132 | |||
133 | FILE *mingw_popen(const char *cmd, const char *mode); | ||
134 | int mingw_popen_fd(const char *cmd, const char *mode, int fd0, pid_t *pid); | ||
135 | int mingw_pclose(FILE *fd); | ||
136 | #undef popen | ||
137 | #undef pclose | ||
138 | #define popen mingw_popen | ||
139 | #define pclose mingw_pclose | ||
140 | |||
141 | #define setlinebuf(fd) setvbuf(fd, (char *) NULL, _IOLBF, 0) | ||
142 | |||
143 | /* | ||
144 | * ANSI emulation wrappers | ||
145 | */ | ||
146 | |||
147 | void set_title(const char *str); | ||
148 | void move_cursor_row(int n); | ||
149 | void reset_screen(void); | ||
150 | int winansi_putchar(int c); | ||
151 | int winansi_puts(const char *s); | ||
152 | size_t winansi_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); | ||
153 | int winansi_fputs(const char *str, FILE *stream); | ||
154 | int winansi_vsnprintf(char *buf, size_t size, const char *format, va_list list); | ||
155 | int winansi_vfprintf(FILE *stream, const char *format, va_list list); | ||
156 | int winansi_printf(const char *format, ...) __attribute__((format (printf, 1, 2))); | ||
157 | int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format (printf, 2, 3))); | ||
158 | int winansi_write(int fd, const void *buf, size_t count); | ||
159 | int winansi_read(int fd, void *buf, size_t count); | ||
160 | int winansi_getc(FILE *stream); | ||
161 | #define putchar winansi_putchar | ||
162 | #define puts winansi_puts | ||
163 | #define fwrite winansi_fwrite | ||
164 | #define fputs winansi_fputs | ||
165 | #if !defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO | ||
166 | #define vsnprintf(buf, size, ...) winansi_vsnprintf(buf, size, __VA_ARGS__) | ||
167 | #endif | ||
168 | #define vfprintf(stream, ...) winansi_vfprintf(stream, __VA_ARGS__) | ||
169 | #define vprintf(...) winansi_vfprintf(stdout, __VA_ARGS__) | ||
170 | #define printf(...) winansi_printf(__VA_ARGS__) | ||
171 | #define fprintf(...) winansi_fprintf(__VA_ARGS__) | ||
172 | #define write winansi_write | ||
173 | #define read winansi_read | ||
174 | #define getc winansi_getc | ||
175 | |||
176 | /* | ||
177 | * stdlib.h | ||
178 | */ | ||
179 | #define WTERMSIG(x) ((x) & 0x7f) | ||
180 | #define WIFEXITED(x) (WTERMSIG(x) == 0) | ||
181 | #define WEXITSTATUS(x) (((x) & 0xff00) >> 8) | ||
182 | #define WIFSIGNALED(x) (((signed char) (((x) & 0x7f) + 1) >> 1) > 0) | ||
183 | #define WCOREDUMP(x) 0 | ||
184 | #define WIFSTOPPED(x) 0 | ||
185 | |||
186 | int mingw_system(const char *cmd); | ||
187 | #define system mingw_system | ||
188 | |||
189 | int clearenv(void); | ||
190 | char *mingw_getenv(const char *name); | ||
191 | int mingw_putenv(const char *env); | ||
192 | char *mingw_mktemp(char *template); | ||
193 | int mkstemp(char *template); | ||
194 | char *realpath(const char *path, char *resolved_path); | ||
195 | int setenv(const char *name, const char *value, int replace); | ||
196 | int unsetenv(const char *env); | ||
197 | |||
198 | #define getenv mingw_getenv | ||
199 | #define putenv mingw_putenv | ||
200 | #define mktemp mingw_mktemp | ||
201 | |||
202 | /* | ||
203 | * strings.h | ||
204 | */ | ||
205 | int ffs(int i); | ||
206 | |||
207 | /* | ||
208 | * sys/ioctl.h | ||
209 | */ | ||
210 | |||
211 | #define TIOCGWINSZ 0x5413 | ||
212 | |||
213 | int ioctl(int fd, int code, ...); | ||
214 | |||
215 | /* | ||
216 | * sys/socket.h | ||
217 | */ | ||
218 | #define hstrerror strerror | ||
219 | |||
220 | #define SHUT_WR SD_SEND | ||
221 | |||
222 | int mingw_socket(int domain, int type, int protocol); | ||
223 | int mingw_connect(int sockfd, const struct sockaddr *sa, size_t sz); | ||
224 | int mingw_bind(int sockfd, struct sockaddr *sa, size_t sz); | ||
225 | int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen); | ||
226 | int mingw_shutdown(int sockfd, int how); | ||
227 | int mingw_listen(int sockfd, int backlog); | ||
228 | int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz); | ||
229 | int mingw_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, | ||
230 | struct timeval *timeout); | ||
231 | |||
232 | NOIMPL(mingw_sendto,SOCKET s UNUSED_PARAM, const char *buf UNUSED_PARAM, int len UNUSED_PARAM, int flags UNUSED_PARAM, const struct sockaddr *sa UNUSED_PARAM, int salen UNUSED_PARAM); | ||
233 | |||
234 | #define socket mingw_socket | ||
235 | #define connect mingw_connect | ||
236 | #define sendto mingw_sendto | ||
237 | #define listen mingw_listen | ||
238 | #define bind mingw_bind | ||
239 | #define setsockopt mingw_setsockopt | ||
240 | #define shutdown mingw_shutdown | ||
241 | #define accept mingw_accept | ||
242 | #define select mingw_select | ||
243 | |||
244 | /* | ||
245 | * sys/stat.h | ||
246 | */ | ||
247 | #define S_ISUID 04000 | ||
248 | #define S_ISGID 02000 | ||
249 | #define S_ISVTX 01000 | ||
250 | #ifndef S_IRWXU | ||
251 | #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) | ||
252 | #endif | ||
253 | #define S_IRWXG (S_IRWXU >> 3) | ||
254 | #define S_IRWXO (S_IRWXG >> 3) | ||
255 | |||
256 | #define S_IFSOCK 0140000 | ||
257 | #define S_IFLNK 0120000 /* Symbolic link */ | ||
258 | #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) | ||
259 | #define S_ISSOCK(x) 0 | ||
260 | |||
261 | #define S_IRGRP (S_IRUSR >> 3) | ||
262 | #define S_IWGRP (S_IWUSR >> 3) | ||
263 | #define S_IXGRP (S_IXUSR >> 3) | ||
264 | #define S_IROTH (S_IRGRP >> 3) | ||
265 | #define S_IWOTH (S_IWGRP >> 3) | ||
266 | #define S_IXOTH (S_IXGRP >> 3) | ||
267 | |||
268 | mode_t mingw_umask(mode_t mode); | ||
269 | #define umask mingw_umask | ||
270 | |||
271 | #define DEFAULT_UMASK 0002 | ||
272 | |||
273 | IMPL(fchmod,int,0,int fildes UNUSED_PARAM, mode_t mode UNUSED_PARAM); | ||
274 | NOIMPL(fchown,int fd UNUSED_PARAM, uid_t uid UNUSED_PARAM, gid_t gid UNUSED_PARAM); | ||
275 | int mingw_mkdir(const char *path, int mode); | ||
276 | int mingw_chdir(const char *path); | ||
277 | int mingw_chmod(const char *path, int mode); | ||
278 | |||
279 | #define mkdir mingw_mkdir | ||
280 | #define chdir mingw_chdir | ||
281 | #define chmod mingw_chmod | ||
282 | |||
283 | #if ENABLE_LFS && !defined(__MINGW64_VERSION_MAJOR) | ||
284 | # define off_t off64_t | ||
285 | #endif | ||
286 | |||
287 | typedef int nlink_t; | ||
288 | typedef int blksize_t; | ||
289 | typedef off_t blkcnt_t; | ||
290 | #if ENABLE_FEATURE_EXTRA_FILE_DATA | ||
291 | #define ino_t uint64_t | ||
292 | #endif | ||
293 | |||
294 | struct mingw_stat { | ||
295 | dev_t st_dev; | ||
296 | ino_t st_ino; | ||
297 | mode_t st_mode; | ||
298 | nlink_t st_nlink; | ||
299 | uid_t st_uid; | ||
300 | gid_t st_gid; | ||
301 | dev_t st_rdev; | ||
302 | off_t st_size; | ||
303 | time_t st_atime; | ||
304 | time_t st_mtime; | ||
305 | time_t st_ctime; | ||
306 | blksize_t st_blksize; | ||
307 | blkcnt_t st_blocks; | ||
308 | }; | ||
309 | |||
310 | int mingw_lstat(const char *file_name, struct mingw_stat *buf); | ||
311 | int mingw_stat(const char *file_name, struct mingw_stat *buf); | ||
312 | int mingw_fstat(int fd, struct mingw_stat *buf); | ||
313 | #undef lstat | ||
314 | #undef stat | ||
315 | #undef fstat | ||
316 | #define lstat mingw_lstat | ||
317 | #define stat mingw_stat | ||
318 | #define fstat mingw_fstat | ||
319 | |||
320 | /* | ||
321 | * sys/sysmacros.h | ||
322 | */ | ||
323 | #define makedev(a,b) 0*(a)*(b) /* avoid unused warning */ | ||
324 | #define minor(x) 0 | ||
325 | #define major(x) 0 | ||
326 | |||
327 | /* | ||
328 | * sys/time.h | ||
329 | */ | ||
330 | #ifndef _TIMESPEC_DEFINED | ||
331 | #define _TIMESPEC_DEFINED | ||
332 | struct timespec { | ||
333 | time_t tv_sec; | ||
334 | long int tv_nsec; | ||
335 | }; | ||
336 | #endif | ||
337 | |||
338 | int nanosleep(const struct timespec *req, struct timespec *rem); | ||
339 | |||
340 | /* | ||
341 | * sys/wait.h | ||
342 | */ | ||
343 | #define WNOHANG 1 | ||
344 | #define WUNTRACED 2 | ||
345 | int waitpid(pid_t pid, int *status, int options); | ||
346 | |||
347 | /* | ||
348 | * time.h | ||
349 | */ | ||
350 | struct tm *gmtime_r(const time_t *timep, struct tm *result); | ||
351 | struct tm *localtime_r(const time_t *timep, struct tm *result); | ||
352 | char *strptime(const char *s, const char *format, struct tm *tm); | ||
353 | size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm *tm); | ||
354 | int stime(time_t *t); | ||
355 | |||
356 | #define strftime mingw_strftime | ||
357 | |||
358 | /* | ||
359 | * times.h | ||
360 | */ | ||
361 | #define clock_t long | ||
362 | |||
363 | struct tms { | ||
364 | clock_t tms_utime; /* user CPU time */ | ||
365 | clock_t tms_stime; /* system CPU time */ | ||
366 | clock_t tms_cutime; /* user CPU time of children */ | ||
367 | clock_t tms_cstime; /* system CPU time of children */ | ||
368 | }; | ||
369 | |||
370 | clock_t times(struct tms *buf); | ||
371 | |||
372 | /* | ||
373 | * unistd.h | ||
374 | */ | ||
375 | #define PIPE_BUF 8192 | ||
376 | |||
377 | #define _SC_CLK_TCK 2 | ||
378 | |||
379 | #define TICKS_PER_SECOND 100 | ||
380 | #define MS_PER_TICK 10 | ||
381 | #define HNSEC_PER_TICK 100000 | ||
382 | |||
383 | IMPL(alarm,unsigned int,0,unsigned int seconds UNUSED_PARAM); | ||
384 | IMPL(chown,int,0,const char *path UNUSED_PARAM, uid_t uid UNUSED_PARAM, gid_t gid UNUSED_PARAM); | ||
385 | NOIMPL(chroot,const char *root UNUSED_PARAM); | ||
386 | NOIMPL(fchdir,int fd UNUSED_PARAM); | ||
387 | int mingw_dup2 (int fd, int fdto); | ||
388 | char *mingw_getcwd(char *pointer, int len); | ||
389 | off_t mingw_lseek(int fd, off_t offset, int whence); | ||
390 | |||
391 | |||
392 | int getuid(void); | ||
393 | #define getgid getuid | ||
394 | #define geteuid getuid | ||
395 | #define getegid getuid | ||
396 | int getgroups(int n, gid_t *groups); | ||
397 | IMPL(getppid,int,1,void); | ||
398 | NOIMPL(getsid,pid_t pid UNUSED_PARAM); | ||
399 | int getlogin_r(char *buf, size_t len); | ||
400 | int fcntl(int fd, int cmd, ...); | ||
401 | int fsync(int fd); | ||
402 | int kill(pid_t pid, int sig); | ||
403 | int link(const char *oldpath, const char *newpath); | ||
404 | NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); | ||
405 | /* order of devices must match that in get_dev_type */ | ||
406 | enum {DEV_NULL, DEV_ZERO, DEV_URANDOM, NOT_DEVICE}; | ||
407 | int get_dev_type(const char *filename); | ||
408 | void update_dev_fd(int dev, int fd); | ||
409 | int mingw_open (const char *filename, int oflags, ...); | ||
410 | int mingw_xopen(const char *filename, int oflags); | ||
411 | ssize_t mingw_read(int fd, void *buf, size_t count); | ||
412 | int mingw_close(int fd); | ||
413 | int pipe(int filedes[2]); | ||
414 | #if ENABLE_FEATURE_READLINK2 | ||
415 | ssize_t readlink(const char *pathname, char *buf, size_t bufsiz); | ||
416 | #else | ||
417 | NOIMPL(readlink,const char *path UNUSED_PARAM, char *buf UNUSED_PARAM, size_t bufsiz UNUSED_PARAM); | ||
418 | #endif | ||
419 | NOIMPL(setgid,gid_t gid UNUSED_PARAM); | ||
420 | NOIMPL(setegid,gid_t gid UNUSED_PARAM); | ||
421 | NOIMPL(setsid,void); | ||
422 | NOIMPL(setuid,uid_t gid UNUSED_PARAM); | ||
423 | NOIMPL(seteuid,uid_t gid UNUSED_PARAM); | ||
424 | unsigned int sleep(unsigned int seconds); | ||
425 | NOIMPL(symlink,const char *oldpath UNUSED_PARAM, const char *newpath UNUSED_PARAM); | ||
426 | static inline void sync(void) {} | ||
427 | long sysconf(int name); | ||
428 | IMPL(getpagesize,int,4096,void); | ||
429 | NOIMPL(ttyname_r,int fd UNUSED_PARAM, char *buf UNUSED_PARAM, int sz UNUSED_PARAM); | ||
430 | int mingw_unlink(const char *pathname); | ||
431 | pid_t vfork(void); | ||
432 | int mingw_access(const char *name, int mode); | ||
433 | int mingw_rmdir(const char *name); | ||
434 | int mingw_isatty(int fd); | ||
435 | |||
436 | #define dup2 mingw_dup2 | ||
437 | #define getcwd mingw_getcwd | ||
438 | #define lchown chown | ||
439 | #define open mingw_open | ||
440 | #define close mingw_close | ||
441 | #define unlink mingw_unlink | ||
442 | #define rmdir mingw_rmdir | ||
443 | #undef lseek | ||
444 | #define lseek mingw_lseek | ||
445 | |||
446 | #undef access | ||
447 | #define access mingw_access | ||
448 | #define isatty mingw_isatty | ||
449 | |||
450 | /* | ||
451 | * utime.h | ||
452 | */ | ||
453 | int utimes(const char *file_name, const struct timeval times[2]); | ||
454 | |||
455 | /* | ||
456 | * dirent.h | ||
457 | */ | ||
458 | DIR *mingw_opendir(const char *path); | ||
459 | #define opendir mingw_opendir | ||
460 | |||
461 | /* | ||
462 | * Functions with different prototypes in BusyBox and WIN32 | ||
463 | */ | ||
464 | #define itoa bb_itoa | ||
465 | #define strrev bb_strrev | ||
466 | |||
467 | /* | ||
468 | * MinGW specific | ||
469 | */ | ||
470 | #define is_dir_sep(c) ((c) == '/' || (c) == '\\') | ||
471 | |||
472 | pid_t FAST_FUNC mingw_spawn(char **argv); | ||
473 | intptr_t FAST_FUNC mingw_spawn_proc(const char **argv); | ||
474 | int mingw_execv(const char *cmd, char *const *argv); | ||
475 | int mingw_execvp(const char *cmd, char *const *argv); | ||
476 | int mingw_execve(const char *cmd, char *const *argv, char *const *envp); | ||
477 | #define spawn mingw_spawn | ||
478 | #define execvp mingw_execvp | ||
479 | #define execve mingw_execve | ||
480 | #define execv mingw_execv | ||
481 | |||
482 | #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') | ||
483 | #define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path)) | ||
484 | |||
485 | int kill_SIGTERM_by_handle(HANDLE process, int exit_code); | ||
486 | |||
487 | #define find_mount_point(n, s) find_mount_point(n) | ||
488 | |||
489 | char *is_prefixed_with_case(const char *string, const char *key) FAST_FUNC; | ||
490 | char *is_suffixed_with_case(const char *string, const char *key) FAST_FUNC; | ||
491 | void qsort_string_vector_case(char **sv, unsigned count) FAST_FUNC; | ||
492 | |||
493 | /* | ||
494 | * helpers | ||
495 | */ | ||
496 | |||
497 | const char *get_busybox_exec_path(void); | ||
498 | void init_winsock(void); | ||
499 | void init_codepage(void); | ||
500 | |||
501 | int has_bat_suffix(const char *p); | ||
502 | int has_exe_suffix(const char *p); | ||
503 | int has_exe_suffix_or_dot(const char *name); | ||
504 | char *alloc_win32_extension(const char *p); | ||
505 | int add_win32_extension(char *p); | ||
506 | |||
507 | static inline char *auto_win32_extension(const char *p) | ||
508 | { | ||
509 | extern char *auto_string(char *str) FAST_FUNC; | ||
510 | char *s = alloc_win32_extension(p); | ||
511 | return s ? auto_string(s) : NULL; | ||
512 | } | ||
513 | |||
514 | void bs_to_slash(char *p) FAST_FUNC; | ||
515 | void slash_to_bs(char *p) FAST_FUNC; | ||
516 | size_t remove_cr(char *p, size_t len) FAST_FUNC; | ||
517 | |||
518 | int err_win_to_posix(void); | ||
519 | |||
520 | ULONGLONG CompatGetTickCount64(void); | ||
521 | #define GetTickCount64 CompatGetTickCount64 | ||
522 | |||
523 | ssize_t get_random_bytes(void *buf, ssize_t count); | ||
524 | int enumerate_links(const char *file, char *name); | ||
525 | void hide_console(void); | ||
526 | |||
527 | int unc_root_len(const char *dir); | ||
528 | int root_len(const char *path); | ||
529 | char *get_system_drive(void); | ||
530 | int chdir_system_drive(void); | ||
531 | char *xabsolute_path(char *path); | ||
532 | char *get_drive_cwd(const char *path, char *buffer, int size); | ||
533 | void fix_path_case(char *path); | ||
diff --git a/include/platform.h b/include/platform.h index 50365a31c..afd8cf292 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -7,6 +7,15 @@ | |||
7 | #ifndef BB_PLATFORM_H | 7 | #ifndef BB_PLATFORM_H |
8 | #define BB_PLATFORM_H 1 | 8 | #define BB_PLATFORM_H 1 |
9 | 9 | ||
10 | #if ENABLE_PLATFORM_MINGW32 | ||
11 | # if !defined(__MINGW32__) /* HOSTCC is called */ | ||
12 | # undef ENABLE_PLATFORM_MINGW32 | ||
13 | # endif | ||
14 | #else | ||
15 | # if defined(__MINGW32__) | ||
16 | # error "You must select target platform MS Windows, or it won't build" | ||
17 | # endif | ||
18 | #endif | ||
10 | 19 | ||
11 | /* Convenience macros to test the version of gcc. */ | 20 | /* Convenience macros to test the version of gcc. */ |
12 | #undef __GNUC_PREREQ | 21 | #undef __GNUC_PREREQ |
@@ -131,7 +140,7 @@ | |||
131 | 140 | ||
132 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 141 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
133 | /* (don't include system headers after this until corresponding pop!) */ | 142 | /* (don't include system headers after this until corresponding pop!) */ |
134 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) | 143 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) && !ENABLE_PLATFORM_MINGW32 |
135 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") | 144 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") |
136 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") | 145 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") |
137 | #else | 146 | #else |
@@ -160,6 +169,13 @@ | |||
160 | # define bswap_64 __bswap64 | 169 | # define bswap_64 __bswap64 |
161 | # define bswap_32 __bswap32 | 170 | # define bswap_32 __bswap32 |
162 | # define bswap_16 __bswap16 | 171 | # define bswap_16 __bswap16 |
172 | #elif ENABLE_PLATFORM_MINGW32 | ||
173 | # define __BIG_ENDIAN 0 | ||
174 | # define __LITTLE_ENDIAN 1 | ||
175 | # define __BYTE_ORDER __LITTLE_ENDIAN | ||
176 | # define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0xFF) << 8)) | ||
177 | # define bswap_32(x) ((bswap_16(((x) & 0xFFFF0000L) >> 16)) | (bswap_16((x) & 0xFFFFL) << 16)) | ||
178 | # define bswap_64(x) ((bswap_32(((x) & 0xFFFFFFFF00000000LL) >> 32)) | (bswap_32((x) & 0xFFFFFFFFLL) << 32)) | ||
163 | #else | 179 | #else |
164 | # include <byteswap.h> | 180 | # include <byteswap.h> |
165 | # include <endian.h> | 181 | # include <endian.h> |
@@ -429,6 +445,27 @@ typedef unsigned smalluint; | |||
429 | # endif | 445 | # endif |
430 | #endif | 446 | #endif |
431 | 447 | ||
448 | #if ENABLE_PLATFORM_MINGW32 | ||
449 | # undef HAVE_FDATASYNC | ||
450 | # undef HAVE_DPRINTF | ||
451 | # undef HAVE_GETLINE | ||
452 | # undef HAVE_MEMRCHR | ||
453 | # undef HAVE_MKDTEMP | ||
454 | # undef HAVE_SETBIT | ||
455 | # undef HAVE_STPCPY | ||
456 | # undef HAVE_STRCASESTR | ||
457 | # undef HAVE_STRCHRNUL | ||
458 | # undef HAVE_STRSEP | ||
459 | # undef HAVE_STRSIGNAL | ||
460 | # undef HAVE_STRVERSCMP | ||
461 | #if !defined(__MINGW64_VERSION_MAJOR) | ||
462 | # undef HAVE_VASPRINTF | ||
463 | #endif | ||
464 | # undef HAVE_UNLOCKED_STDIO | ||
465 | # undef HAVE_UNLOCKED_LINE_OPS | ||
466 | # undef HAVE_PRINTF_PERCENTM | ||
467 | #endif | ||
468 | |||
432 | #if defined(__WATCOMC__) | 469 | #if defined(__WATCOMC__) |
433 | # undef HAVE_DPRINTF | 470 | # undef HAVE_DPRINTF |
434 | # undef HAVE_GETLINE | 471 | # undef HAVE_GETLINE |
@@ -543,6 +580,7 @@ extern int dprintf(int fd, const char *format, ...); | |||
543 | #endif | 580 | #endif |
544 | 581 | ||
545 | #ifndef HAVE_MEMRCHR | 582 | #ifndef HAVE_MEMRCHR |
583 | #include <stddef.h> | ||
546 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 584 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
547 | #endif | 585 | #endif |
548 | 586 | ||
@@ -602,6 +640,7 @@ extern int usleep(unsigned) FAST_FUNC; | |||
602 | #endif | 640 | #endif |
603 | 641 | ||
604 | #ifndef HAVE_VASPRINTF | 642 | #ifndef HAVE_VASPRINTF |
643 | # include <stdarg.h> | ||
605 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 644 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |
606 | #endif | 645 | #endif |
607 | 646 | ||