sysinfo, procfs: Support memory info partially

Change-Id: I597dae4f82d64d3f23889cef960db18ae879ff06
refs: #1389
This commit is contained in:
Ken Sato
2020-04-07 12:55:52 +09:00
committed by Masamichi Takagi
parent 8e42c2a254
commit 8f74888f87
14 changed files with 506 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <mman.h>
#include <bitmap.h>
#include <init.h>
#include <rusage_private.h>
//#define DEBUG_PRINT_PROCFS
@ -359,6 +360,28 @@ static int _process_procfs_request(struct ikc_scd_packet *rpacket, int *result)
goto end;
}
#endif /* POSTK_DEBUG_ARCH_DEP_42 */
else if (!strcmp(p, "meminfo")) {
ans = snprintf(buf, count,
"MemTotal: %10d kB\n"
"MemFree: %10d kB\n"
"SwapTotal: %10d kB\n"
"SwapFree: %10d kB\n"
"CommitLimit: %10d kB\n"
"Committed_AS: %10d kB\n",
rusage_get_total_memory() >> 10,
rusage_get_free_memory() >> 10,
0, 0,
rusage_get_free_memory() >> 10,
rusage_get_usage_memory() >> 10);
if (ans < 0 || ans > count ||
buf_add(&buf_top, &buf_cur, buf, ans) < 0) {
goto err;
}
ans = 0;
goto end;
}
else {
kprintf("unsupported procfs entry: %s\n", p);
goto end;