46 |
|
#include <time.h> |
47 |
|
#include <sys/time.h> |
48 |
|
#endif |
49 |
+ |
#ifdef HPUX |
50 |
+ |
#include <sys/param.h> |
51 |
+ |
#include <sys/pstat.h> |
52 |
+ |
#include <time.h> |
53 |
+ |
#endif |
54 |
|
|
55 |
|
sg_host_info *sg_get_host_info(){ |
56 |
|
|
57 |
< |
static sg_host_info general_stat; |
57 |
> |
static sg_host_info general_stat; |
58 |
|
static struct utsname os; |
59 |
|
|
60 |
+ |
#ifdef HPUX |
61 |
+ |
struct pst_static pstat_static; |
62 |
+ |
time_t currtime; |
63 |
+ |
long boottime; |
64 |
+ |
#endif |
65 |
|
#ifdef SOLARIS |
66 |
|
time_t boottime,curtime; |
67 |
|
kstat_ctl_t *kc; |
90 |
|
general_stat.hostname = os.nodename; |
91 |
|
|
92 |
|
/* get uptime */ |
93 |
+ |
#ifdef HPUX |
94 |
+ |
if (pstat_getstatic(&pstat_static, sizeof(pstat_static), 1, 0) == -1) { |
95 |
+ |
sg_set_error_with_errno(SG_ERROR_PSTAT, "pstat_static"); |
96 |
+ |
return NULL; |
97 |
+ |
} |
98 |
+ |
|
99 |
+ |
currtime = time(NULL); |
100 |
+ |
|
101 |
+ |
boottime = pstat_static.boot_time; |
102 |
+ |
|
103 |
+ |
general_stat.uptime = currtime - boottime; |
104 |
+ |
#endif |
105 |
|
#ifdef SOLARIS |
106 |
|
if ((kc = kstat_open()) == NULL) { |
107 |
|
sg_set_error(SG_ERROR_KSTAT_OPEN, NULL); |