summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-03-29 04:24:39 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-03-29 04:24:39 +0200
commit116254097ad3c07d9f7ed06042dbec7ba4f0f4fd (patch)
treee2d79a92d01937d3d292badc93ffdb4130d51d7c /udev/udevd.c
parent241e5a21f9ad7bc986e1bb74093adf9fdb98b170 (diff)
send monitor events back to netlink socket
Instead of of our own private monitor socket, we send the processed event back to our netlink socket, to the multicast group 2 -- so any number of users can listen to udev events, just like they can listen to kernel emitted events on group 1.
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 291655ef00..d9de26ea6c 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -195,7 +195,6 @@ static void event_fork(struct udev_event *event)
switch (pid) {
case 0:
/* child */
- udev_monitor_unref(kernel_monitor);
udev_ctrl_unref(udev_ctrl);
logging_close();
logging_init("udevd-event");
@@ -235,6 +234,9 @@ static void event_fork(struct udev_event *event)
udev_device_update_db(event->dev);
}
+ /* send processed event back to the kernel netlink socket */
+ udev_monitor_send_device(kernel_monitor, event->dev);
+
info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
logging_close();
if (err != 0)
@@ -811,7 +813,7 @@ int main(int argc, char *argv[])
goto exit;
}
- kernel_monitor = udev_monitor_new_from_netlink(udev);
+ kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL);
if (kernel_monitor == NULL || udev_monitor_enable_receiving(kernel_monitor) < 0) {
fprintf(stderr, "error initializing netlink socket\n");
err(udev, "error initializing netlink socket\n");