diff -urNp -x '*.orig' coreutils-8.32.org/src/uname.c coreutils-8.32/src/uname.c --- coreutils-8.32.org/src/uname.c 2020-02-04 20:27:08.000000000 +0100 +++ coreutils-8.32/src/uname.c 2021-03-21 00:28:54.006899186 +0100 @@ -86,6 +86,8 @@ /* Operating system. */ #define PRINT_OPERATING_SYSTEM 128 +void __sysinfo_processor_type(char*); + static struct option const uname_long_options[] = { {"all", no_argument, nullptr, 'a'}, @@ -323,14 +323,12 @@ element = "powerpc"; # endif #endif -#if HAVE_SYSINFO && defined SI_ARCHITECTURE if (element == unknown) { - static char processor[257]; - if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) - element = processor; + char processor[BUFSIZ]; + __sysinfo_processor_type(processor); + element = processor; } -#endif #ifdef UNAME_PROCESSOR if (element == unknown) { @@ -374,3 +372,38 @@ main (int argc, char **argv) return EXIT_SUCCESS; } + + +/* Carlos E. Gorges +return vendor_id from proc cpuinfo +*/ + +void +__sysinfo_processor_type (char* proc_info) { + FILE *ffd; + char *p,temp_string[BUFSIZ],final_string[BUFSIZ]="unknown"; + + if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) { + while ( fscanf(ffd, "%s : ", temp_string) != EOF) + #ifdef __PPC__ + if (!(strcmp(temp_string, "machine"))) + #endif /* __PPC__ */ + #ifdef __sparc__ + if (!(strcmp(temp_string, "cpu"))) + #endif /* __sparc__ */ + #if defined(__i386__) || defined(__x86_64__) + if (!(strcmp(temp_string, "name"))) + #endif /* __x86__ */ + #ifdef __alpha__ + if (!(strcmp(temp_string, "model"))) + #endif /* __alpha__ */ + { + fgets(final_string, 64, ffd); + while (p=strchr(final_string, ' ')) *p='_'; + while (p=strchr(final_string, '\n')) *p=0; + break; + } + fclose(ffd); + } + strncpy(proc_info,final_string,BUFSIZ); +}