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

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

# Line 55 | Line 55 | swap_stat_t *get_swap_stats(){
55          int pagesize;
56          kvm_t *kvmd;
57   #endif
58 + #ifdef NETBSD
59 +        struct uvmexp *uvm;
60 + #endif
61  
62   #ifdef SOLARIS
63          if((pagesize=sysconf(_SC_PAGESIZE)) == -1){
# Line 93 | Line 96 | swap_stat_t *get_swap_stats(){
96          swap_stat.total= (long long)swapinfo.ksw_total * (long long)pagesize;
97          swap_stat.used = (long long)swapinfo.ksw_used * (long long)pagesize;
98          swap_stat.free = swap_stat.total-swap_stat.used;
99 + #endif
100 + #ifdef NETBSD
101 +        if ((uvm = get_uvmexp()) == NULL) {
102 +                return NULL;
103 +        }
104 +
105 +        swap_stat.total = (long long)uvm->pagesize * (long long)uvm->swpages;
106 +        swap_stat.used = (long long)uvm->pagesize * (long long)uvm->swpginuse;
107 +        swap_stat.free = swap_stat.total - swap_stat.used;
108   #endif
109          return &swap_stat;
110  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines