summaryrefslogtreecommitdiff
path: root/units
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-09-21 15:39:48 +0100
committerGitHub <noreply@github.com>2021-09-21 15:39:48 +0100
commit71a80dcc0b64b01c73e7141c4292ef301543a011 (patch)
tree243926fdd5d3859130ff33617e9ddfe852c5a09b /units
parenta7052c6e5cc45a68353fc0cc3e6548ebd9a8f452 (diff)
parent064a5c1438690f9454ad9bff05ec4ec2acfa67d2 (diff)
downloadsystemd-71a80dcc0b64b01c73e7141c4292ef301543a011.tar.gz
Merge pull request #20690 from DaanDeMeyer/oomd-user-services
oom: Support for user services
Diffstat (limited to 'units')
-rw-r--r--units/meson.build1
-rw-r--r--units/systemd-oomd.service.in2
-rw-r--r--units/systemd-oomd.socket21
3 files changed, 24 insertions, 0 deletions
diff --git a/units/meson.build b/units/meson.build
index 3471d82b4e..59ed04afde 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -164,6 +164,7 @@ units = [
['user.slice', ''],
['var-lib-machines.mount', 'ENABLE_MACHINED',
'remote-fs.target.wants/ machines.target.wants/'],
+ ['systemd-oomd.socket', 'ENABLE_OOMD'],
]
in_units = [
diff --git a/units/systemd-oomd.service.in b/units/systemd-oomd.service.in
index 44f71c9e36..9f248e2ba4 100644
--- a/units/systemd-oomd.service.in
+++ b/units/systemd-oomd.service.in
@@ -18,6 +18,8 @@ ConditionControlGroupController=memory
ConditionPathExists=/proc/pressure/cpu
ConditionPathExists=/proc/pressure/io
ConditionPathExists=/proc/pressure/memory
+Requires=systemd-oomd.socket
+After=systemd-oomd.socket
[Service]
AmbientCapabilities=CAP_KILL CAP_DAC_OVERRIDE
diff --git a/units/systemd-oomd.socket b/units/systemd-oomd.socket
new file mode 100644
index 0000000000..47cd0e7555
--- /dev/null
+++ b/units/systemd-oomd.socket
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Userspace Out-Of-Memory (OOM) Killer Socket
+Documentation=man:systemd-oomd.service(8)
+DefaultDependencies=no
+Before=sockets.target
+
+[Socket]
+ListenStream=/run/systemd/oom/io.system.ManagedOOM
+SocketMode=0666
+
+[Install]
+WantedBy=sockets.target