From: Lennart Poettering Date: Wed, 15 Feb 2023 10:31:45 +0000 (+0100) Subject: machined: add support for memory pressure + SIGRTMIN+18 X-Git-Tag: v254-rc1~1142^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4bdb8bd9ec82b5b7ff3731b6ccb16bb8139947fb;p=thirdparty%2Fsystemd.git machined: add support for memory pressure + SIGRTMIN+18 --- diff --git a/src/machine/machined.c b/src/machine/machined.c index b4ff97ab701..8152bda50d1 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -12,6 +12,7 @@ #include "bus-log-control-api.h" #include "bus-polkit.h" #include "cgroup-util.h" +#include "common-signal.h" #include "daemon-util.h" #include "dirent-util.h" #include "discover-image.h" @@ -61,6 +62,15 @@ static int manager_new(Manager **ret) { if (r < 0) return r; + r = sd_event_add_signal(m->event, NULL, SIGRTMIN+18, sigrtmin18_handler, NULL); + if (r < 0) + return r; + + r = sd_event_add_memory_pressure(m->event, NULL, NULL, NULL); + if (r < 0) + log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) || ERRNO_IS_PRIVILEGE(r) || r == -EHOSTDOWN ? LOG_DEBUG : LOG_NOTICE, r, + "Unable to create memory pressure event source, ignoring: %m"); + (void) sd_event_set_watchdog(m->event, true); *ret = TAKE_PTR(m); @@ -339,7 +349,7 @@ static int run(int argc, char *argv[]) { * make sure this check stays in. */ (void) mkdir_label("/run/systemd/machines", 0755); - assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGTERM, SIGINT, -1) >= 0); + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGTERM, SIGINT, SIGRTMIN+18, -1) >= 0); r = manager_new(&m); if (r < 0)