aboutsummaryrefslogtreecommitdiff
path: root/sysutils/cpuid
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2020-01-26 16:14:00 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2020-01-26 16:14:00 +0000
commit076406d760ff16823e4fdc8b958d40ddcb451a6a (patch)
treec8d39e6abbca200af1339bddd5644d71ae77c8e3 /sysutils/cpuid
parente42012b56a8b1212e9591c610c23145af23a4c91 (diff)
downloadports-076406d760ff16823e4fdc8b958d40ddcb451a6a.tar.gz
ports-076406d760ff16823e4fdc8b958d40ddcb451a6a.zip
sysutils/cpuid: adjust patch
Notes
Notes: svn path=/head/; revision=524210
Diffstat (limited to 'sysutils/cpuid')
-rw-r--r--sysutils/cpuid/files/patch-cpuid.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/sysutils/cpuid/files/patch-cpuid.c b/sysutils/cpuid/files/patch-cpuid.c
index 9ff83057649b..5898fafa1ca9 100644
--- a/sysutils/cpuid/files/patch-cpuid.c
+++ b/sysutils/cpuid/files/patch-cpuid.c
@@ -1,6 +1,6 @@
---- cpuid.c.orig 2018-04-19 14:15:07 UTC
+--- cpuid.c.orig 2020-01-22 16:55:23 UTC
+++ cpuid.c
-@@ -21,17 +21,19 @@
+@@ -33,12 +33,15 @@
#ifdef __linux__
#define USE_CPUID_MODULE
#define USE_KERNEL_SCHED_SETAFFINITY
@@ -13,7 +13,10 @@
+#define CPUID_MAJOR 0
+
- #define _GNU_SOURCE
+ #if defined(__GNUC__)
+ #define UNUSED __attribute((unused))
+ #else
+@@ -49,7 +52,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -21,26 +24,18 @@
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
-@@ -39,6 +41,8 @@
+@@ -57,6 +59,8 @@
#include <string.h>
#include <regex.h>
#include <getopt.h>
+#include <pthread.h>
+#include <pthread_np.h>
- #ifdef USE_CPUID_MODULE
- #include <linux/major.h>
-@@ -67,6 +71,7 @@ typedef const char* const ccstring;
- #define XSTR(x) STR(x)
-
-
-+#undef MAX
- #define MAX(l,r) ((l) > (r) ? (l) : (r))
-
- #define LENGTH(array, type) (sizeof(array) / sizeof(type))
-@@ -6622,11 +6627,16 @@ real_setup(unsigned int cpu,
- int status;
- status = syscall(__NR_sched_setaffinity, 0, sizeof(mask), &mask);
+ #if defined(__sun)
+ #include <sys/processor.h>
+@@ -8123,12 +8127,17 @@ real_setup(unsigned int cpu,
+ pthread_t thread = pthread_self();
+ int status = processor_bind(P_LWPID, thread, cpu, NULL);
#else
- cpu_set_t cpuset;
+ cpuset_t cpuset;
@@ -53,11 +48,12 @@
+ -1, sizeof(cpuset_t), &cpuset);
+#else
+ status = sched_setaffinity(0, sizeof(cpuset_t), &cpuset);
-+#endif
#endif
++#endif
if (status == -1) {
if (cpu > 0) {
-@@ -6749,11 +6759,14 @@ static int real_get (int cpuid
+ if (errno == EINVAL) return -1;
+@@ -8250,11 +8259,14 @@ static int real_get (int cpuid_fd,
"c" (ecx));
#endif
} else {
@@ -75,7 +71,7 @@
if (result == -1) {
if (quiet) {
return FALSE;
-@@ -7307,7 +7320,7 @@ main(int argc,
+@@ -8819,7 +8831,7 @@ main(int argc,
};
boolean opt_one_cpu = FALSE;
@@ -84,7 +80,7 @@
boolean opt_kernel = FALSE;
boolean opt_raw = FALSE;
boolean opt_debug = FALSE;
-@@ -7437,7 +7450,8 @@ main(int argc,
+@@ -8950,7 +8962,8 @@ main(int argc,
}
// Default to -i. So use inst unless -k is specified.