summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/sysconf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-03-27 15:20:38 +0000
committerUlrich Drepper <drepper@redhat.com>2008-03-27 15:20:38 +0000
commitf96853beafc26d4f030961b0b67a79b5bfad5733 (patch)
treea8480225d97a7eeeccee963ce5a7bae53d296dba /sysdeps/unix/sysv/linux/sysconf.c
parentfde15fdc5bea3d66be8fa967031ab89707b08a39 (diff)
downloadglibc-f96853beafc26d4f030961b0b67a79b5bfad5733.tar.gz
* sysdeps/unix/sysv/linux/bits/local_lim.h: Undefined ARG_MAX if
<linux/limits.h> 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.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sysconf.c')
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c9
1 files changed, 7 insertions, 2 deletions
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 <not-cancel.h>
#include <ldsodefs.h>
+/* 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