Opened 22 years ago
Closed 22 years ago
#467 closed enhancement (fixed)
coreutils uname patch
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | lowest | Milestone: | |
Component: | Book | Version: | CVS |
Severity: | minor | Keywords: | |
Cc: |
Description
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>
Attachments (1)
Change History (6)
comment:1 by , 22 years ago
comment:3 by , 22 years ago
I wasn't aware that coreutils' uname version has this kind of patch applied already. Does it or don't we know yet?
by , 22 years ago
Attachment: | coreutils-5.0-uname.patch added |
---|
modified version of the sh-utils-uname diff for coreutils
comment:4 by , 22 years ago
Summary: | sh utils uname patch → coreutils uname patch |
---|
comment:5 by , 22 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Include this patch as an optional patch to apply, like tar's bzip2 patch and sysvinit's kill message modification.