summaryrefslogtreecommitdiff
path: root/chat/spectrum/patches/patch-src_spectrum_util.cpp
blob: ceb3a9fa76183ea8e2486eca9a78de921fe2d5e0 (plain)
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
$NetBSD: patch-src_spectrum_util.cpp,v 1.2 2011/10/28 17:34:07 schnoebe Exp $

# revise the memory usage statistics handling to work only on FreeBSD
# (where it was designed.)
# pushed upstream as http://spectrum.im/issues/232

--- src/spectrum_util.cpp.orig	2011-06-11 13:17:44.000000000 +0000
+++ src/spectrum_util.cpp
@@ -28,7 +28,7 @@
 #include "protocols/abstractprotocol.h"
 #include "transport.h"
 #include <sys/param.h>
-#ifdef BSD
+#if defined(__FreeBSD_version) /* should also include a tested version, but */
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #include <sys/param.h>
@@ -117,7 +117,7 @@ const std::string generateUUID() {
 }
 
 #ifndef WIN32
-#ifdef BSD
+#ifdef __FreeBSD_version
 void process_mem_usage(double& vm_usage, double& resident_set) {
 	int mib[4];
 	size_t size;
@@ -151,7 +151,7 @@ void process_mem_usage(double& vm_usage,
 	resident_set = (double) (proc.ki_rssize * pagesize / 1024);
 	vm_usage = (double) proc.ki_size;
 }
-#else /* BSD */
+#else /* __FreeBSD_version */
 void process_mem_usage(double& vm_usage, double& resident_set) {
 	using std::ios_base;
 	using std::ifstream;
@@ -190,7 +190,7 @@ void process_mem_usage(double& vm_usage,
 	vm_usage     = vsize / 1024.0;
 	resident_set = rss * page_size_kb;
 }
-#endif /* else BSD */
+#endif /* else __FreeBSD_version */
 #endif /* WIN32 */
 
 std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {