aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-04-16 13:13:52 +0100
committerRon Yorston <rmy@pobox.com>2023-04-16 13:13:52 +0100
commit74734bff81dc2e1a5b160d5621eeea35c5defabd (patch)
treefdc363020207ff3538023a1a37a801a1fb9ea9b3
parent86ff1772f25dff819c1983418ac36822745a6d19 (diff)
downloadbusybox-w32-74734bff81dc2e1a5b160d5621eeea35c5defabd.tar.gz
busybox-w32-74734bff81dc2e1a5b160d5621eeea35c5defabd.tar.bz2
busybox-w32-74734bff81dc2e1a5b160d5621eeea35c5defabd.zip
libbb: don't build useless functions
The functions ndelay_on(), ndelay_off() and close_on_exec_on() don't do anything useful because our fcntl(2) implementation doesn't support the features they require. Replace them with stubs. Saves 176-208 bytes.
-rw-r--r--include/libbb.h6
-rw-r--r--libbb/xfuncs.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 7683b3f63..a4eebab99 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -592,9 +592,15 @@ const char* endofname(const char *name) FAST_FUNC;
592char *is_prefixed_with(const char *string, const char *key) FAST_FUNC; 592char *is_prefixed_with(const char *string, const char *key) FAST_FUNC;
593char *is_suffixed_with(const char *string, const char *key) FAST_FUNC; 593char *is_suffixed_with(const char *string, const char *key) FAST_FUNC;
594 594
595#if !ENABLE_PLATFORM_MINGW32
595int ndelay_on(int fd) FAST_FUNC; 596int ndelay_on(int fd) FAST_FUNC;
596int ndelay_off(int fd) FAST_FUNC; 597int ndelay_off(int fd) FAST_FUNC;
597void close_on_exec_on(int fd) FAST_FUNC; 598void close_on_exec_on(int fd) FAST_FUNC;
599#else
600static inline int ndelay_on(int fd UNUSED_PARAM) { return 0; }
601static inline int ndelay_off(int fd UNUSED_PARAM) { return 0; }
602static inline void close_on_exec_on(int fd UNUSED_PARAM) { return; }
603#endif
598void xdup2(int, int) FAST_FUNC; 604void xdup2(int, int) FAST_FUNC;
599void xmove_fd(int, int) FAST_FUNC; 605void xmove_fd(int, int) FAST_FUNC;
600 606
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index cbeb24701..813985194 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -23,6 +23,7 @@
23#include "libbb.h" 23#include "libbb.h"
24 24
25/* Turn on nonblocking I/O on a fd */ 25/* Turn on nonblocking I/O on a fd */
26#if !ENABLE_PLATFORM_MINGW32
26int FAST_FUNC ndelay_on(int fd) 27int FAST_FUNC ndelay_on(int fd)
27{ 28{
28 int flags = fcntl(fd, F_GETFL); 29 int flags = fcntl(fd, F_GETFL);
@@ -45,6 +46,7 @@ void FAST_FUNC close_on_exec_on(int fd)
45{ 46{
46 fcntl(fd, F_SETFD, FD_CLOEXEC); 47 fcntl(fd, F_SETFD, FD_CLOEXEC);
47} 48}
49#endif
48 50
49char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src) 51char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src)
50{ 52{