HomeFreeBSD

rc.subr: Make sure oomprotect protects existing children

Description

rc.subr: Make sure oomprotect protects existing children

The rc(8) framework support protecting services from OOM killer.
The current implementation applies the protection after the service has
already started. This works fine if only the main process is to be
protected (*_oomprotect=yes). However, the current implementation fails
to protect existing children when children are also to be protected
(*_oomprotect=all). This patch fixes that.

Note: it is not easy to apply the protectoin earlier because we want to
support both the services which use the "command" variable and those
that use the "start_cmd" variable.

PR: 256148
Approved by: adrian, osogbo
Tested by: Jamie Landeg-Jones <jamie@catflap.org>
Fixes: 3bead71e959d - Add a global option where we can protect
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35747

(cherry picked from commit 68e035c0172b441db772de41ad0f8977679bfedc)

Details

Provenance
mike.walker_napkindrawing.comAuthored on Jul 7 2022, 8:28 PM
0mpCommitted on Jul 22 2022, 12:09 AM
Differential Revision
D35747: rc.subr: Make sure oomprotect protects existing children
Parents
rGf91f4cc4f374: protect.1: Document that protect(1) does not work in jails
Branches
Unknown
Tags
Unknown