From 180859a4299bac0cc5d4e6deacfaf28c9b9400f4 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 16 Dec 2022 13:54:46 +0100 Subject: [PATCH] plugins: update mdevd to use new notification framework Last update of plugin before dropping it in favor of an equivalent .conf snippet. (Pending new finit-conf repository). Issue #327 Signed-off-by: Joachim Wiberg --- plugins/hotplug.c | 4 +++- plugins/mdevd.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/hotplug.c b/plugins/hotplug.c index b4675475..69588435 100644 --- a/plugins/hotplug.c +++ b/plugins/hotplug.c @@ -46,7 +46,9 @@ static void setup(void *arg) if (plugin_find("mdevd")) { path = which("mdevd-coldplug"); if (path) { - run_interactive(path, "Populating device tree"); + snprintf(cmd, sizeof(cmd), "cgroup.system [S] log %s " + " -- Populating device tree", path); + service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL); free(path); } return; diff --git a/plugins/mdevd.c b/plugins/mdevd.c index ae03e33a..2e8c14cb 100644 --- a/plugins/mdevd.c +++ b/plugins/mdevd.c @@ -38,7 +38,7 @@ #define MDEVD_DAEMON "mdevd" /* Rebroadcast events onto nlgroup 4 */ -#define MDEVD_ARGS "-C -O 4" +#define MDEVD_ARGS "-C -O 4 -D %n" #define MDEVD_DESC "MDEVD Extended Hotplug Daemon" #ifndef MDEVD_DAEMONUSER @@ -85,10 +85,10 @@ static void setup(void *arg) /* Register service with Finit */ if (debug) - snprintf(line, sizeof(line), "[S12345789] cgroup.system pid:!%s @%s:%s %s -v3 %s -- %s", + snprintf(line, sizeof(line), "[S12345789] cgroup.system notify:s6 pid:!%s @%s:%s %s -v3 %s -- %s", MDEVD_DAEMONPIDFILE, MDEVD_DAEMONUSER, MDEVD_DAEMONGROUP, cmd, MDEVD_ARGS, MDEVD_DESC); else - snprintf(line, sizeof(line), "[S12345789] cgroup.system pid:!%s @%s:%s %s %s -- %s", + snprintf(line, sizeof(line), "[S12345789] cgroup.system notify:s6 pid:!%s @%s:%s %s %s -- %s", MDEVD_DAEMONPIDFILE, MDEVD_DAEMONUSER, MDEVD_DAEMONGROUP, cmd, MDEVD_ARGS, MDEVD_DESC); if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL)) err(1, "Failed registering %s", MDEVD_DAEMON);