diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-16 12:33:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-03-01 09:43:23 +0100 |
commit | 11d78c31e482146c2787ff61135d9f3cb63dad7d (patch) | |
tree | a1ee7dde6315ea41802359ba12b3f275b9eeec04 /src | |
parent | 79d905af0a9386cddcd214dfd796576c0be1f883 (diff) | |
download | systemd-11d78c31e482146c2787ff61135d9f3cb63dad7d.tar.gz |
homed: hook up memory pressure/SIGRTMIN+18 handling
Diffstat (limited to 'src')
-rw-r--r-- | src/home/homed-manager.c | 10 | ||||
-rw-r--r-- | src/home/homed.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index e1af7aa1ad..76b038cadd 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 579c289a68..04d9b56f07 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) |