diff options
author | Ron Yorston <rmy@pobox.com> | 2023-04-16 13:13:52 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-04-16 13:13:52 +0100 |
commit | 74734bff81dc2e1a5b160d5621eeea35c5defabd (patch) | |
tree | fdc363020207ff3538023a1a37a801a1fb9ea9b3 | |
parent | 86ff1772f25dff819c1983418ac36822745a6d19 (diff) | |
download | busybox-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.h | 6 | ||||
-rw-r--r-- | libbb/xfuncs.c | 2 |
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; | |||
592 | char *is_prefixed_with(const char *string, const char *key) FAST_FUNC; | 592 | char *is_prefixed_with(const char *string, const char *key) FAST_FUNC; |
593 | char *is_suffixed_with(const char *string, const char *key) FAST_FUNC; | 593 | char *is_suffixed_with(const char *string, const char *key) FAST_FUNC; |
594 | 594 | ||
595 | #if !ENABLE_PLATFORM_MINGW32 | ||
595 | int ndelay_on(int fd) FAST_FUNC; | 596 | int ndelay_on(int fd) FAST_FUNC; |
596 | int ndelay_off(int fd) FAST_FUNC; | 597 | int ndelay_off(int fd) FAST_FUNC; |
597 | void close_on_exec_on(int fd) FAST_FUNC; | 598 | void close_on_exec_on(int fd) FAST_FUNC; |
599 | #else | ||
600 | static inline int ndelay_on(int fd UNUSED_PARAM) { return 0; } | ||
601 | static inline int ndelay_off(int fd UNUSED_PARAM) { return 0; } | ||
602 | static inline void close_on_exec_on(int fd UNUSED_PARAM) { return; } | ||
603 | #endif | ||
598 | void xdup2(int, int) FAST_FUNC; | 604 | void xdup2(int, int) FAST_FUNC; |
599 | void xmove_fd(int, int) FAST_FUNC; | 605 | void 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 | ||
26 | int FAST_FUNC ndelay_on(int fd) | 27 | int 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 | ||
49 | char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src) | 51 | char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src) |
50 | { | 52 | { |