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

Comparing projects/libstatgrab/src/libstatgrab/memory_stats.c (file contents):
Revision 1.21 by tdb, Fri Feb 13 16:46:21 2004 UTC vs.
Revision 1.25 by tdb, Tue Apr 6 14:52:58 2004 UTC

# Line 1 | Line 1
1   /*
2 < * i-scream central monitoring system
2 > * i-scream libstatgrab
3   * http://www.i-scream.org
4   * Copyright (C) 2000-2004 i-scream
5   *
# Line 35 | Line 35
35   #include <stdio.h>
36   #include <string.h>
37   #endif
38 < #ifdef FREEBSD
38 > #if defined(FREEBSD) || defined(DFBSD)
39   #include <sys/types.h>
40   #include <sys/sysctl.h>
41   #include <unistd.h>
42   #endif
43   #if defined(NETBSD) || defined(OPENBSD)
44   #include <sys/param.h>
45 + #include <sys/time.h>
46   #include <uvm/uvm.h>
47   #endif
48  
49 < mem_stat_t *get_memory_stats(){
49 > sg_mem_stats *sg_get_mem_stats(){
50  
51 <        static mem_stat_t mem_stat;
51 >        static sg_mem_stats mem_stat;
52  
53   #ifdef SOLARIS
54          kstat_ctl_t *kc;
# Line 61 | Line 62 | mem_stat_t *get_memory_stats(){
62          unsigned long long value;
63          FILE *f;
64   #endif
65 < #ifdef FREEBSD
65 > #if defined(FREEBSD) || defined(DFBSD)
66          int mib[2];
67          u_long physmem;
68          size_t size;
# Line 107 | Line 108 | mem_stat_t *get_memory_stats(){
108                  return NULL;
109          }
110  
111 <        while ((line_ptr = f_read_line(f, "")) != NULL) {
111 >        while ((line_ptr = sg_f_read_line(f, "")) != NULL) {
112                  if (sscanf(line_ptr, "%*s %llu kB", &value) != 1) {
113                          continue;
114                  }
# Line 126 | Line 127 | mem_stat_t *get_memory_stats(){
127          mem_stat.used = mem_stat.total - mem_stat.free;
128   #endif
129  
130 < #ifdef FREEBSD
130 > #if defined(FREEBSD) || defined(DFBSD)
131          /* Returns bytes */
132          mib[0] = CTL_HW;
133          mib[1] = HW_PHYSMEM;
# Line 170 | Line 171 | mem_stat_t *get_memory_stats(){
171   #endif
172  
173   #if defined(NETBSD) || defined(OPENBSD)
174 <        if ((uvm = get_uvmexp()) == NULL) {
174 >        if ((uvm = sg_get_uvmexp()) == NULL) {
175                  return NULL;
176          }
177  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines