2014-06-19 12:41 GMT+02:00 Denys Vlasenko <[email protected]>: > On Wed, Jun 18, 2014 at 10:11 PM, Bartosz Golaszewski > <[email protected]> wrote: >> +long FAST_FUNC bb_sc_arg_max(void) >> +{ >> +#if defined _SC_ARG_MAX >> + return sysconf(_SC_ARG_MAX) - 2048; >> +#elif defined ARG_MAX >> + return ARG_MAX - 2048; >> +#else >> + return 32 * 1024; >> +#endif >> +} > > If ARG_MAX is defined, it will be a function which returns constant. > Not optimal wrt size.
True, probably should have been like this in include/libbb.h: #if defined _SC_ARG_MAX long bb_sc_arg_max(void) FAST_FUNC; #elif defined ARG_MAX #define bb_sc_arg_max() (ARG_MAX) // ^^^ No need to substract 2048 according to linux/limits.h comments on my system #elif #define bb_sc_arg_max() (32 * 1024) #endif or maybe even: #if defined _SC_ARG_MAX long bb_sc_arg_max(void) FAST_FUNC; #define BB_ARG_MAX (bb_sc_arg_max()) #elif defined ARG_MAX #define BB_ARG_MAX (ARG_MAX) // ^^^ No need to substract 2048 according to comments // in linux/limits.h on my system #elif #define BB_ARG_MAX (32 * 1024) #endif But there is still an issue - we never include <linux/limits.h> where ARG_MAX is defined - probably should add it to platform.h. I'll resubmit the patch in the evening. Bartosz Gołaszewski _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
