From: Lennart Poettering Date: Thu, 23 Feb 2023 09:19:24 +0000 (+0100) Subject: logind: hook up memory pressure + SIGRTMIN+18 X-Git-Tag: v254-rc1~1142^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92e1a20998b7afa559af741ad42169252e468b26;p=thirdparty%2Fsystemd.git logind: hook up memory pressure + SIGRTMIN+18 --- diff --git a/src/login/logind.c b/src/login/logind.c index 1feacd36011..a0d6cb3a27b 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -14,6 +14,7 @@ #include "bus-log-control-api.h" #include "bus-polkit.h" #include "cgroup-util.h" +#include "common-signal.h" #include "constants.h" #include "daemon-util.h" #include "device-util.h" @@ -85,6 +86,14 @@ 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_debug_errno(r, "Failed allocate memory pressure event source, ignoring: %m"); + (void) sd_event_set_watchdog(m->event, true); manager_reset_config(m); @@ -1196,7 +1205,7 @@ static int run(int argc, char *argv[]) { (void) mkdir_label("/run/systemd/users", 0755); (void) mkdir_label("/run/systemd/sessions", 0755); - assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGHUP, SIGTERM, SIGINT, SIGCHLD, -1) >= 0); + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGHUP, SIGTERM, SIGINT, SIGCHLD, SIGRTMIN+18, -1) >= 0); r = manager_new(&m); if (r < 0)