Date: Tue, 9 Dec 2014 22:07:14 +0000 (UTC) From: Max Brazhnikov <makc@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r374435 - in head/sysutils: . cpuid cpuid/files Message-ID: <201412092207.sB9M7Et5028882@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: makc Date: Tue Dec 9 22:07:14 2014 New Revision: 374435 URL: https://svnweb.freebsd.org/changeset/ports/374435 QAT: https://qat.redports.org/buildarchive/r374435/ Log: Add new port sysutils/cpuid: tool to dump x86 CPUID information. WWW: http://www.etallen.com/cpuid.html The package and the binary have been renamed to cpuid-etallen in order to avoid conflict with misc/cpuid. PR: 194826 Submitted by: Uffe Jakobsen Added: head/sysutils/cpuid/ head/sysutils/cpuid/Makefile (contents, props changed) head/sysutils/cpuid/distinfo (contents, props changed) head/sysutils/cpuid/files/ head/sysutils/cpuid/files/patch-cpuid.c (contents, props changed) head/sysutils/cpuid/pkg-descr (contents, props changed) Modified: head/sysutils/Makefile Modified: head/sysutils/Makefile ============================================================================== --- head/sysutils/Makefile Tue Dec 9 22:06:20 2014 (r374434) +++ head/sysutils/Makefile Tue Dec 9 22:07:14 2014 (r374435) @@ -149,6 +149,7 @@ SUBDIR += cpdup SUBDIR += cpu SUBDIR += cpuburn + SUBDIR += cpuid SUBDIR += cpulimit SUBDIR += cramfs SUBDIR += crashme Added: head/sysutils/cpuid/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpuid/Makefile Tue Dec 9 22:07:14 2014 (r374435) @@ -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> Added: head/sysutils/cpuid/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpuid/distinfo Tue Dec 9 22:07:14 2014 (r374435) @@ -0,0 +1,2 @@ +SHA256 (cpuid-20140123.src.tar.gz) = b85aba5696d382f0dba8dc246bd42d09767089d6181a9cd0633d626f079d79ff +SIZE (cpuid-20140123.src.tar.gz) = 67882 Added: head/sysutils/cpuid/files/patch-cpuid.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpuid/files/patch-cpuid.c Tue Dec 9 22:07:14 2014 (r374435) @@ -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)); Added: head/sysutils/cpuid/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpuid/pkg-descr Tue Dec 9 22:07:14 2014 (r374435) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412092207.sB9M7Et5028882>