oom-kill-protect 1 user commands nosh
oom-kill-protect set the protection level against the kernel's Out Of Memory Killer
`oom-kill-protect` level next-prog

## Description

`oom-kill-protect` is a chain-loading utility that sets the OOM Kill protection according to level and then chain loads to next-prog with the execvp 3 function.

next-prog may contain its own command line options, which `oom-kill-protect` will ignore.

If level is the literal value `fromenv` (in lowercase) then `oom-kill-protect` locates the `oomprotect` environment variable and replaces level with its value. This is a special mechanism for enabling rcctl 1 (a.k.a. system-control 1 `set-service-env`) to control the OOM Kill protection settings of services by setting an `oomprotect` variable for each service.

Otherwise, level can be the literal values `true`, `false`, `on`, `off`, `yes`, `no`, or a signed decimal integer. The literal integer is a Linux-style OOM Score adjustment. The others are boolean flag states.

On BSDs, OOM Killer protection is a binary value; it is either on or off for a process. The boolean settings map directly. The OOM Score adjustment is mapped such that a value equal to or less than -1000 implies that protection is on; and higher values imply that protection is off. This is on the grounds that any value greater than -1000 does not protect against the OOM Killer, but merely adjusts how likely an unprotected process is to be selected for termination.

On Linux, the decimal integer is simply an OOM Score. The binary values map to -1000 for false, and 0 for true. This is on the grounds that -1000 completely protects against the OOM Killer.

## Author

Jonathan de Boyne Pollard