diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:22:27 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:22:27 +0000 |
commit | b87b7fc3e6e41cf8006fb2341c236a46f6d8bdd4 (patch) | |
tree | 8b042dd05d766dd46dfa953aec240207eae14208 /sysdeps/unix/sysv/linux/sysconf.c | |
parent | 5c25449dd9fd706f79ee6d92019f28044d9270fa (diff) |
Updated to fedora-glibc-20080310T1651
Diffstat (limited to 'sysdeps/unix/sysv/linux/sysconf.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/sysconf.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index f9f6f1bfa5..ab9cddc306 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -1,5 +1,5 @@ /* Get file-specific information about a file. Linux version. - Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,9 @@ #include <sysdep.h> #include <time.h> #include <unistd.h> +#include <sys/resource.h> #include <not-cancel.h> +#include <ldsodefs.h> static long int posix_sysconf (int name); @@ -70,6 +72,22 @@ __sysconf (int name) } #endif + case _SC_ARG_MAX: +#if __LINUX_KERNEL_VERSION < 0x020617 + /* Determine whether this is a kernel 2.6.23 or later. Only + then do we have an argument limit determined by the stack + size. */ + if (GLRO(dl_discover_osversion) () >= 0x020617) +#endif + { + /* 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 ARG_MAX; + case _SC_NGROUPS_MAX: /* Try to read the information from the /proc/sys/kernel/ngroups_max file. */ |