static void parse_memstat(char *memstat, unsigned long *cached,
unsigned long *active_anon, unsigned long *inactive_anon,
unsigned long *active_file, unsigned long *inactive_file,
- unsigned long *unevictable)
+ unsigned long *unevictable, unsigned long *shmem)
{
char *eol;
} else if (startswith(memstat, "total_unevictable")) {
sscanf(memstat + 17, "%lu", unevictable);
*unevictable /= 1024;
+ } else if (startswith(memstat, "total_shmem")) {
+ sscanf(memstat + 11, "%lu", shmem);
+ *shmem /= 1024;
}
eol = strchr(memstat, '\n');
if (!eol)
*memswlimit_str = NULL, *memswusage_str = NULL;
unsigned long memlimit = 0, memusage = 0, memswlimit = 0, memswusage = 0,
cached = 0, hosttotal = 0, active_anon = 0, inactive_anon = 0,
- active_file = 0, inactive_file = 0, unevictable = 0,
+ active_file = 0, inactive_file = 0, unevictable = 0, shmem = 0,
hostswtotal = 0;
char *line = NULL;
size_t linelen = 0, total_len = 0, rv = 0;
parse_memstat(memstat_str, &cached, &active_anon,
&inactive_anon, &active_file, &inactive_file,
- &unevictable);
+ &unevictable, &shmem);
f = fopen("/proc/meminfo", "r");
if (!f)
} else if (startswith(line, "SUnreclaim")) {
snprintf(lbuf, 100, "SUnreclaim: %8lu kB\n", 0UL);
printme = lbuf;
+ } else if (startswith(line, "Shmem:")) {
+ snprintf(lbuf, 100, "Shmem: %8lu kB\n", shmem);
+ printme = lbuf;
} else
printme = line;