summaryrefslogtreecommitdiff
path: root/src/print_mem.c
diff options
context:
space:
mode:
authorThomas Klausner <tk@giga.or.at>2019-07-29 22:46:20 +0200
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2019-07-29 13:46:20 -0700
commit5aec4a5da32e9a1fad1a89f17b10d676d4312895 (patch)
tree58b31dc403b238690e5dd3f6a994b2c7d7320d36 /src/print_mem.c
parente84f9588dfca3023f77fcc7d320c70945d852f9d (diff)
Improve NetBSD port. (#361)
Detect and link against ossaudio. Comment out unused code and functions.
Diffstat (limited to 'src/print_mem.c')
-rw-r--r--src/print_mem.c7
1 files changed, 7 insertions, 0 deletions
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;