process-cpp: core::posix::linux::proc::process::OomAdj Struct Reference

process-cpp 3.0.0 A simple convenience library for handling processes in C++11.

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
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

## ◆ disable_value()

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.

## ◆ is_valid()

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<<().

## ◆ max_value()

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().

## ◆ min_value()

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

## ◆ value

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

Current value.

Definition at line 82 of file oom_adj.h.

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

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

- /build/process-cpp/src/process-cpp-3.0.1/include/core/posix/linux/proc/process/oom_adj.h
- /build/process-cpp/src/process-cpp-3.0.1/src/core/posix/linux/proc/process/oom_adj.cpp