[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Updated patch for x86info



Hello,

Attached is an updated patch to make x86info functional with GNU/Hurd.
The only difference with the previous patch is in the debian/control
file to make it installable on a Hurd system where makedev and udev are
not available. As promised by Samuel Thibault this package will be
hosted at deban-ports, since the Debian maintainer refuses to accept
patches regarding non-released architectures, unless upstream is merging
it. 

When patches for atlas have been accepted, x86info will the a build
dependency for that package to estimate CPU-specific information, such
as clock speed, number of processor threads, etc.

A Cc: is sent to upstream to figure out the interest of adding support
for GNU/Hurd in this package. The upstream changes are solely in
cpuid.c, the rest is Debian specific.

Thanks!
diff -ur x86info-1.30/cpuid.c x86info-1.30.new/cpuid.c
--- x86info-1.30/cpuid.c	2011-12-09 17:06:57.000000000 +0100
+++ x86info-1.30.new/cpuid.c	2012-09-05 17:51:50.000000000 +0200
@@ -45,9 +45,13 @@
 	unsigned int *eax, unsigned int *ebx,
 	unsigned int *ecx, unsigned int *edx)
 {
+#ifdef __GNU__
+	cpu_set_t set;
+#else
 	cpu_set_t set, tmp_set;
-	unsigned int a = 0, b = 0, c = 0, d = 0;
 	int ret;
+#endif
+	unsigned int a = 0, b = 0, c = 0, d = 0;
 
 	if (eax != NULL)
 		a = *eax;
@@ -58,6 +62,10 @@
 	if (edx != NULL)
 		d = *edx;
 
+#ifdef __GNU__
+	CPU_ZERO(&set);
+	CPU_SET(cpunr, &set);
+#else
 	ret = sched_getaffinity(getpid(), sizeof(set), &set);
 	if (ret)
 		return ret;
@@ -69,6 +77,7 @@
 	ret = sched_setaffinity(getpid(), sizeof(set), &set);
 	if (ret)
 		return ret;
+#endif
 
 	asm("cpuid"
 		: "=a" (a),
@@ -86,10 +95,12 @@
 	if (edx!=NULL)
 		*edx = d;
 
+#ifndef __GNU__
 	/* Restore initial sched affinity */
 	ret = sched_setaffinity(getpid(), sizeof(tmp_set), &tmp_set);
 	if (ret)
 		return ret;
+#endif
 	return 0;
 }
 
diff -ur x86info-1.30/debian/control x86info-1.30.new/debian/control
--- x86info-1.30/debian/control	2012-09-06 21:22:39.000000000 +0200
+++ x86info-1.30.new/debian/control	2012-09-06 21:24:29.000000000 +0200
@@ -7,8 +7,8 @@
 Standards-Version: 3.8.3
 
 Package: x86info
-Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}, makedev (>= 2.3.1-53) | udev
+Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
+Depends: ${shlibs:Depends}, ${misc:Depends}, makedev (>= 2.3.1-53) [!hurd-any]| udev [!hurd-any]
 Description: Display diagnostic information about i386 compatible CPUs
  x86info displays diagnostic information about the CPUs fitted to i386
  compatible systems.  This includes information on the CPU cache
diff -ur x86info-1.30/debian/postinst x86info-1.30.new/debian/postinst
--- x86info-1.30/debian/postinst	2012-09-06 21:22:39.000000000 +0200
+++ x86info-1.30.new/debian/postinst	2012-09-05 17:51:50.000000000 +0200
@@ -4,6 +4,8 @@
 
 #DEBHELPER#
 
+if [ `uname` = Linux ]; then
 if [ ! -c /dev/cpu/0/cpuid -a -x /dev/MAKEDEV ]; then
 	(cd /dev ; ./MAKEDEV cpu )
 fi
+fi

Reply to: