summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Tincman <sctincman@gmail.com>2012-11-13 20:29:55 -0500
committerMichael Stapelberg <michael@stapelberg.de>2012-11-15 12:31:17 +0100
commit0eeded8bc013857a5e8a2efbc20002a22502897e (patch)
tree340c1c11296923acbf2cc3b28c3299e8cb7730fb /src
parent2f20400d7af06d1a283bf727ce7af27f68f255f5 (diff)
DragonFlyBSD support added
Diffstat (limited to 'src')
-rw-r--r--src/print_battery_info.c4
-rw-r--r--src/print_cpu_temperature.c4
-rw-r--r--src/print_cpu_usage.c11
-rw-r--r--src/print_disk_info.c4
-rw-r--r--src/print_eth_info.c4
-rw-r--r--src/print_load.c2
-rw-r--r--src/print_volume.c4
-rw-r--r--src/print_wireless_info.c15
8 files changed, 34 insertions, 14 deletions
diff --git a/src/print_battery_info.c b/src/print_battery_info.c
index ae11348..1545609 100644
--- a/src/print_battery_info.c
+++ b/src/print_battery_info.c
@@ -9,7 +9,7 @@
#include "i3status.h"
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
@@ -186,7 +186,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char
}
}
}
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
int state;
int sysctl_rslt;
size_t sysctl_size = sizeof(sysctl_rslt);
diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c
index e3340f6..96fa4b7 100644
--- a/src/print_cpu_temperature.c
+++ b/src/print_cpu_temperature.c
@@ -8,7 +8,7 @@
#include "i3status.h"
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <err.h>
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -72,7 +72,7 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
if (colorful_output)
END_COLOR;
}
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
int sysctl_rslt;
size_t sysctl_size = sizeof(sysctl_rslt);
if (sysctlbyname(path, &sysctl_rslt, &sysctl_size, NULL, 0))
diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c
index ed17db3..ecc81a2 100644
--- a/src/print_cpu_usage.c
+++ b/src/print_cpu_usage.c
@@ -13,6 +13,13 @@
#include <sys/dkstat.h>
#endif
+#if defined(__DragonFly__)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/resource.h>
+#endif
+
#include "i3status.h"
static int prev_total = 0;
@@ -43,9 +50,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__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
size_t size;
long cp_time[CPUSTATES];
size = sizeof cp_time;
diff --git a/src/print_disk_info.c b/src/print_disk_info.c
index b577d23..f49fe66 100644
--- a/src/print_disk_info.c
+++ b/src/print_disk_info.c
@@ -6,7 +6,7 @@
#include <stdint.h>
#include <sys/statvfs.h>
#include <sys/types.h>
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__)
#include <sys/param.h>
#include <sys/mount.h>
#endif
@@ -49,7 +49,7 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
INSTANCE(path);
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
struct statfs buf;
if (statfs(path, &buf) == -1)
diff --git a/src/print_eth_info.c b/src/print_eth_info.c
index d09873e..8af0dec 100644
--- a/src/print_eth_info.c
+++ b/src/print_eth_info.c
@@ -19,7 +19,7 @@
#define PART_ETHSPEED "E: %s (%d Mbit/s)"
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <net/if_media.h>
#define IFM_TYPE_MATCH(dt, t) \
(IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t)))
@@ -47,7 +47,7 @@ static int print_eth_speed(char *outwalk, const char *interface) {
ethspeed = (ecmd.speed == USHRT_MAX ? 0 : ecmd.speed);
return sprintf(outwalk, "%d Mbit/s", ethspeed);
} else return sprintf(outwalk, "?");
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
char *ethspeed;
struct ifmediareq ifm;
(void)memset(&ifm, 0, sizeof(ifm));
diff --git a/src/print_load.c b/src/print_load.c
index 7fd54ca..5281472 100644
--- a/src/print_load.c
+++ b/src/print_load.c
@@ -10,7 +10,7 @@ void print_load(yajl_gen json_gen, char *buffer, const char *format) {
char *outwalk = buffer;
/* Get load */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__DragonFly__)
double loadavg[3];
const char *walk;
diff --git a/src/print_volume.c b/src/print_volume.c
index 9c69d08..080dea2 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -11,7 +11,7 @@
#include <alloca.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <fcntl.h>
#include <unistd.h>
#include <sys/soundcard.h>
@@ -174,7 +174,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
}
}
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
char mixerpath[] = "/dev/mixer";
int mixfd, vol, devmask = 0;
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 1eddd96..9ab9c2f 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -25,6 +25,19 @@
#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
#endif
+#ifdef __DragonFly__
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <netproto/802_11/ieee80211.h>
+#include <netproto/802_11/ieee80211_ioctl.h>
+#include <unistd.h>
+#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
+#endif
+
#ifdef __OpenBSD__
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -170,7 +183,7 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
close(skfd);
return 1;
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
int s, len, inwid;
uint8_t buf[24 * 1024], *cp;
struct ieee80211req na;