summaryrefslogtreecommitdiff
path: root/source/a/coreutils/coreutils.uname.diff
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/coreutils/coreutils.uname.diff')
-rw-r--r--source/a/coreutils/coreutils.uname.diff183
1 files changed, 87 insertions, 96 deletions
diff --git a/source/a/coreutils/coreutils.uname.diff b/source/a/coreutils/coreutils.uname.diff
index bd39221c..69911031 100644
--- a/source/a/coreutils/coreutils.uname.diff
+++ b/source/a/coreutils/coreutils.uname.diff
@@ -1,15 +1,6 @@
-Submitted By: Jim Gifford <jim at linuxfromscratch dot org>
-Date: 2006-08-24
-Initial Package Version: 5.97
-Upstream Status: Not Accepted
-Origin: Gentoo - http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils
-Description: Display CPU Information from /proc/cpuinfo or /proc/sysinfo
-
-Original Patch by - Matthew Burgess and Scot McPherson
-
-diff -Nur coreutils-7.1.orig/src/uname.c coreutils-7.1/src/uname.c
---- coreutils-7.1/src/uname.c 2008-09-18 02:06:57.000000000 -0500
-+++ coreutils-7.1/src/uname.c 2009-02-22 21:23:02.209219703 -0600
+diff -Nur coreutils-7.6.orig/src/uname.c coreutils-7.6/src/uname.c
+--- coreutils-7.6.orig/src/uname.c 2009-09-01 06:01:16.000000000 -0500
++++ coreutils-7.6/src/uname.c 2009-09-15 08:55:26.239452858 -0500
@@ -50,6 +50,11 @@
# include <mach-o/arch.h>
#endif
@@ -41,87 +32,87 @@ diff -Nur coreutils-7.1.orig/src/uname.c coreutils-7.1/src/uname.c
+
+static void __eat_cpuinfo_space(char *buf)
+{
-+ /* first eat trailing space */
-+ char *tmp = buf + strlen(buf) - 1;
-+ while (tmp > buf && isspace(*tmp))
-+ *tmp-- = '\0';
-+ /* then eat leading space */
-+ tmp = buf;
-+ while (*tmp && isspace(*tmp))
-+ tmp++;
-+ if (tmp != buf)
-+ memmove(buf, tmp, strlen(tmp)+1);
++ /* first eat trailing space */
++ char *tmp = buf + strlen(buf) - 1;
++ while (tmp > buf && isspace(*tmp))
++ *tmp-- = '\0';
++ /* then eat leading space */
++ tmp = buf;
++ while (*tmp && isspace(*tmp))
++ tmp++;
++ if (tmp != buf)
++ memmove(buf, tmp, strlen(tmp)+1);
+}
+
+static int __linux_procinfo (int x, char *fstr, size_t s)
+{
-+ FILE *fp;
++ FILE *fp;
+
-+ char *procinfo_keys[] = {
-+ /* --processor --hardware-platform */
-+ #if defined(__alpha__)
-+ "cpu model", "system type"
-+ #elif defined(__arm__)
-+ "Processor", "Hardware"
-+ #elif defined(bfin)
-+ "CPU", "BOARD Name"
-+ #elif defined(__cris__)
-+ "cpu", "cpu model"
-+ #elif defined(__frv__)
-+ "CPU-Core", "System"
-+ #elif defined(__i386__) || defined(__x86_64__)
-+ "model name", "vendor_id"
-+ #elif defined(__ia64__)
-+ "family", "vendor"
-+ #elif defined(__hppa__)
-+ "cpu", "model"
-+ #elif defined(__m68k__)
-+ "CPU", "MMU"
-+ #elif defined(__mips__)
-+ "cpu model", "system type"
-+ #elif defined(__powerpc__) || defined(__powerpc64__)
-+ "cpu", "machine"
-+ #elif defined(__s390__) || defined(__s390x__)
-+ "Type", "Manufacturer"
-+ #elif defined(__sh__)
-+ "cpu type", "machine"
-+ #elif defined(sparc) || defined(__sparc__)
-+ "type", "cpu"
-+ #elif defined(__vax__)
-+ "cpu type", "cpu"
-+ #else
-+ "unknown", "unknown"
-+ #endif
-+ };
++ char *procinfo_keys[] = {
++ /* --processor --hardware-platform */
++ #if defined(__alpha__)
++ "cpu model", "system type"
++ #elif defined(__arm__)
++ "Processor", "Hardware"
++ #elif defined(bfin)
++ "CPU", "BOARD Name"
++ #elif defined(__cris__)
++ "cpu", "cpu model"
++ #elif defined(__frv__)
++ "CPU-Core", "System"
++ #elif defined(__i386__) || defined(__x86_64__)
++ "model name", "vendor_id"
++ #elif defined(__ia64__)
++ "family", "vendor"
++ #elif defined(__hppa__)
++ "cpu", "model"
++ #elif defined(__m68k__)
++ "CPU", "MMU"
++ #elif defined(__mips__)
++ "cpu model", "system type"
++ #elif defined(__powerpc__) || defined(__powerpc64__)
++ "cpu", "machine"
++ #elif defined(__s390__) || defined(__s390x__)
++ "Type", "Manufacturer"
++ #elif defined(__sh__)
++ "cpu type", "machine"
++ #elif defined(sparc) || defined(__sparc__)
++ "type", "cpu"
++ #elif defined(__vax__)
++ "cpu type", "cpu"
++ #else
++ "unknown", "unknown"
++ #endif
++ };
+
-+ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
-+ char key[65], value[257], eol, *ret = NULL;
++ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
++ char key[65], value[257], eol, *ret = NULL;
+
-+ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
-+ __eat_cpuinfo_space(key);
-+ if (!strcmp(key, procinfo_keys[x])) {
-+ __eat_cpuinfo_space(value);
-+ ret = value;
-+ break;
-+ }
-+ if (eol != '\n') {
-+ /* we need two fscanf's here in case the previous
-+ * length limit caused us to read right up to the
-+ * newline ... doing "%*[^\n]\n" wont eat the newline
-+ */
-+ fscanf(fp, "%*[^\n]");
-+ fscanf(fp, "\n");
-+ }
-+ }
-+ fclose(fp);
++ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
++ __eat_cpuinfo_space(key);
++ if (!strcmp(key, procinfo_keys[x])) {
++ __eat_cpuinfo_space(value);
++ ret = value;
++ break;
++ }
++ if (eol != '\n') {
++ /* we need two fscanf's here in case the previous
++ * length limit caused us to read right up to the
++ * newline ... doing "%*[^\n]\n" wont eat the newline
++ */
++ fscanf(fp, "%*[^\n]");
++ fscanf(fp, "\n");
++ }
++ }
++ fclose(fp);
+
-+ if (ret) {
-+ strncpy(fstr, ret, s);
-+ return 0;
-+ }
-+ }
++ if (ret) {
++ strncpy(fstr, ret, s);
++ return 0;
++ }
++ }
+
-+ return -1;
++ return -1;
+}
+
+#endif
@@ -136,26 +127,26 @@ diff -Nur coreutils-7.1.orig/src/uname.c coreutils-7.1/src/uname.c
-#if HAVE_SYSINFO && defined SI_ARCHITECTURE
+#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
{
- static char processor[257];
+ static char processor[257];
+#if defined(USE_PROCINFO)
-+ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
++ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
+#else
- if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
+ if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
+#endif
- element = processor;
+ element = processor;
}
#endif
@@ -358,9 +467,13 @@
if (element == unknown)
- {
- static char hardware_platform[257];
+ {
+ static char hardware_platform[257];
+#if defined(USE_PROCINFO)
-+ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
++ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
+#else
- size_t s = sizeof hardware_platform;
- static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
- if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
+ size_t s = sizeof hardware_platform;
+ static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
+ if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
+#endif
- element = hardware_platform;
- }
+ element = hardware_platform;
+ }
#endif