coreutils/coreutils-4.5.3-sysinfo.patch
2005-02-05 17:32:10 +00:00

65 lines
1.6 KiB
Diff

--- coreutils-4.5.3/src/uname.c.sysinfo 2002-08-31 09:52:11.000000000 +0100
+++ coreutils-4.5.3/src/uname.c 2002-11-28 18:29:15.000000000 +0000
@@ -232,7 +232,7 @@
if (toprint & PRINT_KERNEL_RELEASE)
print_element (name.release);
if (toprint & PRINT_KERNEL_VERSION)
- print_element (name.version);
+ print_element (name.version);
if (toprint & PRINT_MACHINE)
print_element (name.machine);
}
@@ -246,6 +246,28 @@
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);
+ }
+ }
+#endif
+ }
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -262,7 +284,7 @@
if (toprint & PRINT_HARDWARE_PLATFORM)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -270,6 +292,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)