Skip to contentSkip to conversation

uname reports 'unknown'

DISCUSSION Shawn Starr 7 participants 10 messages Mar 12, 2002 – Mar 13, 2002

lore
Share & tools
lore
#0 lore raw

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

Shawn.

#1 lore raw
Quoted 6 lines · Shawn Starr

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

'unknown' is the output from uname -p, host processor type. That field is not supported in the Linux kernel. uname.c in sh-utils has this

#if defined (HAVE_SYSINFO) && defined (SI_ARCHITECTURE)
if (sysinfo (SI_ARCHITECTURE, processor, sizeof (processor)) == -1)

    error (1, errno, _("cannot get processor type"));

#else
strcpy (processor, "unknown");
#endif

HAVE_SYSINFO is always false in sh-utils and SI_ARCHITECTURE is not defined in glibc so you always get unknown.

#2 lore raw

Perhaps it should display P54C which is my P200 processor type?

Quoted 23 lines · Keith Owens
Quoted 6 lines · Shawn Starr

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

'unknown' is the output from uname -p, host processor type. That field is not supported in the Linux kernel. uname.c in sh-utils has this

#if defined (HAVE_SYSINFO) && defined (SI_ARCHITECTURE)
if (sysinfo (SI_ARCHITECTURE, processor, sizeof (processor)) == -1)

    error (1, errno, _("cannot get processor type"));

#else
strcpy (processor, "unknown");
#endif

HAVE_SYSINFO is always false in sh-utils and SI_ARCHITECTURE is not defined in glibc so you always get unknown.

#3 lore raw
Quoted 1 line · Shawn Starr

Perhaps it should display P54C which is my P200 processor type?

Talk to sh-utils, uname -p is not kernel defined.

#4 lore raw
Quoted 7 lines · Keith Owens
Quoted 2 lines · Shawn Starr

Perhaps it should display P54C which is my P200 processor type?

Talk to sh-utils, uname -p is not kernel defined.

Yes the kernel part is fine, has been fine.

sh-utils comes with a broken uname, but the
patch is trivial - wonder when the vendors
will pick it up, it works fine here -

Linux uranium 2.4.19-pre2aa1 #1 Thu Mar 7 12:33:56 PST 2002 i686 GenuineIntel

Joe

#5 lore raw
In reply to Keith Owens

On Tue 12 Mar 2002 20:37, J Sloan wrote:

Try w/ this patch.

src/uname.c +25 -7
@@ -48,6 +48,7 @@
 #define AUTHORS "David MacKenzie"
 
 static void print_element PARAMS ((unsigned int mask, char *element));
+void __sysinfo_processor_type(char*);
 
 /* Values that are bitwise or'd into `toprint'. */
 /* Operating system name. */
@@ -118,7 +119,7 @@
 {
   struct utsname name;
   int c;
-  char processor[256];
+  char processor[BUFSIZ];
 
   program_name = argv[0];
   setlocale (LC_ALL, "");
@@ -183,12 +184,7 @@
   if (uname (&name) == -1)
     error (1, errno, _("cannot get system name"));
 
-#if defined (HAVE_SYSINFO) && defined (SI_ARCHITECTURE)
-  if (sysinfo (SI_ARCHITECTURE, processor, sizeof (processor)) == -1)
-    error (1, errno, _("cannot get processor type"));
-#else
-  strcpy (processor, "unknown");
-#endif
+  __sysinfo_processor_type(processor);
 
   print_element (PRINT_SYSNAME, name.sysname);
   print_element (PRINT_NODENAME, name.nodename);
@@ -213,3 +209,25 @@
       printf ("%s%c", element, toprint ? ' ' : '\n');
     }
 }
