Skip to content
Snippets Groups Projects
Commit d9e42f27 authored by Alexander Traud's avatar Alexander Traud
Browse files

core: Fix unused variable error in handle_show_sysinfo.

The previous fix broke the case
HAVE_SYSINFO = no
HAVE_SYSCTL = yes
HAVE_SWAPCTL = no
which occurs on FreeBSD 11.1 for example.

ASTERISK-26563

Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a
parent da585924
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment