mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
import ports/sysutils/cpuid-tycho, ok tb
"cpuid" dumps results from the x86 CPUID instruction, and decodes information from certain leaves. NOTE: the code in this software to bind to a specific CPU is non functional on OpenBSD; if you are trying to find information from different cores, you'll need to run it multiple times until the process is scheduled on the core of interest.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
COMMENT= dump and decode x86 CPUID information
|
||||
|
||||
GH_ACCOUNT= tycho
|
||||
GH_PROJECT= cpuid
|
||||
GH_TAGNAME= 1.8.3
|
||||
PKGNAME= cpuid-tycho-${GH_TAGNAME}
|
||||
|
||||
CATEGORIES= sysutils
|
||||
|
||||
MAINTAINER= Stuart Henderson <sthen@openbsd.org>
|
||||
|
||||
# ISC
|
||||
PERMIT_PACKAGE= Yes
|
||||
|
||||
WANTLIB += c pthread
|
||||
|
||||
MODULES= devel/meson
|
||||
NO_TEST= Yes
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKBUILD}/cpuid ${PREFIX}/bin/cpuid-tycho
|
||||
|
||||
.include <bsd.port.mk>
|
||||
@@ -0,0 +1,2 @@
|
||||
SHA256 (cpuid-1.8.3.tar.gz) = 1+3SdxR2qrL1a6lQvgsEM9wTb9gnUH6B2aaLg62qGpo=
|
||||
SIZE (cpuid-1.8.3.tar.gz) = 65351
|
||||
@@ -0,0 +1,15 @@
|
||||
Index: GNUmakefile
|
||||
--- GNUmakefile.orig
|
||||
+++ GNUmakefile
|
||||
@@ -7,6 +7,11 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo
|
||||
prefix := /usr/local
|
||||
bindir := $(prefix)/bin
|
||||
|
||||
+ifeq ($(uname_S),OpenBSD)
|
||||
+CFLAGS += -pthread
|
||||
+LDFLAGS += -pthread
|
||||
+endif
|
||||
+
|
||||
ifneq ($(findstring MINGW,$(uname_S)),)
|
||||
win32 = Yep
|
||||
endif
|
||||
@@ -0,0 +1,39 @@
|
||||
Index: threads.c
|
||||
--- threads.c.orig
|
||||
+++ threads.c
|
||||
@@ -49,13 +49,15 @@
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
-#elif defined(TARGET_OS_SOLARIS)
|
||||
+#elif defined(TARGET_OS_SOLARIS) || defined(TARGET_OS_OPENBSD)
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
+#if defined(TARGET_OS_SOLARIS)
|
||||
#include <sys/processor.h>
|
||||
#include <sys/procset.h>
|
||||
+#endif
|
||||
|
||||
|
||||
#elif defined(TARGET_OS_MACOSX)
|
||||
@@ -116,7 +118,7 @@ uint32_t thread_count_native(struct cpuid_state_t *sta
|
||||
return 1;
|
||||
|
||||
return count;
|
||||
-#elif defined(TARGET_OS_SOLARIS)
|
||||
+#elif defined(TARGET_OS_SOLARIS) || defined(TARGET_OS_OPENBSD)
|
||||
long count;
|
||||
|
||||
if ((count = sysconf(_SC_NPROCESSORS_ONLN)) == -1)
|
||||
@@ -289,7 +291,8 @@ int thread_bind_native(__unused_variable struct cpuid_
|
||||
|
||||
return ret == 0 ? 0 : 1;
|
||||
#else
|
||||
-#error "thread_bind_native() not defined for this platform"
|
||||
+#warning "thread_bind_native() not defined for this platform"
|
||||
+ return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
"cpuid" dumps results from the x86 CPUID instruction, and decodes
|
||||
information from certain leaves.
|
||||
|
||||
NOTE: the code in this software to bind to a specific CPU is non functional
|
||||
on OpenBSD; if you are trying to find information from different cores, you'll
|
||||
need to run it multiple times until the process is scheduled on the core of
|
||||
interest.
|
||||
@@ -0,0 +1 @@
|
||||
@bin bin/cpuid-tycho
|
||||
Reference in New Issue
Block a user