DragonFlyBSD support added
This commit is contained in:
parent
2f20400d7a
commit
0eeded8bc0
7
Makefile
7
Makefile
@ -39,6 +39,13 @@ LDFLAGS+=-L/usr/local/lib/
|
||||
LIBS+=-lossaudio
|
||||
endif
|
||||
|
||||
# This probably applies for any pkgsrc based system
|
||||
ifeq ($(shell uname),DragonFly)
|
||||
CFLAGS+=-I/usr/pkg/include/
|
||||
LDFLAGS+=-L/usr/pkg/lib/
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS+=$(EXTRA_CFLAGS)
|
||||
|
||||
# Fallback for libyajl 1 which did not include yajl_version.h. We need
|
||||
|
@ -18,10 +18,14 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_format;
|
||||
|
||||
#define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
|
||||
/* this needs the coretemp module to be loaded */
|
||||
#if defined(__DragonFly__)
|
||||
#define THERMAL_ZONE "hw.sensors.cpu%d.temp0"
|
||||
#else
|
||||
#define THERMAL_ZONE "dev.cpu.%d.temperature"
|
||||
#endif
|
||||
#define BATT_LIFE "hw.acpi.battery.life"
|
||||
#define BATT_TIME "hw.acpi.battery.time"
|
||||
#define BATT_STATE "hw.acpi.battery.state"
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user