[Asterisk-code-review] Fix showing of swap details when sysinfo() is available (asterisk[master])

Timo Teräs asteriskteam at digium.com
Fri Sep 9 06:39:53 CDT 2016


Timo Teräs has uploaded a new change for review.

  https://gerrit.asterisk.org/3871

Change subject: Fix showing of swap details when sysinfo() is available
......................................................................

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).

This also fixes resulting warnings:

   [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
---
M main/asterisk.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/71/3871/1

diff --git a/main/asterisk.c b/main/asterisk.c
index 3c2ca25..1e69ef6 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -853,7 +853,7 @@
 #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_SYSCTL) || 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

-- 
To view, visit https://gerrit.asterisk.org/3871
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fb21dad8f27e416c60f138c6f2bff03fb626eca
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Timo Teräs <timo.teras at iki.fi>



More information about the asterisk-code-review mailing list