Fix RAM component on FreeBSD - slstatus - status monitor | |
git clone git://git.suckless.org/slstatus | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 77bfb76a971ed8d114fc12db70d8bfeef923510e | |
parent 3c47701aea6bdb1e27c9b2039c07321077764f45 | |
Author: [email protected] <[email protected]> | |
Date: Fri, 1 Jan 2021 17:04:36 +0100 | |
Fix RAM component on FreeBSD | |
The current implementation uses the wrong type for | |
given sysctl calls leading to overflow and incorrectly | |
reported RAM usage. The fix is to use 'unsigned int' | |
which is what FreeBSD expects. | |
Diffstat: | |
M components/ram.c | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/components/ram.c b/components/ram.c | |
@@ -178,7 +178,7 @@ | |
const char * | |
ram_total(void) { | |
- long npages; | |
+ unsigned int npages; | |
size_t len; | |
len = sizeof(npages); | |
@@ -191,8 +191,8 @@ | |
const char * | |
ram_perc(void) { | |
- long npages; | |
- long active; | |
+ unsigned int npages; | |
+ unsigned int active; | |
size_t len; | |
len = sizeof(npages); | |
@@ -209,7 +209,7 @@ | |
const char * | |
ram_used(void) { | |
- long active; | |
+ unsigned int active; | |
size_t len; | |
len = sizeof(active); |