ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/os_info.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/os_info.c (file contents):
Revision 1.24 by tdb, Mon Oct 9 14:09:38 2006 UTC vs.
Revision 1.25 by tdb, Sun Oct 3 18:35:58 2010 UTC

# Line 53 | Line 53
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"
# Line 197 | Line 201 | sg_host_info *sg_get_host_info()
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){
# Line 373 | Line 381 | sg_host_info *sg_get_host_info()
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines