Allow to print cpu usage on NetBSD
Patch status: merged
Patch by Arnaud Degroote
To apply this patch, use:
curl http://cr.i3wm.org/patch/252/raw.patch | git am
b/src/print_cpu_usage.c
13 |
@@ -20,6 +20,13 @@ |
14 |
#include <sys/resource.h> |
15 |
#endif |
16 |
|
17 |
+#if defined(__NetBSD__) |
18 |
+#include <sys/param.h> |
19 |
+#include <sys/resource.h> |
20 |
+#include <sys/sysctl.h> |
21 |
+#include <sys/sched.h> |
22 |
+#endif |
23 |
+ |
24 |
#include "i3status.h" |
25 |
|
26 |
static int prev_total = 0; |
27 |
@@ -50,9 +57,9 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format) { |
28 |
diff_usage = (diff_total ? (1000 * (diff_total - diff_idle)/diff_total + 5)/10 : 0); |
29 |
prev_total = curr_total; |
30 |
prev_idle = curr_idle; |
31 |
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
32 |
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
33 |
|
34 |
-#if defined(__FreeBSD__) || defined(__DragonFly__) |
35 |
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) |
36 |
size_t size; |
37 |
long cp_time[CPUSTATES]; |
38 |
size = sizeof cp_time; |