aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-02-06 09:52:11 +0000
committerRon Yorston <rmy@pobox.com>2021-02-06 09:52:11 +0000
commit70ca88d03a7aa92720744832fd9d131a183e00be (patch)
tree937e9e211ba75875b9a5f0f5a444b45839a85783
parent32e19e7ae8b0d76d69871ba234e8f0af31baff4e (diff)
downloadbusybox-w32-70ca88d03a7aa92720744832fd9d131a183e00be.tar.gz
busybox-w32-70ca88d03a7aa92720744832fd9d131a183e00be.tar.bz2
busybox-w32-70ca88d03a7aa92720744832fd9d131a183e00be.zip
win32: code shrink
Don't compile some code that isn't currently supported for WIN32. Saves 24 bytes.
-rw-r--r--include/mingw.h4
-rw-r--r--libbb/signals.c2
-rw-r--r--libbb/xfuncs_printf.c2
-rw-r--r--shell/ash.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/include/mingw.h b/include/mingw.h
index a1ba5f5af..236c955d8 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -114,7 +114,6 @@ IMPL(getpwent,struct passwd *,NULL,void)
114 114
115#define SIG_UNBLOCK 1 115#define SIG_UNBLOCK 1
116 116
117NOIMPL(FAST_FUNC sigprocmask_allsigs, int how UNUSED_PARAM);
118typedef void (*sighandler_t)(int); 117typedef void (*sighandler_t)(int);
119sighandler_t winansi_signal(int signum, sighandler_t handler); 118sighandler_t winansi_signal(int signum, sighandler_t handler);
120#define signal(s, h) winansi_signal(s, h) 119#define signal(s, h) winansi_signal(s, h)
@@ -243,11 +242,8 @@ int mingw_getaddrinfo(const char *node, const char *service,
243 const struct addrinfo *hints, struct addrinfo **res); 242 const struct addrinfo *hints, struct addrinfo **res);
244struct hostent *mingw_gethostbyaddr(const void *addr, socklen_t len, int type); 243struct hostent *mingw_gethostbyaddr(const void *addr, socklen_t len, int type);
245 244
246NOIMPL(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);
247
248#define socket mingw_socket 245#define socket mingw_socket
249#define connect mingw_connect 246#define connect mingw_connect
250#define sendto mingw_sendto
251#define listen mingw_listen 247#define listen mingw_listen
252#define bind mingw_bind 248#define bind mingw_bind
253#define setsockopt mingw_setsockopt 249#define setsockopt mingw_setsockopt
diff --git a/libbb/signals.c b/libbb/signals.c
index d3d84ef6a..e64ba5023 100644
--- a/libbb/signals.c
+++ b/libbb/signals.c
@@ -18,6 +18,7 @@ void record_signo(int signo)
18 bb_got_signal = signo; 18 bb_got_signal = signo;
19} 19}
20 20
21#if !ENABLE_PLATFORM_MINGW32
21/* Saves 2 bytes on x86! Oh my... */ 22/* Saves 2 bytes on x86! Oh my... */
22int FAST_FUNC sigaction_set(int signum, const struct sigaction *act) 23int FAST_FUNC sigaction_set(int signum, const struct sigaction *act)
23{ 24{
@@ -40,6 +41,7 @@ int FAST_FUNC sigprocmask2(int how, sigset_t *set)
40 oset = set; 41 oset = set;
41 return sigprocmask(how, set, oset); 42 return sigprocmask(how, set, oset);
42} 43}
44#endif
43 45
44void FAST_FUNC bb_signals(int sigs, void (*f)(int)) 46void FAST_FUNC bb_signals(int sigs, void (*f)(int))
45{ 47{
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index d672e43e5..47dbdd1b6 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -499,6 +499,7 @@ void FAST_FUNC xlisten(int s, int backlog)
499 if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen"); 499 if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen");
500} 500}
501 501
502#if !ENABLE_PLATFORM_MINGW32
502/* Die with an error message if sendto failed. 503/* Die with an error message if sendto failed.
503 * Return bytes sent otherwise */ 504 * Return bytes sent otherwise */
504ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, 505ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct sockaddr *to,
@@ -512,6 +513,7 @@ ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct socka
512 } 513 }
513 return ret; 514 return ret;
514} 515}
516#endif
515 517
516// xstat() - a stat() which dies on failure with meaningful error message 518// xstat() - a stat() which dies on failure with meaningful error message
517void FAST_FUNC xstat(const char *name, struct stat *stat_buf) 519void FAST_FUNC xstat(const char *name, struct stat *stat_buf)
diff --git a/shell/ash.c b/shell/ash.c
index b9bdd64e5..c400612d9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -827,9 +827,11 @@ static void
827raise_interrupt(void) 827raise_interrupt(void)
828{ 828{
829 pending_int = 0; 829 pending_int = 0;
830#if !ENABLE_PLATFORM_MINGW32
830 /* Signal is not automatically unmasked after it is raised, 831 /* Signal is not automatically unmasked after it is raised,
831 * do it ourself - unmask all signals */ 832 * do it ourself - unmask all signals */
832 sigprocmask_allsigs(SIG_UNBLOCK); 833 sigprocmask_allsigs(SIG_UNBLOCK);
834#endif
833 /* pending_sig = 0; - now done in signal_handler() */ 835 /* pending_sig = 0; - now done in signal_handler() */
834 836
835 if (!(rootshell && iflag)) { 837 if (!(rootshell && iflag)) {