homed: hook up memory pressure/SIGRTMIN+18 handling
This commit is contained in:
@@ -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);
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user