27 #include <linux/oom.h> 47 return OOM_ADJUST_MIN;
52 return OOM_ADJUST_MAX;
57 std::stringstream ss; ss <<
"/proc/" << process.
pid() <<
"/oom_adj";
58 std::ifstream in(ss.str());
68 throw std::logic_error(
"Value for adjusting the oom score is invalid.");
70 std::stringstream ss; ss <<
"/proc/" << process.
pid() <<
"/oom_adj";
71 std::ofstream out(ss.str());
static int max_value()
Returns the maximum valid value.
The Process class models a process and possible operations on it.
static int disable_value()
Returns the value that makes a process "invisible" to the oom killer.
CORE_POSIX_DLL_PUBLIC const posix::Process & operator>>(const posix::Process &process, OomAdj &adj)
Read the OomAdj value for a process instance.
virtual pid_t pid() const
Query the pid of the process.
static int min_value()
Returns the minimum valid value.
bool is_valid() const
is_valid checks whether the contained value is within the predefined bounds.
CORE_POSIX_DLL_PUBLIC const posix::Process & operator<<(const posix::Process &process, const OomAdj &adj)
Write the OomAdj value for a process instance.