The reason is the same as in the analogous patch for wmwifi
in commit 1e34ea7f980; it improves considerably the efficiency.
Keeping the 'interval' unchanged (set to 1 sec), with this change
the number of wakeups as measured by powertop goes from around 14 wakeups/sec
to around 2 wakeup/sec.
Avoid the following compiler warning:
mem_linux.c: In function ‘mem_init’:
mem_linux.c:52:40: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
if (version == 2 && patchlevel >= 5 && sublevel >= 1 || \
^
Avoid multiple compiler warnings such as the following:
main.c: In function ‘update’:
main.c:157:4: warning: pointer targets in passing argument 1 of ‘mem_getusage’ differ in signedness [-Wpointer-sign]
mem_getusage(&mem_usage, &swap_usage, &mem_opts);
^
In file included from main.c:29:0:
mem.h:16:6: note: expected ‘int *’ but argument is of type ‘unsigned int *’
void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts);
^
Avoid the following compiler warning:
dockapp.c: In function ‘dockapp_open_window’:
dockapp.c:51:16: warning: variable ‘stat’ set but not used [-Wunused-but-set-variable]
Status stat;
^
Previously, kvm_read was used to get the memory usage in FreeBSD. However,
this has been deprecated in favor of sysctl. This patch implements this
change.
Some work had previously been done in this direction, as could be seen in
the file src/mem_freebsd_sysctl.c. Since this file is no longer needed, it
has been removed.
Additionally, some formatting has been done on the remaining older code for
a more consistent style.