From f96853beafc26d4f030961b0b67a79b5bfad5733 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 27 Mar 2008 15:20:38 +0000 Subject: * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefined ARG_MAX if has defined it. * sysdeps/unix/sysv/linux/sys/param.h: Define NCARGS to the legacy ARG_MAX value and prevent ARG_MAX from being defined by the kernel headers. * sysdeps/unix/sysv/linux/sysconf.c: Define legacy_ARG_MAX and use it instead of ARG_MAX. --- sysdeps/unix/sysv/linux/sysconf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sysdeps/unix/sysv/linux/sysconf.c') diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index ab9cddc306..f4e36e0c6f 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -27,6 +27,11 @@ #include #include +/* Legacy value of ARG_MAX. The macro is now not defined since the + actual value varies based on the stack size. */ +#define legacy_ARG_MAX 131072 + + static long int posix_sysconf (int name); @@ -83,10 +88,10 @@ __sysconf (int name) /* Use getrlimit to get the stack limit. */ struct rlimit rlimit; if (__getrlimit (RLIMIT_STACK, &rlimit) == 0) - return MAX (ARG_MAX, rlimit.rlim_cur / 4); + return MAX (legacy_ARG_MAX, rlimit.rlim_cur / 4); } - return ARG_MAX; + return legacy_ARG_MAX; case _SC_NGROUPS_MAX: /* Try to read the information from the /proc/sys/kernel/ngroups_max -- cgit v1.2.3-70-g09d2