From: Carlos E Gorges <carlos@techlinux.com.br>
To: Linux <linux-kernel@vger.kernel.org>
Subject: Re: uname reports 'unknown'
Date: Tue, 12 Mar 2002 21:46:37 -0300 [thread overview]
Message-ID: <200203130242.g2D2gEI15215@iron.vbnet.com.br> (raw)
In-Reply-To: <15303.1015975366@kao2.melbourne.sgi.com> <3C8E914F.1070701@lexus.com>
In-Reply-To: <3C8E914F.1070701@lexus.com>
On Tue 12 Mar 2002 20:37, J Sloan wrote:
Try w/ this patch.
--- sh-utils-2.0.11/src/uname.c Sat May 6 11:17:53 2000
+++ sh-utils-2.0.11-carlos/src/uname.c Tue Mar 12 21:42:02 2002
@@ -48,6 +48,7 @@
#define AUTHORS "David MacKenzie"
static void print_element PARAMS ((unsigned int mask, char *element));
+void __sysinfo_processor_type(char*);
/* Values that are bitwise or'd into `toprint'. */
/* Operating system name. */
@@ -118,7 +119,7 @@
{
struct utsname name;
int c;
- char processor[256];
+ char processor[BUFSIZ];
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -183,12 +184,7 @@
if (uname (&name) == -1)
error (1, errno, _("cannot get system name"));
-#if defined (HAVE_SYSINFO) && defined (SI_ARCHITECTURE)
- if (sysinfo (SI_ARCHITECTURE, processor, sizeof (processor)) == -1)
- error (1, errno, _("cannot get processor type"));
-#else
- strcpy (processor, "unknown");
-#endif
+ __sysinfo_processor_type(processor);
print_element (PRINT_SYSNAME, name.sysname);
print_element (PRINT_NODENAME, name.nodename);
@@ -213,3 +209,25 @@
printf ("%s%c", element, toprint ? ' ' : '\n');
}
}
+
+
+/* Carlos E. Gorges
+return vendor_id from proc cpuinfo
+*/
+
+void
+__sysinfo_processor_type (char* proc_info) {
+ FILE *ffd;
+ char temp_string[BUFSIZ],final_string[BUFSIZ]="unknown";
+
+ if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
+ while ( fscanf(ffd, "%s :", temp_string) != EOF)
+ if (!(strcmp(temp_string, "vendor_id"))) {
+ fscanf(ffd, "%s", final_string);
+ break;
+ }
+ fclose(ffd);
+ }
+ strncpy(proc_info,final_string,BUFSIZ);
+}
+
---
> Keith Owens wrote:
> >On 12 Mar 2002 17:59:53 -0500,
> >
> >Shawn Starr <spstarr@sh0n.net> wrote:
> >>Perhaps it should display P54C which is my P200 processor type?
> >
> >Talk to sh-utils, uname -p is not kernel defined.
>
> Yes the kernel part is fine, has been fine.
>
> sh-utils comes with a broken uname, but the
> patch is trivial - wonder when the vendors
> will pick it up, it works fine here -
>
> Linux uranium 2.4.19-pre2aa1 #1 Thu Mar 7 12:33:56 PST 2002 i686
> GenuineIntel
>
> Joe
--
_________________________
Carlos E Gorges
(carlos@techlinux.com.br)
Tech informática LTDA
Brazil
_________________________
next prev parent reply other threads:[~2002-03-13 0:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-12 1:43 Shawn Starr
2002-03-12 3:14 ` Keith Owens
2002-03-12 22:59 ` Shawn Starr
2002-03-12 23:22 ` Keith Owens
2002-03-12 23:37 ` J Sloan
2002-03-13 0:46 ` Carlos E Gorges [this message]
2002-03-12 5:16 ` J Sloan
2002-03-13 19:26 ` David Ford
2002-03-13 21:10 ` J Sloan
2002-03-12 11:59 ` Davidovac Zoran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200203130242.g2D2gEI15215@iron.vbnet.com.br \
--to=carlos@techlinux.com.br \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®