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" |
294 |
|
return match_string; |
295 |
|
} |
296 |
|
|
297 |
< |
long long sg_get_ll_match(char *line, regmatch_t *match){ |
294 |
< |
char *ptr; |
295 |
< |
long long num; |
296 |
< |
|
297 |
< |
ptr=line+match->rm_so; |
298 |
< |
num=atoll(ptr); |
299 |
< |
|
300 |
< |
return num; |
301 |
< |
} |
302 |
< |
#endif |
303 |
< |
|
297 |
> |
/* FIXME do Linux and Cygwin always have atoll? */ |
298 |
|
#ifndef HAVE_ATOLL |
299 |
|
static long long atoll(const char *s) { |
300 |
|
long long value = 0; |
315 |
|
} |
316 |
|
#endif |
317 |
|
|
318 |
+ |
long long sg_get_ll_match(char *line, regmatch_t *match){ |
319 |
+ |
char *ptr; |
320 |
+ |
long long num; |
321 |
+ |
|
322 |
+ |
ptr=line+match->rm_so; |
323 |
+ |
num=atoll(ptr); |
324 |
+ |
|
325 |
+ |
return num; |
326 |
+ |
} |
327 |
+ |
#endif |
328 |
+ |
|
329 |
|
/* $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $ */ |
330 |
|
|
331 |
|
/* |
494 |
|
} |
495 |
|
#endif |
496 |
|
|
497 |
+ |
#ifdef HPUX |
498 |
+ |
struct pst_static *sg_get_pstat_static() { |
499 |
+ |
static int got = 0; |
500 |
+ |
static struct pst_static pst; |
501 |
+ |
|
502 |
+ |
if (!got) { |
503 |
+ |
if (pstat_getstatic(&pst, sizeof pst, 1, 0) == -1) { |
504 |
+ |
sg_set_error_with_errno(SG_ERROR_PSTAT, |
505 |
+ |
"pstat_static"); |
506 |
+ |
return NULL; |
507 |
+ |
} |
508 |
+ |
got = 1; |
509 |
+ |
} |
510 |
+ |
return &pst; |
511 |
+ |
} |
512 |
+ |
#endif |
513 |
+ |
|
514 |
|
int sg_init(){ |
515 |
|
sg_set_error(SG_ERROR_NONE, NULL); |
516 |
|
|
566 |
|
} |
567 |
|
return tmp; |
568 |
|
} |
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 |