[Bug 467] New: sh utils uname patch

bugzilla at linuxfromscratch.org bugzilla at linuxfromscratch.org
Sun Jan 12 08:03:48 PST 2003


http://bugs.linuxfromscratch.org/show_bug.cgi?id=467

           Summary: sh utils uname patch
           Product: Linux From Scratch
           Version: CVS
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P5
         Component: Book
        AssignedTo: lfs-book at linuxfromscratch.org
        ReportedBy: chthon at chthon-uk.com
         QAContact: lfs-book at linuxfromscratch.org


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>



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are the QA contact for the bug, or are watching the QA contact.
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-book' in the subject header of the message



More information about the lfs-book mailing list