1 |
|
/* |
2 |
|
* i-scream central monitoring system |
3 |
< |
* http://www.i-scream.org.uk |
4 |
< |
* Copyright (C) 2000-2002 i-scream |
3 |
> |
* http://www.i-scream.org |
4 |
> |
* Copyright (C) 2000-2003 i-scream |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or |
7 |
|
* modify it under the terms of the GNU General Public License |
33 |
|
#include <stdio.h> |
34 |
|
#include "tools.h" |
35 |
|
#endif |
36 |
+ |
#ifdef FREEBSD |
37 |
+ |
#include <sys/types.h> |
38 |
+ |
#include <sys/sysctl.h> |
39 |
+ |
#endif |
40 |
|
|
37 |
– |
|
41 |
|
static page_stat_t page_stats; |
42 |
|
static int page_stats_uninit=1; |
43 |
|
|
51 |
|
FILE *f; |
52 |
|
char *line_ptr; |
53 |
|
#endif |
54 |
+ |
#ifdef FREEBSD |
55 |
+ |
size_t size; |
56 |
+ |
#endif |
57 |
|
|
58 |
|
page_stats.pages_pagein=0; |
59 |
|
page_stats.pages_pageout=0; |
89 |
|
} |
90 |
|
page_stats.systime=time(NULL); |
91 |
|
fclose(f); |
92 |
+ |
|
93 |
+ |
#endif |
94 |
+ |
#ifdef FREEBSD |
95 |
+ |
size = sizeof page_stats.pages_pagein; |
96 |
+ |
if (sysctlbyname("vm.stats.vm.v_swappgsin", &page_stats.pages_pagein, &size, NULL, 0) < 0){ |
97 |
+ |
return NULL; |
98 |
+ |
} |
99 |
+ |
size = sizeof page_stats.pages_pageout; |
100 |
+ |
if (sysctlbyname("vm.stats.vm.v_swappgsout", &page_stats.pages_pageout, &size, NULL, 0) < 0){ |
101 |
+ |
return NULL; |
102 |
+ |
} |
103 |
|
|
104 |
|
#endif |
105 |
|
|