1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
Index: superkaramba/src/memsensor.cpp
===================================================================
--- superkaramba/src/memsensor.cpp (revision 487000)
+++ superkaramba/src/memsensor.cpp (revision 487001)
@@ -14,7 +14,7 @@
#include <qstring.h>
#include <qregexp.h>
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
#include <sys/time.h>
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -32,14 +32,14 @@
#include <sys/swap.h>
#endif
-#if defined __FreeBSD__ || defined(Q_OS_NETBSD)
+#if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD)
/* define pagetok in terms of pageshift */
#define pagetok(size) ((size) << pageshift)
#endif
MemSensor::MemSensor(int msec) : Sensor(msec)
{
-#if defined __FreeBSD__ || defined(Q_OS_NETBSD)
+#if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD)
/* get the page size with "getpagesize" and calculate pageshift from it */
int pagesize = getpagesize();
pageshift = 0;
@@ -51,7 +51,7 @@
/* we only need the amount of log(2)1024 for our conversion */
pageshift -= 10;
-# if (defined(__FreeBSD__) && __FreeBSD_version < 500018)
+# if (defined(Q_OS_FREEBSD) && __FreeBSD_version < 500018)
connect(&ksp, SIGNAL(receivedStdout(KProcess *, char *, int )),
this,SLOT(receivedStdout(KProcess *, char *, int )));
connect(&ksp, SIGNAL(processExited(KProcess *)),
@@ -62,7 +62,7 @@
MaxSet = false;
readValues();
-# elif defined __FreeBSD__
+# elif defined Q_OS_FREEBSD
kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open");
# endif
#else
@@ -73,7 +73,7 @@
MemSensor::~MemSensor()
{}
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
void MemSensor::receivedStdout(KProcess *, char *buffer, int len )
{
buffer[len] = 0;
@@ -87,7 +87,7 @@
void MemSensor::processExited(KProcess *)
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
QStringList stringList = QStringList::split('\n',sensorResult);
sensorResult = "";
QStringList itemsList = QStringList::split(' ', stringList[1]);
@@ -99,7 +99,7 @@
int MemSensor::getMemTotal()
{
-#if defined __FreeBSD || defined(Q_OS_NETBSD)
+#if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD)
static int mem = 0;
size_t size = sizeof(mem);
@@ -114,7 +114,7 @@
int MemSensor::getMemFree()
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
static int mem = 0;
size_t size = sizeof(mem);
@@ -138,7 +138,7 @@
int MemSensor::getBuffers()
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
static int mem = 0;
size_t size = sizeof(mem);
@@ -159,7 +159,7 @@
int MemSensor::getCached()
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
static int mem = 0;
size_t size = sizeof(mem);
@@ -179,7 +179,7 @@
int MemSensor::getSwapTotal()
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
# if __FreeBSD_version < 500018
return(swapTotal);
# else
@@ -221,7 +221,7 @@
int MemSensor::getSwapFree()
{
-#ifdef __FreeBSD__
+#ifdef Q_OS_FREEBSD
# if __FreeBSD_version < 500018
return(swapTotal - swapUsed);
# else
@@ -266,8 +266,8 @@
void MemSensor::readValues()
{
-#if defined __FreeBSD__ || defined(Q_OS_NETBSD)
-# if (defined(__FreeBSD__) && __FreeBSD_version < 500018)
+#if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD)
+# if (defined(Q_OS_FREEBSD) && __FreeBSD_version < 500018)
ksp.clearArguments();
ksp << "swapinfo";
ksp.start( KProcess::NotifyOnExit,KProcIO::Stdout);
@@ -291,7 +291,7 @@
SensorParams *sp;
Meter *meter;
QObjectListIt it( *objList );
-#if (defined(__FreeBSD__) && __FreeBSD_version < 500018)
+#if (defined(Q_OS_FREEBSD) && __FreeBSD_version < 500018)
bool set = false;
#endif
int totalMem = getMemTotal();
@@ -303,7 +303,7 @@
while (it != 0)
{
sp = (SensorParams*)(*it);
-#if (defined(__FreeBSD__) && __FreeBSD_version < 500018)
+#if (defined(Q_OS_FREEBSD) && __FreeBSD_version < 500018)
if ( (!MaxSet) && (totalSwap > 0) ) {
setMaxValue(sp);
bool set = true;
@@ -331,7 +331,7 @@
meter->setValue(format);
++it;
}
-#if (defined(__FreeBSD__) && __FreeBSD_version < 500018)
+#if (defined(Q_OS_FREEBSD) && __FreeBSD_version < 500018)
if (set)
MaxSet = true;
#endif
|