From d1aeeda98304988f25e9195812cc696e1e96bf06 Mon Sep 17 00:00:00 2001 From: Michael McCabe Date: Sun, 18 Apr 2004 21:55:48 +0000 Subject: added s390 specific fixes to close bug #47965 --- .../003_all_coreutils-gentoo-uname-s390.patch | 137 +++++++++++++++++++++ sys-apps/coreutils/files/digest-coreutils-5.2.0-r1 | 3 + 2 files changed, 140 insertions(+) create mode 100644 sys-apps/coreutils/files/003_all_coreutils-gentoo-uname-s390.patch create mode 100644 sys-apps/coreutils/files/digest-coreutils-5.2.0-r1 (limited to 'sys-apps/coreutils/files') diff --git a/sys-apps/coreutils/files/003_all_coreutils-gentoo-uname-s390.patch b/sys-apps/coreutils/files/003_all_coreutils-gentoo-uname-s390.patch new file mode 100644 index 000000000000..6596a0c8cfa2 --- /dev/null +++ b/sys-apps/coreutils/files/003_all_coreutils-gentoo-uname-s390.patch @@ -0,0 +1,137 @@ +--- coreutils-5.2.0/src/uname.c.orig 2004-04-15 22:42:13.000000000 +0200 ++++ coreutils-5.2.0/src/uname.c 2004-04-15 22:39:44.000000000 +0200 +@@ -44,6 +44,11 @@ + # endif + #endif + ++#if defined (__linux__) ++#define USE_PROCINFO ++#define UNAME_HARDWARE_PLATFORM ++#endif ++ + #include "system.h" + #include "error.h" + +@@ -129,6 +134,82 @@ + exit (status); + } + ++/* Carlos E. Gorges - return vendor_id from proc cpuinfo */ ++#if defined(USE_PROCINFO) ++/* x==0, processor type | x==1, hardware-platform */ ++int ++__linux_procinfo (int x, char *fstr) ++{ ++ FILE *ffd; ++ char *cstr=calloc(64,sizeof(char)), ++ *dstr=calloc(257,sizeof(char)), ++ *retr=NULL; ++#if defined(__s390__) || defined(__s390x__) ++ if ( ffd=fopen("/proc/sysinfo", "r") ) ++#else ++ if ( ffd=fopen("/proc/cpuinfo", "r") ) ++#endif ++ { ++#if defined(__s390__) || defined(__s390x__) ++ while ( fscanf(ffd, "%[^ :]%*[ :]%[^\n]\n", cstr, dstr) != EOF ) ++#else ++ while ( fscanf(ffd, "%[^:\t]\t: %[^\n]\n", cstr, dstr) != EOF ) ++#endif ++ { ++ char *sdata[] = ++ { ++ #if defined(__i386__) ++ "model name", "vendor_id" ++ #endif ++ #if defined(__ia64__) || defined(__x86_64__) ++ "model", "vendor" ++ #endif ++ #if defined(__alpha__) ++ "cpu model", "system type" ++ #endif ++ #if defined(sparc) || defined(__sparc__) ++ "type", "cpu" ++ #endif ++ #if defined(__hppa__) ++ "cpu", "model" ++ #endif ++ #if defined(__mips__) ++ "cpu model", "system type" ++ #endif ++ #if defined(PPC) ++ "cpu", "machine" ++ #endif ++ #if defined(__s390__) || defined(__s390x__) ++ "Type", "Manufacturer" ++ #endif ++ }; ++ ++ if(!retr) ++ { ++ if (!strcmp(cstr, sdata[x])) ++ retr = strdup(dstr); ++ } else ++ break; ++ ++ } ++ fclose(ffd); ++ ++ if(retr) ++ { ++#if defined(__s390__) || defined(__s390x__) ++ while (strlen(retr) && isblank(retr[strlen(retr)-1])) ++ retr[strlen(retr)-1] = 0; ++#endif ++ strncpy(fstr,retr,257); ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++#endif ++ ++ + /* Print ELEMENT, preceded by a space if something has already been + printed. */ + +@@ -243,13 +324,19 @@ + if (toprint & PRINT_PROCESSOR) + { + char const *element = unknown; +-#if HAVE_SYSINFO && defined SI_ARCHITECTURE ++#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO) + { + static char processor[257]; ++#if HAVE_SYSINFO && defined SI_ARCHITECTURE + if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) ++#endif ++#if defined(USE_PROCINFO) ++ if( 0 <= __linux_procinfo(0, processor)) ++#endif + element = processor; + } + #endif ++ + #ifdef UNAME_PROCESSOR + if (element == unknown) + { +@@ -278,9 +365,13 @@ + if (element == unknown) + { + static char hardware_platform[257]; ++#if ! defined (USE_PROCINFO) + size_t s = sizeof hardware_platform; + static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM }; + if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0) ++#else ++ if( 0 <= __linux_procinfo(1, hardware_platform)) ++#endif + element = hardware_platform; + } + #endif +@@ -294,3 +385,4 @@ + + exit (EXIT_SUCCESS); + } ++ diff --git a/sys-apps/coreutils/files/digest-coreutils-5.2.0-r1 b/sys-apps/coreutils/files/digest-coreutils-5.2.0-r1 new file mode 100644 index 000000000000..626270690004 --- /dev/null +++ b/sys-apps/coreutils/files/digest-coreutils-5.2.0-r1 @@ -0,0 +1,3 @@ +MD5 ea024eaf04ee7a2a4270655d584445d2 coreutils-5.2.0.tar.bz2 4242493 +MD5 34f8286d25e5dd049482c0f92bb4f796 coreutils-5.2.0-i18n-0.1.patch.gz 25741 +MD5 54ec4b94379d3356c70e1fc320f117e7 coreutils-5.2.0-gentoo-0.1.tar.bz2 60691 -- cgit v1.2.3-65-gdbad