ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.8 by ats, Sun Oct 19 00:25:30 2003 UTC vs.
Revision 1.9 by ats, Sun Oct 19 02:03:02 2003 UTC

# Line 27 | Line 27
27   #include <stdlib.h>
28   #include <sys/types.h>
29   #include <regex.h>
30 < #ifdef FREEBSD
30 > #ifdef ALLBSD
31   #include <fcntl.h>
32   #include <kvm.h>
33   #endif
34 + #ifdef NETBSD
35 + #include <uvm/uvm_extern.h>
36 + #endif
37  
38   #include "tools.h"
39  
# Line 69 | Line 72 | long long get_ll_match(char *line, regmatch_t *match){
72   }
73   #endif
74  
75 < #ifdef FREEBSD
75 > #ifdef ALLBSD
76   kvm_t *get_kvm() {
77          static kvm_t *kvmd = NULL;
78  
# Line 81 | Line 84 | kvm_t *get_kvm() {
84          return kvmd;
85   }
86   #endif
87 +
88 + #ifdef NETBSD
89 + struct uvmexp *get_uvmexp() {
90 +        static u_long addr = 0;
91 +        static struct uvmexp uvm;
92 +        kvm_t *kvmd = get_kvm();
93 +
94 +        if (kvmd == NULL) {
95 +                return NULL;
96 +        }
97 +
98 +        if (addr == 0) {
99 +                struct nlist symbols[] = {
100 +                        { "_uvmexp" },
101 +                        { NULL }
102 +                };
103 +
104 +                if (kvm_nlist(kvmd, symbols) != 0) {
105 +                        return NULL;
106 +                }
107 +                addr = symbols[0].n_value;
108 +        }
109 +
110 +        if (kvm_read(kvmd, addr, &uvm, sizeof uvm) != sizeof uvm) {
111 +                return NULL;
112 +        }
113 +        return &uvm;
114 + }
115 + #endif
116 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines