diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2018-01-29 11:45:27 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2018-01-29 11:45:27 -0600 |
commit | 21bcd85bba7d542757a940aaf4ee118dc2a6c4e5 (patch) | |
tree | 2ef8542955180d499329b1a7b7642ace55d5fa1f /main/asterisk.c | |
parent | 1e44d50893add67cf117f9b0ca8a1c20c3daea34 (diff) | |
parent | d9e42f27b9cd6db321f8e25e58dc1748ab1dc7bc (diff) |
Merge "core: Fix unused variable error in handle_show_sysinfo."
Diffstat (limited to 'main/asterisk.c')
-rw-r--r-- | main/asterisk.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 39c97d2c1..0214159d6 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -714,12 +714,6 @@ static int swapmode(int *used, int *total) ast_free(swdev); return 1; } -#elif defined(HAVE_SYSCTL) && !defined(HAVE_SYSINFO) -static int swapmode(int *used, int *total) -{ - *used = *total = 0; - return 1; -} #endif #if defined(HAVE_SYSINFO) || defined(HAVE_SYSCTL) @@ -728,11 +722,11 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl { uint64_t physmem, freeram; #if defined(HAVE_SYSINFO) || defined(HAVE_SWAPCTL) + int totalswap = 0; uint64_t freeswap = 0; #endif int nprocs = 0; long uptime = 0; - int totalswap = 0; #if defined(HAVE_SYSINFO) struct sysinfo sys_info; #elif defined(HAVE_SYSCTL) @@ -740,7 +734,10 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl struct vmtotal vmtotal; struct timeval boottime; time_t now; - int mib[2], pagesize, usedswap = 0; + int mib[2], pagesize; +#if defined(HAVE_SWAPCTL) + int usedswap = 0; +#endif size_t len; #endif @@ -800,8 +797,10 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl sysctl(mib, 2, &vmtotal, &len, NULL, 0); freeram = (vmtotal.t_free << pageshift); /* generate swap usage and totals */ +#if defined(HAVE_SWAPCTL) swapmode(&usedswap, &totalswap); freeswap = (totalswap - usedswap); +#endif /* grab number of processes */ #if defined(__OpenBSD__) mib[0] = CTL_KERN; |