From 4b24c5ad368d0312dbb9cfd6e028a3b21bba48cd Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 18 Apr 2012 00:31:03 +0200 Subject: sysconf: use getrlimit to determine ARG_MAX getrlimit previously was only called for NPTL (why?), fix that to be used everywhere. Signed-off-by: Bernhard Reutner-Fischer --- libc/unistd/sysconf.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libc/unistd') diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index c1b3c86db..c049dc98d 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -31,14 +31,14 @@ #include #include #include +#include #ifdef __UCLIBC_HAS_REGEX__ #include #endif #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include -#include - #endif +#include #include #include #include "internal/parse_config.h" @@ -154,9 +154,8 @@ static int nprocessors_conf(void) /* Get the value of the system variable NAME. */ long int sysconf(int name) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - struct rlimit rlimit; -#endif + struct rlimit rlimit; + switch (name) { default: @@ -164,14 +163,13 @@ long int sysconf(int name) return -1; case _SC_ARG_MAX: -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ /* Use getrlimit to get the stack limit. */ if (getrlimit (RLIMIT_STACK, &rlimit) == 0) return MAX (legacy_ARG_MAX, rlimit.rlim_cur / 4); -#elif defined ARG_MAX +#if defined ARG_MAX return ARG_MAX; #else - RETURN_NEG_1; + return legacy_ARG_MAX; #endif case _SC_CHILD_MAX: -- cgit v1.2.3