summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sysconf.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2010-01-15 08:35:47 +0000
committersthen <sthen@openbsd.org>2010-01-15 08:35:47 +0000
commit90f4297444e37ba585109707efd9d69359174344 (patch)
tree41f9553a16224413cf5bf4ac3dce4be160d7e672 /lib/libc/gen/sysconf.c
parentOops. Respect the various IGNORE flags when not in SCSIDEBUG mode. (diff)
downloadwireguard-openbsd-90f4297444e37ba585109707efd9d69359174344.tar.xz
wireguard-openbsd-90f4297444e37ba585109707efd9d69359174344.zip
Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD. Bump libc minor. From Brad, ok deraadt@ guenther@
Diffstat (limited to 'lib/libc/gen/sysconf.c')
-rw-r--r--lib/libc/gen/sysconf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index ea5eff13a53..97adeed047c 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysconf.c,v 1.10 2008/06/25 14:54:44 millert Exp $ */
+/* $OpenBSD: sysconf.c,v 1.11 2010/01/15 08:35:47 sthen Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -238,6 +238,15 @@ yesno: if (sysctl(mib, namelen, &value, &len, NULL, 0) == -1)
return (vmtotal.t_free);
}
+ case _SC_NPROCESSORS_CONF:
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ break;
+ case _SC_NPROCESSORS_ONLN:
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ break;
+
default:
errno = EINVAL;
return (-1);