From: Lennart Poettering Date: Thu, 16 Feb 2023 11:33:18 +0000 (+0100) Subject: homed: hook up memory pressure/SIGRTMIN+18 handling X-Git-Tag: v254-rc1~1142^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11d78c31e482146c2787ff61135d9f3cb63dad7d;p=thirdparty%2Fsystemd.git homed: hook up memory pressure/SIGRTMIN+18 handling --- diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index e1af7aa1ad1..76b038caddb 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -18,6 +18,7 @@ #include "bus-log-control-api.h" #include "bus-polkit.h" #include "clean-ipc.h" +#include "common-signal.h" #include "conf-files.h" #include "device-util.h" #include "dirent-util.h" @@ -225,6 +226,15 @@ int manager_new(Manager **ret) { 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_WARNING, r, + "Failed to allocate memory pressure watch, ignoring: %m"); + + r = sd_event_add_signal(m->event, NULL, SIGRTMIN+18, sigrtmin18_handler, NULL); + if (r < 0) + return r; + (void) sd_event_set_watchdog(m->event, true); m->homes_by_uid = hashmap_new(&homes_by_uid_hash_ops); diff --git a/src/home/homed.c b/src/home/homed.c index 579c289a686..04d9b56f076 100644 --- a/src/home/homed.c +++ b/src/home/homed.c @@ -29,7 +29,7 @@ static int run(int argc, char *argv[]) { umask(0022); - 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)