Improve NetBSD port. (#361)

Detect and link against ossaudio.

Comment out unused code and functions.
This commit is contained in:
Thomas Klausner 2019-07-29 22:46:20 +02:00 committed by Michael Stapelberg
parent e84f9588df
commit 5aec4a5da3
4 changed files with 13 additions and 3 deletions

View File

@ -101,6 +101,7 @@ case $host_os in
;;
netbsd*)
AC_SEARCH_LIBS([prop_string_create], [prop])
AC_SEARCH_LIBS([_oss_ioctl], [ossaudio])
;;
esac

View File

@ -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;

View File

@ -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;

View File

@ -15,13 +15,13 @@
#include <math.h>
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
#include <fcntl.h>
#include <unistd.h>
#include <sys/soundcard.h>
#endif
#ifdef __OpenBSD__
#if defined(__OpenBSD__)
#include <fcntl.h>
#include <unistd.h>
#include <sys/audioio.h>
@ -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;