in src/oomd/util/Fs.cpp [338:357]
SystemMaybe<bool> Fs::readIsPopulatedAt(const DirFd& dirfd) {
auto lines = readFileByLine(Fs::Fd::openat(dirfd, kEventsFile));
if (!lines) {
return SYSTEM_ERROR(lines.error());
}
for (const auto& line : *lines) {
std::vector<std::string> toks = Util::split(line, ' ');
if (toks.size() == 2 && toks[0] == "populated") {
if (toks[1] == "1") {
return true;
} else if (toks[1] == "0") {
return false;
} else {
return SYSTEM_ERROR(EINVAL);
}
}
}
return SYSTEM_ERROR(EINVAL);
}