summaryrefslogtreecommitdiff
path: root/sysutils/x86info/files/patch-x86info.c
diff options
context:
space:
mode:
authorYing-Chieh Liao <ijliao@FreeBSD.org>2001-10-14 18:13:23 +0000
committerYing-Chieh Liao <ijliao@FreeBSD.org>2001-10-14 18:13:23 +0000
commit0b278f3c0b570f992bb51549ec44443b1ed0f7c8 (patch)
tree8865a6d4516679895ea50eb42e843ffe4097fd6f /sysutils/x86info/files/patch-x86info.c
parentRemove prototype, so it still compiles under CURRENT (diff)
add x86info
Utility to display information about the systems x86 processor(s) PR: 30116 Submitted by: Erik Greenwald <erik@smluc.org>
Notes
Notes: svn path=/head/; revision=48763
Diffstat (limited to 'sysutils/x86info/files/patch-x86info.c')
-rw-r--r--sysutils/x86info/files/patch-x86info.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/sysutils/x86info/files/patch-x86info.c b/sysutils/x86info/files/patch-x86info.c
new file mode 100644
index 000000000000..a0e8551559d4
--- /dev/null
+++ b/sysutils/x86info/files/patch-x86info.c
@@ -0,0 +1,35 @@
+--- x86info.c.orig Mon Oct 15 02:04:23 2001
++++ x86info.c Mon Oct 15 02:06:27 2001
+@@ -11,6 +11,10 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#ifndef linux
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
+ #include "x86info.h"
+
+ int show_msr=0;
+@@ -89,7 +93,21 @@
+ return(0);
+ }
+
++#if defined _SC_NPROCESSORS /* linux */
+ nrCPUs = sysconf (_SC_NPROCESSORS_CONF);
++#elif defined HW_NCPU /* bsd */
++ {
++ int mib[2] = { CTL_HW, HW_NCPU };
++ size_t len;
++
++ len = sizeof(nrCPUs);
++ sysctl(mib, 2, &nrCPUs, &len, NULL, 0);
++ }
++#else
++ /* unknown interface to count cpu's */
++ nrCPUs=1;
++#endif
++
+ printf ("Found %d CPU", nrCPUs);
+ if (nrCPUs > 1)
+ printf ("s");