diff options
Diffstat (limited to 'sysutils/x86info/files/patch-cpuid.c')
-rw-r--r-- | sysutils/x86info/files/patch-cpuid.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/sysutils/x86info/files/patch-cpuid.c b/sysutils/x86info/files/patch-cpuid.c index 6a3977c4661a..e2444f6b54d5 100644 --- a/sysutils/x86info/files/patch-cpuid.c +++ b/sysutils/x86info/files/patch-cpuid.c @@ -1,7 +1,7 @@ ---- cpuid.c.orig 2007-11-27 03:37:20.000000000 +0300 -+++ cpuid.c 2008-08-09 23:02:57.000000000 +0400 -@@ -21,8 +21,15 @@ - #include <errno.h> +--- cpuid.c.orig 2008-12-16 22:09:47.000000000 +0300 ++++ cpuid.c 2008-12-30 22:36:09.000000000 +0300 +@@ -23,8 +23,15 @@ + #include <sched.h> #if defined(__FreeBSD__) +# include <sys/param.h> @@ -17,7 +17,31 @@ #endif #include "x86info.h" -@@ -38,7 +45,11 @@ +@@ -33,7 +40,9 @@ + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) + { ++#if defined(__linux__) + cpu_set_t set; ++#endif + unsigned int a = 0, b = 0, c = 0, d = 0; + + if (eax != NULL) +@@ -45,11 +54,13 @@ + if (edx != NULL) + d = *edx; + ++#if defined(__linux__) + if (sched_getaffinity(getpid(), sizeof(set), &set) == 0) { + CPU_ZERO(&set); + CPU_SET(cpunr, &set); + sched_setaffinity(getpid(), sizeof(set), &set); + } ++#endif + + asm("cpuid" + : "=a" (a), +@@ -79,7 +90,11 @@ char cpuname[20]; unsigned char buffer[16]; int fh; @@ -27,9 +51,9 @@ + cpuctl_cpuid_args_t args; +#endif - if (nodriver==1) { - cpuid_UP(idx, eax, ebx, ecx, edx); -@@ -47,10 +58,14 @@ + if (nodriver == 1) { + native_cpuid(CPU_number, idx, eax,ebx,ecx,edx); +@@ -88,10 +103,14 @@ args.level = idx; /* Ok, use the /dev/CPU interface in preference to the _up code. */ @@ -45,7 +69,16 @@ perror(cpuname); exit(EXIT_FAILURE); } -@@ -107,7 +122,7 @@ +@@ -106,8 +125,6 @@ + } else { + /* Something went wrong, just do UP and hope for the best. */ + nodriver = 1; +- if (!silent && nrCPUs != 1) +- perror(cpuname); + used_UP = 1; + native_cpuid(CPU_number, idx, eax,ebx,ecx,edx); + return; +@@ -154,7 +171,7 @@ fh = open(cpuname, O_RDONLY); if (fh != -1) { #ifndef S_SPLINT_S |