--- projects/libstatgrab/src/libstatgrab/os_info.c 2006/10/09 14:09:38 1.24 +++ projects/libstatgrab/src/libstatgrab/os_info.c 2010/10/03 18:35:58 1.25 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: os_info.c,v 1.24 2006/10/09 14:09:38 tdb Exp $ + * $Id: os_info.c,v 1.25 2010/10/03 18:35:58 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -53,6 +53,10 @@ #include #include #endif +#ifdef AIX +#include +#include +#endif #ifdef WIN32 #include #include "win32.h" @@ -197,6 +201,10 @@ sg_host_info *sg_get_host_info() char *tmp_name; char tmp[10]; #endif +#ifdef AIX + static perfstat_cpu_total_t cpu_total; + struct utmp *ut; +#endif #ifndef WIN32 /* Trust windows to be different */ if((uname(&os)) < 0){ @@ -373,6 +381,21 @@ sg_host_info *sg_get_host_info() return NULL; } general_stat.uptime = (time_t) result; +#endif +#ifdef AIX + if(perfstat_cpu_total(NULL, &cpu_total, sizeof(cpu_total), 1) != 1) { + sg_set_error_with_errno(SG_ERROR_SYSCTL, "perfstat_cpu_total"); + return NULL; + } + general_stat.platform = cpu_total.description; + + while( ut = getutent() ) { + if( ut->ut_type == BOOT_TIME ) { + general_stat.uptime = time(NULL) - ut->ut_time; + break; + } + } + #endif return &general_stat;