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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-12-16 13:54:46 +01:00
parent 1d92819d92
commit 180859a429
2 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -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] <service/mdevd/ready> log %s "
" -- Populating device tree", path);
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
free(path);
}
return;
+3 -3
View File
@@ -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);