53 |
|
#include <sys/pstat.h> |
54 |
|
#include <time.h> |
55 |
|
#endif |
56 |
+ |
#ifdef AIX |
57 |
+ |
#include <utmp.h> |
58 |
+ |
#include <libperfstat.h> |
59 |
+ |
#endif |
60 |
|
#ifdef WIN32 |
61 |
|
#include <windows.h> |
62 |
|
#include "win32.h" |
201 |
|
char *tmp_name; |
202 |
|
char tmp[10]; |
203 |
|
#endif |
204 |
+ |
#ifdef AIX |
205 |
+ |
static perfstat_cpu_total_t cpu_total; |
206 |
+ |
struct utmp *ut; |
207 |
+ |
#endif |
208 |
|
|
209 |
|
#ifndef WIN32 /* Trust windows to be different */ |
210 |
|
if((uname(&os)) < 0){ |
381 |
|
return NULL; |
382 |
|
} |
383 |
|
general_stat.uptime = (time_t) result; |
384 |
+ |
#endif |
385 |
+ |
#ifdef AIX |
386 |
+ |
if(perfstat_cpu_total(NULL, &cpu_total, sizeof(cpu_total), 1) != 1) { |
387 |
+ |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "perfstat_cpu_total"); |
388 |
+ |
return NULL; |
389 |
+ |
} |
390 |
+ |
general_stat.platform = cpu_total.description; |
391 |
+ |
|
392 |
+ |
while( ut = getutent() ) { |
393 |
+ |
if( ut->ut_type == BOOT_TIME ) { |
394 |
+ |
general_stat.uptime = time(NULL) - ut->ut_time; |
395 |
+ |
break; |
396 |
+ |
} |
397 |
+ |
} |
398 |
+ |
|
399 |
|
#endif |
400 |
|
|
401 |
|
return &general_stat; |