process-cpp  3.0.0
A simple convenience library for handling processes in C++11.
core::posix::linux::proc::process::OomAdj Struct Reference

#include <oom_adj.h>

+ Collaboration diagram for core::posix::linux::proc::process::OomAdj:

Public Member Functions

bool is_valid () const
 is_valid checks whether the contained value is within the predefined bounds. More...
 

Static Public Member Functions

static int disable_value ()
 Returns the value that makes a process "invisible" to the oom killer. More...
 
static int min_value ()
 Returns the minimum valid value. More...
 
static int max_value ()
 Returns the maximum valid value. More...
 

Public Attributes

int value
 Current value. More...
 

Detailed Description

This file can be used to adjust the score used to select which process should be killed in an out-of-memory (OOM) situation. The kernel uses this value for a bit-shift operation of the process's oom_score value: valid values are in the range -16 to +15, plus the special value -17, which disables OOM-killing altogether for this process. A positive score increases the likelihood of this process being killed by the OOM-killer; a negative score decreases the likelihood.

The default value for this file is 0; a new process inherits its parent's oom_adj setting. A process must be privileged (CAP_SYS_RESOURCE) to update this file.

Since Linux 2.6.36, use of this file is deprecated in favor of /proc/[pid]/oom_score_adj.

Definition at line 50 of file oom_adj.h.

Member Function Documentation

int core::posix::linux::proc::process::OomAdj::disable_value ( )
static

Returns the value that makes a process "invisible" to the oom killer.

Returns
Returns the value that makes a process "invisible" to the oom killer.

Definition at line 40 of file oom_adj.cpp.

bool core::posix::linux::proc::process::OomAdj::is_valid ( ) const
inline

is_valid checks whether the contained value is within the predefined bounds.

Returns
true iff min_value() <= value <= max_value().

Definition at line 74 of file oom_adj.h.

Referenced by core::posix::linux::proc::process::operator<<().

int core::posix::linux::proc::process::OomAdj::max_value ( )
static

Returns the maximum valid value.

Returns
The maximum valid value that the OomAdj can be set to.

Definition at line 50 of file oom_adj.cpp.

Referenced by TEST().

int core::posix::linux::proc::process::OomAdj::min_value ( )
static

Returns the minimum valid value.

Returns
The minimum valid value that the OomAdj can be set to.

Definition at line 45 of file oom_adj.cpp.

Referenced by TEST().

Member Data Documentation

int core::posix::linux::proc::process::OomAdj::value

The documentation for this struct was generated from the following files: