aboutsummaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorMax Brazhnikov <makc@FreeBSD.org>2014-12-09 22:07:14 +0000
committerMax Brazhnikov <makc@FreeBSD.org>2014-12-09 22:07:14 +0000
commitb3893e6f336814576106ad1810eefa2821c93090 (patch)
treeeda3e792ac13c7935bf26fd8cf49e538b467c418 /sysutils
parentadae686ff446fbc09b7541ca2c1ad9bf2dca0081 (diff)
Notes
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/cpuid/Makefile34
-rw-r--r--sysutils/cpuid/distinfo2
-rw-r--r--sysutils/cpuid/files/patch-cpuid.c75
-rw-r--r--sysutils/cpuid/pkg-descr6
5 files changed, 118 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index b78d65bc1c84..61a23c097df4 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -149,6 +149,7 @@
SUBDIR += cpdup
SUBDIR += cpu
SUBDIR += cpuburn
+ SUBDIR += cpuid
SUBDIR += cpulimit
SUBDIR += cramfs
SUBDIR += crashme
diff --git a/sysutils/cpuid/Makefile b/sysutils/cpuid/Makefile
new file mode 100644
index 000000000000..91637496018f
--- /dev/null
+++ b/sysutils/cpuid/Makefile
@@ -0,0 +1,34 @@
+# Created by: uffe@uffe.org
+# $FreeBSD$
+
+PORTNAME= cpuid
+PORTVERSION= 20140123
+CATEGORIES= sysutils
+MASTER_SITES= http://www.etallen.com/cpuid/
+PKGNAMESUFFIX= ${CPUID_SUFFIX}
+DISTNAME= ${PORTNAME}-${PORTVERSION}.src
+
+MAINTAINER= uffe@uffe.org
+COMMENT= Tool to dump x86 CPUID information about the CPU(s)
+
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= gmake
+ALL_TARGET= default
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
+
+# Renamed to avoid conflict with misc/cpuid
+CPUID_SUFFIX= -etallen
+
+PLIST_FILES= bin/cpuid${CPUID_SUFFIX} \
+ man/man1/cpuid${CPUID_SUFFIX}.1.gz
+
+post-patch:
+ ${REINPLACE_CMD} 's,CFL=.*,& -pthread,' ${WRKSRC}/Makefile
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/cpuid ${STAGEDIR}${PREFIX}/bin/cpuid${CPUID_SUFFIX}
+ ${INSTALL_MAN} ${WRKSRC}/cpuid.man.gz ${STAGEDIR}${PREFIX}/man/man1/cpuid${CPUID_SUFFIX}.1.gz
+
+.include <bsd.port.mk>
diff --git a/sysutils/cpuid/distinfo b/sysutils/cpuid/distinfo
new file mode 100644
index 000000000000..057758fe0d62
--- /dev/null
+++ b/sysutils/cpuid/distinfo
@@ -0,0 +1,2 @@
+SHA256 (cpuid-20140123.src.tar.gz) = b85aba5696d382f0dba8dc246bd42d09767089d6181a9cd0633d626f079d79ff
+SIZE (cpuid-20140123.src.tar.gz) = 67882
diff --git a/sysutils/cpuid/files/patch-cpuid.c b/sysutils/cpuid/files/patch-cpuid.c
new file mode 100644
index 000000000000..04f30acf438a
--- /dev/null
+++ b/sysutils/cpuid/files/patch-cpuid.c
@@ -0,0 +1,75 @@
+--- cpuid.c.orig 2014-01-24 01:26:27 UTC
++++ cpuid.c
+@@ -17,6 +17,8 @@
+ ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
++#define CPUID_MAJOR 0
++
+ #define _GNU_SOURCE
+ #include <stdio.h>
+ #include <sys/types.h>
+@@ -26,11 +28,14 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/major.h>
++//#include <linux/major.h>
+ #include <regex.h>
+ #include <getopt.h>
+ #include <sys/syscall.h>
+
++#include <pthread.h>
++#include <pthread_np.h>
++
+ typedef int boolean;
+ #define TRUE 1
+ #define FALSE 0
+@@ -5877,7 +5882,8 @@ real_setup(unsigned int cpu,
+ = (1 << cpu % (sizeof(unsigned int)*8));
+
+ int status;
+- status = syscall(__NR_sched_setaffinity, 0, sizeof(mask), &mask);
++ //status = syscall(__NR_sched_setaffinity, 0, sizeof(mask), &mask);
++ status = pthread_setaffinity_np(0, sizeof(mask), &mask);
+ if (status == -1) {
+ if (cpu > 0) {
+ if (errno == EINVAL) return -1;
+@@ -5987,11 +5993,14 @@ static int real_get (int cpuid
+ : "a" (reg),
+ "c" (ecx));
+ } else {
+- off64_t result;
+- off64_t offset = ((off64_t)ecx << 32) + reg;
++ //off64_t result;
++ //off64_t offset = ((uint64_t)ecx << 32) + reg;
++ uint64_t result;
++ uint64_t offset = ((uint64_t)ecx << 32) + reg;
+ int status;
+
+- result = lseek64(cpuid_fd, offset, SEEK_SET);
++ //result = lseek64(cpuid_fd, offset, SEEK_SET);
++ result = lseek(cpuid_fd, offset, SEEK_SET);
+ if (result == -1) {
+ if (quiet) {
+ return FALSE;
+@@ -6432,7 +6441,8 @@ main(int argc,
+ };
+
+ boolean opt_one_cpu = FALSE;
+- boolean opt_inst = FALSE;
++ //boolean opt_inst = FALSE;
++ boolean opt_inst = TRUE;
+ boolean opt_kernel = FALSE;
+ boolean opt_raw = FALSE;
+ boolean opt_debug = FALSE;
+@@ -6508,7 +6518,8 @@ main(int argc,
+ }
+
+ // Default to -i. So use inst unless -k is specified.
+- boolean inst = !opt_kernel;
++ //boolean inst = !opt_kernel;
++ boolean inst = TRUE;
+
+ if (opt_version) {
+ printf("cpuid version %s\n", XSTR(VERSION));
diff --git a/sysutils/cpuid/pkg-descr b/sysutils/cpuid/pkg-descr
new file mode 100644
index 000000000000..326368535e90
--- /dev/null
+++ b/sysutils/cpuid/pkg-descr
@@ -0,0 +1,6 @@
+Cpuid dumps detailed information about the CPU(s) gathered from the
+CPUID instruction, and also determines the exact model of CPU(s).
+It supports Intel, AMD, and VIA CPUs, as well as older Transmeta,
+Cyrix, UMC, NexGen, Rise, and SiS CPUs.
+
+WWW: http://www.etallen.com/cpuid.html