1 diff -urNp -x '*.orig' coreutils-8.32.org/src/uname.c coreutils-8.32/src/uname.c
2 --- coreutils-8.32.org/src/uname.c 2020-02-04 20:27:08.000000000 +0100
3 +++ coreutils-8.32/src/uname.c 2021-03-21 00:28:54.006899186 +0100
5 /* Operating system. */
6 #define PRINT_OPERATING_SYSTEM 128
8 +void __sysinfo_processor_type(char*);
10 static struct option const uname_long_options[] =
12 {"all", no_argument, NULL, 'a'},
17 -#if HAVE_SYSINFO && defined SI_ARCHITECTURE
18 if (element == unknown)
20 - static char processor[257];
21 - if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
22 - element = processor;
23 + char processor[BUFSIZ];
24 + __sysinfo_processor_type(processor);
25 + element = processor;
28 #ifdef UNAME_PROCESSOR
29 if (element == unknown)
31 @@ -374,3 +372,38 @@ main (int argc, char **argv)
38 +return vendor_id from proc cpuinfo
42 +__sysinfo_processor_type (char* proc_info) {
44 + char *p,temp_string[BUFSIZ],final_string[BUFSIZ]="unknown";
46 + if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
47 + while ( fscanf(ffd, "%s : ", temp_string) != EOF)
49 + if (!(strcmp(temp_string, "machine")))
50 + #endif /* __PPC__ */
52 + if (!(strcmp(temp_string, "cpu")))
53 + #endif /* __sparc__ */
54 + #if defined(__i386__) || defined(__x86_64__)
55 + if (!(strcmp(temp_string, "name")))
56 + #endif /* __x86__ */
58 + if (!(strcmp(temp_string, "model")))
59 + #endif /* __alpha__ */
61 + fgets(final_string, 64, ffd);
62 + while (p=strchr(final_string, ' ')) *p='_';
63 + while (p=strchr(final_string, '\n')) *p=0;
68 + strncpy(proc_info,final_string,BUFSIZ);