diff options
-rw-r--r-- | include/libbb.h | 7 | ||||
-rw-r--r-- | libbb/sysconf.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index cc2bea32d..17a0089d8 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -731,11 +731,14 @@ extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST | |||
731 | /* Never returns NULL */ | 731 | /* Never returns NULL */ |
732 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 732 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
733 | 733 | ||
734 | #if defined ARG_MAX | 734 | #if defined(ARG_MAX) && (ARG_MAX >= 60*1024 || !defined(_SC_ARG_MAX)) |
735 | /* Use _constant_ maximum if: defined && (big enough || no variable one exists) */ | ||
735 | # define bb_arg_max() ((unsigned)ARG_MAX) | 736 | # define bb_arg_max() ((unsigned)ARG_MAX) |
736 | #elif defined _SC_ARG_MAX | 737 | #elif defined(_SC_ARG_MAX) |
738 | /* Else use variable one (a bit more expensive) */ | ||
737 | unsigned bb_arg_max(void) FAST_FUNC; | 739 | unsigned bb_arg_max(void) FAST_FUNC; |
738 | #else | 740 | #else |
741 | /* If all else fails */ | ||
739 | # define bb_arg_max() ((unsigned)(32 * 1024)) | 742 | # define bb_arg_max() ((unsigned)(32 * 1024)) |
740 | #endif | 743 | #endif |
741 | unsigned bb_clk_tck(void) FAST_FUNC; | 744 | unsigned bb_clk_tck(void) FAST_FUNC; |
diff --git a/libbb/sysconf.c b/libbb/sysconf.c index 031901980..cfad9cdc0 100644 --- a/libbb/sysconf.c +++ b/libbb/sysconf.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include "libbb.h" | 9 | #include "libbb.h" |
10 | 10 | ||
11 | #if !defined(ARG_MAX) && defined(_SC_ARG_MAX) | 11 | #if !defined(bb_arg_max) |
12 | unsigned FAST_FUNC bb_arg_max(void) | 12 | unsigned FAST_FUNC bb_arg_max(void) |
13 | { | 13 | { |
14 | return sysconf(_SC_ARG_MAX); | 14 | return sysconf(_SC_ARG_MAX); |