﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
467	coreutils uname patch	iwanek@…	lfs-book@…	"was on the lfs ftp server - makes uname report the correct processor type - dunno if this 
should be included in the book tho: 
<START PATCH> 
diff -Naur sh-utils-2.0/src/uname.c sh-utils-2.0-uname/src/uname.c 
--- sh-utils-2.0/src/uname.c    Wed Mar 31 05:36:01 1999 
+++ sh-utils-2.0-uname/src/uname.c      Wed May 22 16:19:19 2002 
@@ -47,6 +47,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. */ 
@@ -117,7 +118,7 @@ 
 { 
   struct utsname name; 
   int c; 
-  char processor[256]; 
+  char processor[BUFSIZ]; 
 
   program_name = argv[0]; 
   setlocale (LC_ALL, """"); 
@@ -180,12 +181,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); 
@@ -210,3 +206,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); 
+} 
+ 
<END PATCH>"	enhancement	closed	lowest		Book	CVS	minor	fixed		
