diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-03-29 04:24:39 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2009-03-29 04:24:39 +0200 |
commit | 116254097ad3c07d9f7ed06042dbec7ba4f0f4fd (patch) | |
tree | e2d79a92d01937d3d292badc93ffdb4130d51d7c /udev/udevadm-monitor.c | |
parent | 241e5a21f9ad7bc986e1bb74093adf9fdb98b170 (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/udevadm-monitor.c')
-rw-r--r-- | udev/udevadm-monitor.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 9be02da16c..43c1cc1163 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -115,11 +115,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) print_udev =1; } - if (getuid() != 0 && print_kernel) { - fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); - goto out; - } - /* set signal handlers */ memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*)(int)) sig_handler; @@ -130,7 +125,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) printf("monitor will print the received events for:\n"); if (print_udev) { - udev_monitor = udev_monitor_new_from_socket(udev, "@/org/kernel/udev/monitor"); + udev_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_UDEV); if (udev_monitor == NULL) { rc = 1; goto out; @@ -142,8 +137,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) printf("UDEV - the event which udev sends out after rule processing\n"); } if (print_kernel) { - kernel_monitor = udev_monitor_new_from_netlink(udev); + kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL); if (kernel_monitor == NULL) { + fprintf(stderr, "unable to subscribe to kernel events\n"); rc = 3; goto out; } |