coreutils/coreutils-4.5.3-sysinfo.patch

70 lines
1.6 KiB
Diff

--- coreutils-5.2.1/src/uname.c.sysinfo 2004-01-21 22:27:02.000000000 +0000
+++ coreutils-5.2.1/src/uname.c 2005-02-04 17:11:38.854805577 +0000
@@ -249,6 +249,42 @@
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+#ifdef linux
+ if(!strcmp(element, "i686")) { /* Check for Athlon */
+ char cinfo[1024];
+ FILE *f=fopen("/proc/cpuinfo", "r");
+ if(f) {
+ while(fgets(cinfo, 1024, f)) {
+ if(!strncmp(cinfo, "vendor_id", 9)) {
+ if(strstr(cinfo, "AuthenticAMD"))
+ element="athlon";
+ break;
+ }
+ }
+ fclose(f);
+ }
+ }
+ if (!strcmp(element,"x86_64")) { /* Check for ia32e */
+ char cinfo[1024];
+ FILE *f=fopen("/proc/cpuinfo", "r");
+ if(f) {
+ while(fgets(cinfo, 1024, f)) {
+ if(!strncmp(cinfo, "vendor_id", 9)) {
+ if(strstr(cinfo, "GenuineIntel"))
+ element="ia32e";
+ break;
+ }
+ }
+ fclose(f);
+ }
+ }
+#endif
+ }
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -265,7 +301,7 @@
if (toprint & PRINT_HARDWARE_PLATFORM)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -273,6 +309,14 @@
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
+ element[1]='3';
+ }
#endif
#ifdef UNAME_HARDWARE_PLATFORM
if (element == unknown)