]> git.sur5r.net Git - i3/i3status/commitdiff
Allow to print cpu usage on NetBSD
authorArnaud Degroote <degroote@NetBSD.org>
Sun, 6 Oct 2013 18:13:29 +0000 (18:13 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 7 Oct 2013 17:31:01 +0000 (19:31 +0200)
src/print_cpu_usage.c

index ecc81a2e50c9fcd9a716625ba30d26b94e178514..80944c54efad7534a9217cc895e9501a26f84df5 100644 (file)
 #include <sys/resource.h>
 #endif
 
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <sys/sched.h>
+#endif
+
 #include "i3status.h"
 
 static int prev_total = 0;
@@ -50,9 +57,9 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format) {
         diff_usage = (diff_total ? (1000 * (diff_total - diff_idle)/diff_total + 5)/10 : 0);
         prev_total = curr_total;
         prev_idle  = curr_idle;
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 
-#if defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
         size_t size;
         long cp_time[CPUSTATES];
         size = sizeof cp_time;