diff options
Diffstat (limited to 'src/login/sd-login.c')
-rw-r--r-- | src/login/sd-login.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/login/sd-login.c b/src/login/sd-login.c index 35deb85f2d..bc8cd8ae8c 100644 --- a/src/login/sd-login.c +++ b/src/login/sd-login.c @@ -677,6 +677,27 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) { good = true; } + if (!category || streq(category, "machine")) { + _cleanup_free_ char *md = NULL, *p = NULL; + int r; + + r = cg_get_machine_path(&md); + if (r < 0) + return r; + + r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, md, NULL, &p); + if (r < 0) + return r; + + k = inotify_add_watch(fd, p, IN_MOVED_TO|IN_CREATE|IN_DELETE); + if (k < 0) { + close_nointr_nofail(fd); + return -errno; + } + + good = true; + } + if (!good) { close_nointr(fd); return -EINVAL; |