2
\* I was trying to make this easier to add other platforms/ */
3
/* architectures. Feel free to add yours, and send me the patch. *\
4
\*----------------------------------------------------------------*/
10
#include <sys/utsname.h>
13
#include "sysinfo_common.h"
14
#include "vmw_string.h"
16
int external_bogomips(char *bogomips_total);
18
void get_os_info(struct os_info_type *os_info)
22
clear_os_pointers(os_info);
26
os_info->os_name=strdup(buf.sysname);
27
os_info->os_version=strdup(buf.version); /* switched around, JSt */
28
/*os_info->os_revision=strdup(buf.version);*/
29
os_info->host_name=strdup(buf.nodename);
30
os_info->uptime=strdup(utmp_get_uptime());/* Neither of below implemented*/
31
os_info->load_average=strdup(get_loadavg_noproc());
34
void get_hw_info(struct hw_info_type *hw_info,
35
struct linux_logo_info_type *logo_info)
41
char temp_string2[BUFSIZ];
42
char chip[BUFSIZ]="Unknown";
43
char temp_string[BUFSIZ],bogomips_total[BUFSIZ]="???";
44
char bogo_total[BUFSIZ];
47
/* Print CPU Type and BogoMips -- Handles SMP Correctly now *\
48
\* To debug other architectures, create copies of the proc files and */
51
clear_hw_pointers(hw_info);
53
/* sprintf(cpuinfo,"Unknown CPU");*/
54
if ((fff=popen("lsattr -El proc0","r") )!=NULL) {
55
while ( fscanf(fff,"%s",(char *)&temp_string2)!=EOF) {
56
if ( !(strcmp(temp_string2,"type")) ) {
58
output of lsattr -El proc0 gives
59
state enable Processor state False
60
type POWER2 Processor type False
63
fscanf(fff,"%s%s%s%s%s",(char *)&chip,(char *)&temp_string,
64
(char *)&temp_string,(char *)&temp_string,(char *)&temp_string);
70
/* count cpus ... ugly using wc, JSt */
71
if ((fff=popen("lsdev -Cc processor -SA|wc -l","r") )!=NULL) {
72
fscanf(fff,"%d",&cpus);
76
if ((fff=popen("lsattr -E -l sys0 -a realmem -F value","r") )!=NULL) {
77
fscanf(fff,"%ld",&mem);
81
if (!logo_info->skip_bogomips)
82
if ( (external_bogomips( (char *)&bogomips_total))==-1 )
83
sprintf(bogo_total," ");
84
else sprintf(bogo_total,"%s Bogomips Total",bogomips_total);
85
else sprintf(bogo_total," ");
87
/* Added for 3.0 best I could.. have no AIX box to test on --vmw */
88
sprintf(temp_string,"%ldM",(long int)mem/1024);
89
hw_info->mem_size=strdup(temp_string);
91
hw_info->bogo_total=strdup(bogo_total);
93
hw_info->num_cpus=cpus;
96
sprintf(temp_string,"%.0fMHz ",megahertz);
97
hw_info->megahertz=strdup(temp_string);
100
hw_info->cpu_type=strdup(chip);