]> git.pld-linux.org Git - packages/coreutils.git/blame - coreutils-uname-cpuinfo.patch
- updated info patch to restore "groups" docs
[packages/coreutils.git] / coreutils-uname-cpuinfo.patch
CommitLineData
40ce7301
JB
1--- coreutils-4.5.3/src/uname.c.orig Sat Aug 31 10:52:11 2002
2+++ coreutils-4.5.3/src/uname.c Sun Oct 27 22:21:27 2002
3@@ -78,6 +78,8 @@
4 /* Operating system. */
5 #define PRINT_OPERATING_SYSTEM 128
6
7+void __sysinfo_processor_type(char*);
8+
9 /* The name this program was run with, for error messages. */
10 char *program_name;
11
12@@ -240,13 +242,9 @@
13 if (toprint & PRINT_PROCESSOR)
14 {
15 char const *element = unknown;
16-#if HAVE_SYSINFO && defined SI_ARCHITECTURE
17- {
18- static char processor[257];
19- if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
20- element = processor;
21- }
22-#endif
23+ char processor[BUFSIZ];
24+ __sysinfo_processor_type(processor);
25+ element = processor;
26 #ifdef UNAME_PROCESSOR
27 if (element == unknown)
28 {
29@@ -291,3 +289,38 @@
30
31 exit (EXIT_SUCCESS);
32 }
33+
34+
35+/* Carlos E. Gorges
36+return vendor_id from proc cpuinfo
37+*/
38+
39+void
40+__sysinfo_processor_type (char* proc_info) {
41+ FILE *ffd;
42+ char *p,temp_string[BUFSIZ],final_string[BUFSIZ]="unknown";
43+
44+ if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
45+ while ( fscanf(ffd, "%s : ", temp_string) != EOF)
46+ #ifdef __PPC__
47+ if (!(strcmp(temp_string, "machine")))
48+ #endif /* __PPC__ */
49+ #ifdef __sparc__
50+ if (!(strcmp(temp_string, "cpu")))
51+ #endif /* __sparc__ */
52+ #ifdef __i386__
53+ if (!(strcmp(temp_string, "name")))
54+ #endif /* __x86__ */
55+ #ifdef __alpha__
175289ca 56+ if (!(strcmp(temp_string, "model")))
40ce7301
JB
57+ #endif /* __alpha__ */
58+ {
59+ fgets(final_string, 64, ffd);
60+ while (p=strchr(final_string, ' ')) *p='_';
61+ while (p=strchr(final_string, '\n')) *p=0;
62+ break;
63+ }
64+ fclose(ffd);
65+ }
66+ strncpy(proc_info,final_string,BUFSIZ);
67+}
This page took 0.030584 seconds and 4 git commands to generate.