Subject: kern/25076: procfs -o linux /proc/cpuinfo has different caps in some flag names
To: None <gnats-bugs@gnats.netbsd.org>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: netbsd-bugs
Date: 04/06/2004 20:10:09
>Number:         25076
>Category:       kern
>Synopsis:       procfs -o linux /proc/cpuinfo has different caps in some flag names
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 06 18:11:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Lubomir Sedlacik
>Release:        NetBSD 2.0C Tue Apr  6 18:27:54 CEST 2004
>Organization:
>Environment:
System: NetBSD 2.0C
Architecture: i386
Machine: i386
>Description:
/proc/cpuinfo provided for -o linux option by procfs uses different
capitalization of two cpu-related fields than Linux which could result
in wrong behaviour of some applications.  namely configure script of mplayer,
which guessed wrong cpu family for my machine (default "pentium4" instead of
correct "pentium3").
>How-To-Repeat:
try to compile mplayer (i'll fix the package not to rely on /proc/cpuinfo on
other systems than Linux, though) with /proc mounted with -o linux (in my case
a symlink to /usr/pkg/emul/linux/proc).
>Fix:
Index: procfs_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/procfs_machdep.c,v
retrieving revision 1.18
diff -u -r1.18 procfs_machdep.c
--- procfs_machdep.c	13 Feb 2004 11:36:14 -0000	1.18
+++ procfs_machdep.c	6 Apr 2004 18:03:45 -0000
@@ -96,7 +96,7 @@
 	l = snprintf(p, left,
 		"processor\t: %d\n"
 		"vendor_id\t: %s\n"
-		"CPU family\t: %d\n"
+		"cpu family\t: %d\n"
 		"model\t\t: %d\n"
 		"model name\t: %s\n"
 		"stepping\t: ",
@@ -130,10 +130,10 @@
 
 		freq = (cpu_info_list->ci_tsc_freq + 4999) / 1000000;
 		fraq = ((cpu_info_list->ci_tsc_freq + 4999) / 10000) % 100;
-		l = snprintf(p, left, "CPU MHz\t\t: %qd.%qd\n",
+		l = snprintf(p, left, "cpu MHz\t\t: %qd.%qd\n",
 		    freq, fraq);
 	} else
-		l = snprintf(p, left, "CPU MHz\t\t: unknown\n");
+		l = snprintf(p, left, "cpu MHz\t\t: unknown\n");
 
 	left -= l;
 	p += l;
>Release-Note:
>Audit-Trail:
>Unformatted: