forked from pool/coreutils
59 lines
1.5 KiB
Diff
59 lines
1.5 KiB
Diff
|
--- coreutils-5.90/src/uname.c
|
||
|
+++ coreutils-5.90/src/uname.c
|
||
|
@@ -287,6 +287,36 @@
|
||
|
# endif
|
||
|
}
|
||
|
#endif
|
||
|
+ if (element == unknown)
|
||
|
+ {
|
||
|
+ struct utsname name;
|
||
|
+ static char processor[sizeof (name.machine)];
|
||
|
+ if (uname (&name) != 0)
|
||
|
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
|
||
|
+ strcpy (processor, name.machine);
|
||
|
+ element = processor;
|
||
|
+#ifdef __linux__
|
||
|
+ if (!strcmp (element, "i686"))
|
||
|
+ {
|
||
|
+ /* Check for Athlon */
|
||
|
+ char line[1024];
|
||
|
+ FILE *f = fopen ("/proc/cpuinfo", "r");
|
||
|
+ if (f)
|
||
|
+ {
|
||
|
+ while (fgets (line, sizeof (line), f) > 0)
|
||
|
+ {
|
||
|
+ if (strncmp (line, "vendor_id", 9) == 0)
|
||
|
+ {
|
||
|
+ if (strstr (line, "AuthenticAMD"))
|
||
|
+ element = "athlon";
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ fclose (f);
|
||
|
+ }
|
||
|
+ }
|
||
|
+#endif
|
||
|
+ }
|
||
|
if (! (toprint == UINT_MAX && element == unknown))
|
||
|
print_element (element);
|
||
|
}
|
||
|
@@ -312,6 +342,18 @@
|
||
|
element = hardware_platform;
|
||
|
}
|
||
|
#endif
|
||
|
+ if (element == unknown)
|
||
|
+ {
|
||
|
+ struct utsname name;
|
||
|
+ static char hardware_platform[sizeof (name.machine)];
|
||
|
+ if (uname (&name) != 0)
|
||
|
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
|
||
|
+ strcpy (hardware_platform, name.machine);
|
||
|
+ if (hardware_platform[0] == 'i' && hardware_platform[2] == '8'
|
||
|
+ && hardware_platform[3] == '6' && hardware_platform[4] == 0)
|
||
|
+ hardware_platform[1] = '3';
|
||
|
+ element = hardware_platform;
|
||
|
+ }
|
||
|
if (! (toprint == UINT_MAX && element == unknown))
|
||
|
print_element (element);
|
||
|
}
|