2014-01-04 23:54:58 +01:00
|
|
|
---
|
|
|
|
src/uname.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 42 insertions(+)
|
|
|
|
|
2010-05-05 22:22:09 +02:00
|
|
|
Index: src/uname.c
|
|
|
|
===================================================================
|
2014-01-24 14:44:10 +01:00
|
|
|
--- src/uname.c.orig
|
|
|
|
+++ src/uname.c
|
2016-12-03 00:04:18 +01:00
|
|
|
@@ -338,6 +338,36 @@ main (int argc, char **argv)
|
2006-12-19 00:15:28 +01:00
|
|
|
# endif
|
2010-07-19 14:13:47 +02:00
|
|
|
}
|
2006-12-19 00:15:28 +01:00
|
|
|
#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))
|
2010-07-19 14:13:47 +02:00
|
|
|
print_element (element);
|
2006-12-19 00:15:28 +01:00
|
|
|
}
|
2016-12-03 00:04:18 +01:00
|
|
|
@@ -363,6 +393,18 @@ main (int argc, char **argv)
|
2010-07-19 14:13:47 +02:00
|
|
|
element = hardware_platform;
|
|
|
|
}
|
2006-12-19 00:15:28 +01:00
|
|
|
#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))
|
2010-07-19 14:13:47 +02:00
|
|
|
print_element (element);
|
2006-12-19 00:15:28 +01:00
|
|
|
}
|