Date: Wed, 28 Nov 2001 22:18:41 -0800 (PST) From: jkoshy@FreeBSD.ORG (Joseph Koshy) To: freebsd-audit@FreeBSD.ORG Subject: [PATCH] Support for _SC_NPROCESSORS_{CONF,ONLN} Message-ID: <20011129061841.7CC5437B427@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
This is a multipart MIME message. --==_Exmh_-19242870810 Content-Type: text/plain For review: `sysconf(3)' names _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN allow a user program to query the number of processors on a multiprocessor system. _SC_PROCESSORS_CONF queries the number of configured processors and _SC_NPROCESSORS_ONLN queries the number of currently online processors. This API is supported in SVR4.0MP, AIX, Solaris, Tru64 and Linux. [Original patch in PR bin/27489] Regards, Koshy --==_Exmh_-19242870810 Content-Type: text/plain ; name="foo" Content-Description: foo Content-Disposition: attachment; filename="foo" Index: sys/sys/unistd.h =================================================================== RCS file: /home/ncvs/src/sys/sys/unistd.h,v retrieving revision 1.27 diff -u -r1.27 unistd.h --- sys/sys/unistd.h 18 Jun 2001 20:24:54 -0000 1.27 +++ sys/sys/unistd.h 29 Nov 2001 11:52:37 -0000 @@ -200,6 +200,10 @@ #define _SC_IOV_MAX 56 +/* Solaris/AIX/SVR4.0MP API */ +#define _SC_NPROCESSORS_CONF 57 +#define _SC_NPROCESSORS_ONLN 58 + #ifndef _POSIX_SOURCE /* * rfork() options. Index: lib/libc/gen//sysconf.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/sysconf.3,v retrieving revision 1.16 diff -u -r1.16 sysconf.3 --- lib/libc/gen//sysconf.3 1 Oct 2001 16:08:51 -0000 1.16 +++ lib/libc/gen//sysconf.3 29 Nov 2001 11:13:11 -0000 @@ -83,6 +83,10 @@ .Xr sendmsg 2 . .It Li _SC_NGROUPS_MAX The maximum number of supplemental groups. +.It Li _SC_NPROCESSORS_CONF +The number of processors configured. +.It Li _SC_NPROCESSORS_ONLN +The number of processors currently online. .It Li _SC_OPEN_MAX The maximum number of open files per user id. .It Li _SC_STREAM_MAX Index: lib/libc/gen//sysconf.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/sysconf.c,v retrieving revision 1.11 diff -u -r1.11 sysconf.c --- lib/libc/gen//sysconf.c 18 Jun 2001 20:24:24 -0000 1.11 +++ lib/libc/gen//sysconf.c 29 Nov 2001 11:18:55 -0000 @@ -290,6 +290,14 @@ goto yesno; #endif /* _P1003_1B_VISIBLE */ +#if defined(_SC_NPROCESSORS_CONF) && defined(_SC_NPROCESSORS_ONLN) + case _SC_NPROCESSORS_CONF: + case _SC_NPROCESSORS_ONLN: + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + break; +#endif + #ifdef _SC_IOV_MAX case _SC_IOV_MAX: mib[0] = CTL_KERN; --==_Exmh_-19242870810-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011129061841.7CC5437B427>