summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2010-01-15 08:35:48 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2010-01-15 08:35:48 +0000
commit5f77024f4850b48be48673b098d74f34d773f84e (patch)
tree7b29a21495f52012a3a36a4301a55364fd3dfa68 /lib/libc
parent7ca00293fe269668390b0afce07991b5b225883e (diff)
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')
-rw-r--r--lib/libc/gen/sysconf.313
-rw-r--r--lib/libc/gen/sysconf.c11
-rw-r--r--lib/libc/shlib_version2
3 files changed, 22 insertions, 4 deletions
diff --git a/lib/libc/gen/sysconf.3 b/lib/libc/gen/sysconf.3
index 38ed8d1d09e..e5f3caf10d1 100644
--- a/lib/libc/gen/sysconf.3
+++ b/lib/libc/gen/sysconf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysconf.3,v 1.25 2008/06/25 17:45:07 jmc Exp $
+.\" $OpenBSD: sysconf.3,v 1.26 2010/01/15 08:35:47 sthen Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 25 2008 $
+.Dd $Mdocdate: January 15 2010 $
.Dt SYSCONF 3
.Os
.Sh NAME
@@ -168,6 +168,10 @@ functions.
The maximum length of a login name.
.It Li _SC_THREAD_SAFE_FUNCTIONS
The level of support for thread-safe (re-entrant) functions.
+.It Li _SC_NPROCESSORS_CONF
+The number of processors configured.
+.It Li _SC_NPROCESSORS_ONLN
+The number of processors online (capable of running processes).
.El
.Sh RETURN VALUES
If the call to
@@ -202,6 +206,11 @@ The
.Fn sysconf
function conforms to
.St -p1003.1-88 .
+The constants
+.Li _SC_NPROCESSORS_CONF
+and
+.Li _SC_NPROCESSORS_ONLN
+are not part of the standard, but are provided by many systems.
.Sh HISTORY
The
.Fn sysconf
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);
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 5db4ec0a7ac..b6d2a137e28 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,4 +1,4 @@
major=53
-minor=0
+minor=1
# note: If changes were made to include/thread_private.h or if system
# calls were added/changed then libpthread must also be updated.