+
+
+/* Carlos E. Gorges
+return vendor_id from proc cpuinfo
+*/
+
+void
+__sysinfo_processor_type (char* proc_info) {
+	FILE *ffd;
+	char temp_string[BUFSIZ],final_string[BUFSIZ]="unknown";
+	
+	if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
+		while ( fscanf(ffd, "%s :", temp_string) != EOF)
+			if (!(strcmp(temp_string, "vendor_id"))) {
+					fscanf(ffd, "%s", final_string);
+					break;
+			}
+		fclose(ffd);
+	}
+	strncpy(proc_info,final_string,BUFSIZ);
+}
+

---

Quoted 18 lines
Quoted 6 lines · Keith Owens

On 12 Mar 2002 17:59:53 -0500,

Quoted 1 line · Shawn Starr

Perhaps it should display P54C which is my P200 processor type?

Talk to sh-utils, uname -p is not kernel defined.

Yes the kernel part is fine, has been fine.

sh-utils comes with a broken uname, but the
patch is trivial - wonder when the vendors
will pick it up, it works fine here -

Linux uranium 2.4.19-pre2aa1 #1 Thu Mar 7 12:33:56 PST 2002 i686 GenuineIntel

Joe

Signature · 6 lines
	 _________________________
	 Carlos E Gorges          
	 ([email protected])
	 Tech informática LTDA
	 Brazil                   
	 _________________________
#6 lore raw
In reply to Shawn Starr
Quoted 7 lines · Shawn Starr

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

Many vendors ship a broken sh-utils.

They don't have to:

Linux neo.mirai.cx 2.4.19-pre2aa1 #1 Fri Mar 8 19:55:24 PST 2002 i686 GenuineIntel

Linux emerald.mirai.cx 2.4.19pre1aa1 #1 Sat Mar 2 20:55:06 PST 2002 i586 AuthenticAMD

Cheers,

Joe

#7 lore raw
In reply to Shawn Starr

same here, perhaps it is time to rewrite uname,
to use /proc/cpuinfo ?

root@www:~# uname -a
Linux www 2.2.20 #1 Wed Feb 6 11:23:03 CET 2002 i686 unknown
root@www:~# more /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Pentium II (Deschutes)
stepping        : 2
cpu MHz         : 350.798
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
sep_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov
pat pse36 mmx fxsr
bogomips
Quoted 21 lines · Shawn Starr

Date: 11 Mar 2002 20:43:37 -0500
From: Shawn Starr <[email protected]>
To: Linux <[email protected]>
Subject: uname reports 'unknown'

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

Shawn.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#8 lore raw
In reply to Shawn Starr

Seems to me that it is the fault of the original package of 'sh-utils'.

-d

Quoted 21 lines · J Sloan
Quoted 7 lines · Shawn Starr

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

Many vendors ship a broken sh-utils.

They don't have to:

Linux neo.mirai.cx 2.4.19-pre2aa1 #1 Fri Mar 8 19:55:24 PST 2002 i686 GenuineIntel

Linux emerald.mirai.cx 2.4.19pre1aa1 #1 Sat Mar 2 20:55:06 PST 2002 i586 AuthenticAMD

Cheers,

Joe

#9 lore raw
In reply to Shawn Starr

So it would seem, since the fix is easy...

Maybe it's a portability concern...

Joe

Quoted 31 lines · David Ford

Seems to me that it is the fault of the original package of 'sh-utils'.

-d

Quoted 21 lines · J Sloan
Quoted 7 lines · Shawn Starr

Linux coredump 2.4.19-pre2-ac4-xfs-shawn10 #2 Mon Mar 11 03:36:35 EST 2002 i586 unknown

what should 'unknown' really be? I've never seen it different on Intel systems.

Many vendors ship a broken sh-utils.

They don't have to:

Linux neo.mirai.cx 2.4.19-pre2aa1 #1 Fri Mar 8 19:55:24 PST 2002 i686 GenuineIntel

Linux emerald.mirai.cx 2.4.19pre1aa1 #1 Sat Mar 2 20:55:06 PST 2002 i586 AuthenticAMD

Cheers,

Joe