Opened 21 years ago

Closed 21 years ago

#467 closed enhancement (fixed)

coreutils uname patch

Reported by: iwanek@… Owned by: lfs-book@…
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[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)

coreutils-5.0-uname.patch (1.0 KB ) - added by iwanek@… 21 years ago.
modified version of the sh-utils-uname diff for coreutils

Download all attachments as: .zip

Change History (6)

comment:1 by gerard@…, 21 years ago

Include this patch as an optional patch to apply, like tar's bzip2 patch and sysvinit's kill message modification.

comment:2 by iwanek@…, 21 years ago

wont this be obsolete after we upgrade to coreutils?

comment:3 by gerard@…, 21 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 iwanek@…, 21 years ago

Attachment: coreutils-5.0-uname.patch added

modified version of the sh-utils-uname diff for coreutils

comment:4 by iwanek@…, 21 years ago

Summary: sh utils uname patchcoreutils uname patch

comment:5 by timothy@…, 21 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.