diff --git a/configure.ac b/configure.ac index 11caa33..c6750e3 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,7 @@ case $host_os in ;; netbsd*) AC_SEARCH_LIBS([prop_string_create], [prop]) + AC_SEARCH_LIBS([_oss_ioctl], [ossaudio]) ;; esac diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index 7de42f9..979e082 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -46,7 +46,9 @@ struct cpu_usage { int total; }; +#if defined(__linux__) static int cpu_count = 0; +#endif static struct cpu_usage prev_all = {0, 0, 0, 0, 0}; static struct cpu_usage *prev_cpus = NULL; static struct cpu_usage *curr_cpus = NULL; diff --git a/src/print_mem.c b/src/print_mem.c index 840f997..413067e 100644 --- a/src/print_mem.c +++ b/src/print_mem.c @@ -10,10 +10,14 @@ #define BINARY_BASE UINT64_C(1024) #define MAX_EXPONENT 4 + +#if defined(linux) static const char *const iec_symbols[MAX_EXPONENT + 1] = {"", "Ki", "Mi", "Gi", "Ti"}; static const char memoryfile_linux[] = "/proc/meminfo"; +#endif +#if defined(linux) /* * Prints the given amount of bytes in a human readable manner. * @@ -28,7 +32,9 @@ static int print_bytes_human(char *outwalk, uint64_t bytes) { } return sprintf(outwalk, "%.1f %sB", size, iec_symbols[exponent]); } +#endif +#if defined(linux) /* * Convert a string to its absolute representation based on the total * memory of `mem_total`. @@ -72,6 +78,7 @@ static long memory_absolute(const long mem_total, const char *size) { return mem_absolute; } +#endif void print_memory(yajl_gen json_gen, char *buffer, const char *format, const char *format_degraded, const char *threshold_degraded, const char *threshold_critical, const char *memory_used_method) { char *outwalk = buffer; diff --git a/src/print_volume.c b/src/print_volume.c index 7364d47..575024a 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -15,13 +15,13 @@ #include #endif -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) #include #include #include #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) #include #include #include @@ -248,7 +248,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * snd_mixer_selem_id_free(sid); #endif -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) char *mixerpath; char defaultmixer[] = "/dev/mixer"; int mixfd, vol, devmask = 0;