42 |
|
#include <sys/param.h> |
43 |
|
#include <sys/sysctl.h> |
44 |
|
#endif |
45 |
+ |
#ifdef HPUX |
46 |
+ |
#include <sys/param.h> |
47 |
+ |
#include <sys/pstat.h> |
48 |
+ |
#endif |
49 |
|
|
50 |
|
#include "tools.h" |
51 |
|
#include "statgrab.h" |
493 |
|
} |
494 |
|
#endif |
495 |
|
|
496 |
+ |
#ifdef HPUX |
497 |
+ |
struct pst_static *sg_get_pstat_static() { |
498 |
+ |
static int got = 0; |
499 |
+ |
static struct pst_static pst; |
500 |
+ |
|
501 |
+ |
if (!got) { |
502 |
+ |
if (pstat_getstatic(&pst, sizeof pst, 1, 0) == -1) { |
503 |
+ |
sg_set_error_with_errno(SG_ERROR_PSTAT, |
504 |
+ |
"pstat_static"); |
505 |
+ |
return NULL; |
506 |
+ |
} |
507 |
+ |
got = 1; |
508 |
+ |
} |
509 |
+ |
return &pst; |
510 |
+ |
} |
511 |
+ |
#endif |
512 |
+ |
|
513 |
|
int sg_init(){ |
514 |
|
sg_set_error(SG_ERROR_NONE, NULL); |
515 |
|
|
565 |
|
} |
566 |
|
return tmp; |
567 |
|
} |
547 |
– |
|
548 |
– |
/* If we don't have a GNU compatible realloc, fake it. */ |
549 |
– |
#if HAVE_REALLOC == 0 |
550 |
– |
void *rpl_realloc(void *ptr, size_t size) { |
551 |
– |
if (ptr == NULL && size == 0) { |
552 |
– |
return NULL; |
553 |
– |
} |
554 |
– |
|
555 |
– |
if (size == 0) { |
556 |
– |
free(ptr); |
557 |
– |
return NULL; |
558 |
– |
} |
559 |
– |
|
560 |
– |
if (ptr == NULL) { |
561 |
– |
return malloc(size); |
562 |
– |
} |
563 |
– |
|
564 |
– |
#undef realloc |
565 |
– |
return realloc(ptr, size); |
566 |
– |
#define realloc rpl_realloc |
567 |
– |
} |
568 |
– |
#endif |