diff options
author | kib <kib@FreeBSD.org> | 2012-06-27 20:32:45 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-06-27 20:32:45 +0000 |
commit | d4c1a42e53ebc1cf06858005a608e33c0bcc2200 (patch) | |
tree | 7276bd66461f5dd37de84dd1e6646b95fc2bdebd /lib/libc | |
parent | 5c55d5df9a42e9d7b7a8f54bab5b9002e76be4c6 (diff) | |
download | FreeBSD-src-d4c1a42e53ebc1cf06858005a608e33c0bcc2200.zip FreeBSD-src-d4c1a42e53ebc1cf06858005a608e33c0bcc2200.tar.gz |
Optimize the handling of SC_NPROCESSORS_CONF, by using auxv AT_NCPU
value if present.
MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/sysconf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index 80ae626..2d117b7 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/resource.h> #include <sys/socket.h> +#include <elf.h> #include <errno.h> #include <limits.h> #include <paths.h> @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include "../stdlib/atexit.h" #include "tzfile.h" /* from ../../../contrib/tzcode/stdtime */ +#include "libc_private.h" #define _PATH_ZONEINFO TZDIR /* from tzfile.h */ @@ -585,6 +587,8 @@ yesno: case _SC_NPROCESSORS_CONF: case _SC_NPROCESSORS_ONLN: + if (_elf_aux_info(AT_NCPUS, &value, sizeof(value)) == 0) + return ((long)value); mib[0] = CTL_HW; mib[1] = HW_NCPU; break; |