--- projects/libstatgrab/src/libstatgrab/os_info.c 2004/07/18 21:30:11 1.19 +++ projects/libstatgrab/src/libstatgrab/os_info.c 2004/11/01 18:30:17 1.20 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: os_info.c,v 1.19 2004/07/18 21:30:11 ats Exp $ + * $Id: os_info.c,v 1.20 2004/11/01 18:30:17 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -46,12 +46,22 @@ #include #include #endif +#ifdef HPUX +#include +#include +#include +#endif sg_host_info *sg_get_host_info(){ - static sg_host_info general_stat; + static sg_host_info general_stat; static struct utsname os; +#ifdef HPUX + struct pst_static pstat_static; + time_t currtime; + long boottime; +#endif #ifdef SOLARIS time_t boottime,curtime; kstat_ctl_t *kc; @@ -80,6 +90,18 @@ sg_host_info *sg_get_host_info(){ general_stat.hostname = os.nodename; /* get uptime */ +#ifdef HPUX + if (pstat_getstatic(&pstat_static, sizeof(pstat_static), 1, 0) == -1) { + sg_set_error_with_errno(SG_ERROR_PSTAT, "pstat_static"); + return NULL; + } + + currtime = time(NULL); + + boottime = pstat_static.boot_time; + + general_stat.uptime = currtime - boottime; +#endif #ifdef SOLARIS if ((kc = kstat_open()) == NULL) { sg_set_error(SG_ERROR_KSTAT_OPEN, NULL);