From 70ca88d03a7aa92720744832fd9d131a183e00be Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 6 Feb 2021 09:52:11 +0000 Subject: win32: code shrink Don't compile some code that isn't currently supported for WIN32. Saves 24 bytes. --- include/mingw.h | 4 ---- libbb/signals.c | 2 ++ libbb/xfuncs_printf.c | 2 ++ shell/ash.c | 2 ++ 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) #define SIG_UNBLOCK 1 -NOIMPL(FAST_FUNC sigprocmask_allsigs, int how UNUSED_PARAM); typedef void (*sighandler_t)(int); sighandler_t winansi_signal(int signum, sighandler_t handler); #define signal(s, h) winansi_signal(s, h) @@ -243,11 +242,8 @@ int mingw_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); struct hostent *mingw_gethostbyaddr(const void *addr, socklen_t len, int type); -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); - #define socket mingw_socket #define connect mingw_connect -#define sendto mingw_sendto #define listen mingw_listen #define bind mingw_bind #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) bb_got_signal = signo; } +#if !ENABLE_PLATFORM_MINGW32 /* Saves 2 bytes on x86! Oh my... */ int FAST_FUNC sigaction_set(int signum, const struct sigaction *act) { @@ -40,6 +41,7 @@ int FAST_FUNC sigprocmask2(int how, sigset_t *set) oset = set; return sigprocmask(how, set, oset); } +#endif void FAST_FUNC bb_signals(int sigs, void (*f)(int)) { 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) if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen"); } +#if !ENABLE_PLATFORM_MINGW32 /* Die with an error message if sendto failed. * Return bytes sent otherwise */ ssize_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 } return ret; } +#endif // xstat() - a stat() which dies on failure with meaningful error message void 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 raise_interrupt(void) { pending_int = 0; +#if !ENABLE_PLATFORM_MINGW32 /* Signal is not automatically unmasked after it is raised, * do it ourself - unmask all signals */ sigprocmask_allsigs(SIG_UNBLOCK); +#endif /* pending_sig = 0; - now done in signal_handler() */ if (!(rootshell && iflag)) { -- cgit v1.2.3-55-g6feb