From 08a7a795f61eaf42f31b26e435067a664f0a4d4d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Apr 2009 04:07:51 +0200 Subject: [PATCH] libudev: monitor - add udev_monitor_filter_remove --- udev/lib/exported_symbols | 1 + udev/lib/libudev-monitor.c | 8 ++++++++ udev/lib/libudev.h | 1 + 3 files changed, 10 insertions(+) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index a700f98a..5b0d8fd0 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -57,6 +57,7 @@ udev_monitor_get_udev udev_monitor_get_fd udev_monitor_receive_device udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_remove udev_queue_new udev_queue_ref udev_queue_unref diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 211aa12f..bf95657d 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -707,3 +707,11 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo return -ENOMEM; return 0; } + +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) +{ + static struct sock_fprog filter = { 0, NULL }; + + udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); +} diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index e366d768..0b52e6e7 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -85,6 +85,7 @@ extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor); extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); extern int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype); +extern int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); /* sys enumeration */ struct udev_enumerate; -- 2.39.5