char *eol;
while (*memstat) {
- if (startswith(memstat, "cache")) {
- sscanf(memstat + 5, "%lu", cached);
+ if (startswith(memstat, "total_cache")) {
+ sscanf(memstat + 11, "%lu", cached);
*cached /= 1024;
- } else if (startswith(memstat, "active_anon")) {
- sscanf(memstat + 11, "%lu", active_anon);
+ } else if (startswith(memstat, "total_active_anon")) {
+ sscanf(memstat + 17, "%lu", active_anon);
*active_anon /= 1024;
- } else if (startswith(memstat, "inactive_anon")) {
- sscanf(memstat + 13, "%lu", inactive_anon);
+ } else if (startswith(memstat, "total_inactive_anon")) {
+ sscanf(memstat + 19, "%lu", inactive_anon);
*inactive_anon /= 1024;
- } else if (startswith(memstat, "active_file")) {
- sscanf(memstat + 11, "%lu", active_file);
+ } else if (startswith(memstat, "total_active_file")) {
+ sscanf(memstat + 17, "%lu", active_file);
*active_file /= 1024;
- } else if (startswith(memstat, "inactive_file")) {
- sscanf(memstat + 13, "%lu", inactive_file);
+ } else if (startswith(memstat, "total_inactive_file")) {
+ sscanf(memstat + 19, "%lu", inactive_file);
*inactive_file /= 1024;
- } else if (startswith(memstat, "unevictable")) {
- sscanf(memstat + 11, "%lu", unevictable);
+ } else if (startswith(memstat, "total_unevictable")) {
+ sscanf(memstat + 17, "%lu", unevictable);
*unevictable /= 1024;
}
eol = strchr(memstat, '\n');
snprintf(lbuf, 100, "MemFree: %8lu kB\n", memlimit - memusage);
printme = lbuf;
} else if (startswith(line, "MemAvailable:")) {
- snprintf(lbuf, 100, "MemAvailable: %8lu kB\n", memlimit - memusage);
+ snprintf(lbuf, 100, "MemAvailable: %8lu kB\n", memlimit - memusage + cached);
printme = lbuf;
} else if (startswith(line, "SwapTotal:") && memswlimit > 0) {
sscanf(line+sizeof("SwapTotal:")-1, "%lu", &hostswtotal);
return procage;
}
-static uint64_t get_reaper_btime(pid)
-{
- int ret;
- struct sysinfo sys;
- uint64_t procstart;
- uint64_t uptime;
-
- ret = sysinfo(&sys);
- if (ret < 0) {
- lxcfs_debug("%s\n", "failed to retrieve system information");
- return 0;
- }
-
- uptime = (uint64_t)time(NULL) - (uint64_t)sys.uptime;
- procstart = get_reaper_start_time_in_sec(pid);
- return uptime + procstart;
-}
-
#define CPUALL_MAX_SIZE (BUF_RESERVE_SIZE / 2)
static int proc_stat_read(char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)