Skip to content

Commit 87e2baf

Browse files
committed
systemd-oomd: service files
1 parent 5c616ec commit 87e2baf

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

src/oom/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ if conf.get('ENABLE_OOMD') == 1
2626
install_data('org.freedesktop.oom1.conf',
2727
install_dir : dbuspolicydir)
2828

29+
install_data('org.freedesktop.oom1.service',
30+
install_dir : dbussystemservicedir)
31+
2932
install_data('oomd.conf',
3033
install_dir : pkgsysconfdir)
3134
endif
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: LGPL-2.1+
2+
#
3+
# This file is part of systemd.
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as published by
7+
# the Free Software Foundation; either version 2.1 of the License, or
8+
# (at your option) any later version.
9+
10+
[D-BUS Service]
11+
Name=org.freedesktop.oom1
12+
Exec=/bin/false
13+
User=root
14+
SystemdService=dbus-org.freedesktop.oom1.service

sysusers.d/systemd.conf.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ g systemd-journal - -
99
m4_ifdef(`ENABLE_NETWORKD',
1010
u systemd-network - "systemd Network Management"
1111
)m4_dnl
12+
m4_ifdef(`ENABLE_OOMD',
13+
u systemd-oom - "systemd Userspace OOM Killer"
14+
)m4_dnl
1215
m4_ifdef(`ENABLE_RESOLVE',
1316
u systemd-resolve - "systemd Resolver"
1417
)m4_dnl

units/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ in_units = [
201201
['systemd-networkd.service', 'ENABLE_NETWORKD'],
202202
['systemd-networkd-wait-online.service', 'ENABLE_NETWORKD'],
203203
['systemd-nspawn@.service', ''],
204+
['systemd-oomd.service', 'ENABLE_OOMD'],
204205
['systemd-portabled.service', 'ENABLE_PORTABLED',
205206
'dbus-org.freedesktop.portable1.service'],
206207
['systemd-userdbd.service', 'ENABLE_USERDB'],

units/systemd-oomd.service.in

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-License-Identifier: LGPL-2.1+
2+
#
3+
# This file is part of systemd.
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as published by
7+
# the Free Software Foundation; either version 2.1 of the License, or
8+
# (at your option) any later version.
9+
10+
[Unit]
11+
Description=Userspace Out-Of-Memory (OOM) Killer
12+
Documentation=man:systemd-oomd.service(8)
13+
ConditionCapability=CAP_KILL
14+
DefaultDependencies=no
15+
Before=multi-user.target shutdown.target
16+
Conflicts=shutdown.target
17+
18+
[Service]
19+
AmbientCapabilities=CAP_KILL CAP_DAC_OVERRIDE
20+
BusName=org.freedesktop.oom1
21+
CapabilityBoundingSet=CAP_KILL CAP_DAC_OVERRIDE
22+
ExecStart=@rootlibexecdir@/systemd-oomd
23+
IPAddressDeny=any
24+
LockPersonality=yes
25+
MemoryDenyWriteExecute=yes
26+
# Reserve some minimum amount of memory so that systemd-oomd can continue to
27+
# run in resource starved scenarios.
28+
MemoryMin=64M
29+
MemoryLow=64M
30+
NoNewPrivileges=yes
31+
OOMScoreAdjust=-900
32+
PrivateDevices=yes
33+
PrivateTmp=yes
34+
ProtectClock=yes
35+
ProtectHome=yes
36+
ProtectHostname=yes
37+
ProtectKernelLogs=yes
38+
ProtectKernelModules=yes
39+
ProtectKernelTunables=yes
40+
ProtectSystem=strict
41+
Restart=on-failure
42+
RestrictAddressFamilies=AF_UNIX
43+
RestrictNamespaces=yes
44+
RestrictRealtime=yes
45+
RestrictSUIDSGID=yes
46+
SystemCallArchitectures=native
47+
SystemCallErrorNumber=EPERM
48+
SystemCallFilter=@system-service
49+
Type=notify
50+
User=systemd-oom
51+
@SERVICE_WATCHDOG@
52+
53+
[Install]
54+
WantedBy=multi-user.target
55+
Alias=dbus-org.freedesktop.oom1.service

0 commit comments

Comments
 (0)