summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-09-09 14:35:43 +0300
committerJoshua Colp <jcolp@digium.com>2016-09-16 08:58:55 -0500
commit01884a7af637bd92511b2f85378afea1e42f76bf (patch)
treeb9072ce708a98d597e274b261e8e58ac8d5a6f90 /main
parent11d05fc3699aa3547be722b83529bfecbe15ee4f (diff)
Fix showing of swap details when sysinfo() is available
If sysinfo() is available, but not sysctl() or swapctl() the printing code for swap buffer sizes is incorrectly omitted. The above condition happens with musl c-library. Fix #if rule to consider defined(HAVE_SYSINFO). And also remove the redundant || defined(HAVE_SYSCTL) which was incorrectly there to start with. Now swap information is displayed only if an actual libc function to get it is available. This also fixes warnings previously seen with musl libc: [CC] asterisk.c -> asterisk.o asterisk.c: In function 'handle_show_sysinfo': asterisk.c:773:6: warning: variable 'totalswap' set but not used [-Wunused-but-set-variable] int totalswap = 0; ^~~~~~~~~ asterisk.c:770:11: warning: variable 'freeswap' set but not used [-Wunused-but-set-variable] uint64_t freeswap = 0; ^~~~~~~~ Change-Id: I1fb21dad8f27e416c60f138c6f2bff03fb626eca
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index b8eedfa38..7f58f9113 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -863,7 +863,7 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl
#if defined(HAVE_SYSINFO)
ast_cli(a->fd, " Buffer RAM: %" PRIu64 " KiB\n", ((uint64_t) sys_info.bufferram * sys_info.mem_unit) / 1024);
#endif
-#if defined (HAVE_SYSCTL) || defined(HAVE_SWAPCTL)
+#if defined(HAVE_SWAPCTL) || defined(HAVE_SYSINFO)
ast_cli(a->fd, " Total Swap Space: %d KiB\n", totalswap);
ast_cli(a->fd, " Free Swap Space: %" PRIu64 " KiB\n\n", freeswap);
#endif