mirror of
https://github.com/troglobit/finit.git
synced 2026-10-05 23:33:36 +07:00
Issue #96: Add udevd condition to udevadm trigger commands
We must wait for udevd to be started before we call udevadm. However, udevd doesn't create a PID file, so we must also fake this. There is still a slight risk of a race condition: udevd not having properly started before udevadm tries to connect, but it works OK in Debian. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+8
-4
@@ -381,18 +381,22 @@ int main(int argc, char* argv[])
|
||||
udev = 1;
|
||||
|
||||
/* Register udevd as a monitored service */
|
||||
snprintf(cmd, sizeof(cmd), "[S12345789] %s -- Device event managing daemon", path);
|
||||
free(path);
|
||||
snprintf(cmd, sizeof(cmd), "[S12345789] pid:udevd %s -- Device event managing daemon", path);
|
||||
if (service_register(SVC_TYPE_SERVICE, cmd, global_rlimit, NULL)) {
|
||||
_pe("Failed registering %s", path);
|
||||
udev = 0;
|
||||
} else {
|
||||
snprintf(cmd, sizeof(cmd), ":1 [S] udevadm trigger -c add -t devices -- Requesting device events");
|
||||
snprintf(cmd, sizeof(cmd), ":1 [S] <svc%s> "
|
||||
"udevadm trigger -c add -t devices "
|
||||
"-- Requesting device events", path);
|
||||
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), ":2 [S] udevadm trigger -c add -t subsystems -- Requesting subsystem events");
|
||||
snprintf(cmd, sizeof(cmd), ":2 [S] <svc%s> "
|
||||
"udevadm trigger -c add -t subsystems "
|
||||
"-- Requesting subsystem events", path);
|
||||
service_register(SVC_TYPE_RUN, cmd, global_rlimit, NULL);
|
||||
}
|
||||
free(path);
|
||||
} else {
|
||||
path = which("mdev");
|
||||
if (path) {
|
||||
|
||||
Reference in New Issue
Block a user