34 |
|
#ifdef ALLBSD |
35 |
|
#include <fcntl.h> |
36 |
|
#endif |
37 |
< |
#ifdef FREEBSD |
37 |
> |
#if defined(FREEBSD) || defined(DFBSD) |
38 |
|
#include <kvm.h> |
39 |
|
#endif |
40 |
|
#if defined(NETBSD) || defined(OPENBSD) |
420 |
|
return num; |
421 |
|
} |
422 |
|
|
423 |
< |
#ifdef FREEBSD |
423 |
> |
#if defined(FREEBSD) || defined(DFBSD) |
424 |
|
kvm_t *get_kvm() { |
425 |
|
static kvm_t *kvmd = NULL; |
426 |
|
|
460 |
|
#endif |
461 |
|
|
462 |
|
int statgrab_init(){ |
463 |
< |
#ifdef FREEBSD |
463 |
> |
#if (defined(FREEBSD) && !defined(FREEBSD5)) || defined(DFBSD) |
464 |
|
{ |
465 |
|
kvm_t *kvmd = get_kvm(); |
466 |
|
if (kvmd == NULL) return 1; |
467 |
|
} |
468 |
|
#endif |
469 |
< |
#ifdef NETBSD |
469 |
> |
#if defined(NETBSD) || defined(OPENBSD) |
470 |
|
{ |
471 |
+ |
/* This should always succeed, but it seems that on some |
472 |
+ |
* versions of NetBSD the first call to get_uvmexp will return |
473 |
+ |
* a non-filled-in structure; this is a workaround for that. |
474 |
+ |
*/ |
475 |
|
struct uvmexp *uvm = get_uvmexp(); |
476 |
|
if (uvm == NULL) return 1; |
477 |
|
} |