Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 29366 Details for
Bug 47965
fixed patch for coreutils-5.2.0 uname on s390
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
better patch
003_all_coreutils-gentoo-uname.patch (text/plain), 3.05 KB, created by
jochen
on 2004-04-15 13:44:48 UTC
(
hide
)
Description:
better patch
Filename:
MIME Type:
Creator:
jochen
Created:
2004-04-15 13:44:48 UTC
Size:
3.05 KB
patch
obsolete
>--- 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 <carlos@techlinux.com.br> - 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); > } >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47965
:
29363
| 29366