diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-04-18 00:31:03 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-04-18 00:31:03 +0200 |
commit | 4b24c5ad368d0312dbb9cfd6e028a3b21bba48cd (patch) | |
tree | 95cc3d80b9969a3b7b5cf79cab6b28a15450776b | |
parent | 1d57dcdd9b43c8d7bb2dddf4bfecc95567641a07 (diff) |
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 <rep.dot.nop@gmail.com>
-rw-r--r-- | libc/unistd/sysconf.c | 14 |
1 files changed, 6 insertions, 8 deletions
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 <sys/syscall.h> #include <sys/sysinfo.h> #include <sys/types.h> +#include <sys/param.h> #ifdef __UCLIBC_HAS_REGEX__ #include <regex.h> #endif #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <sysdep.h> -#include <sys/resource.h> - #endif +#include <sys/resource.h> #include <string.h> #include <dirent.h> #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: |