find_device_from_devnode was guarded by HAVE_SYS_INOTIFY_H, alas its use in process_monitor_event was not, so linking failed.
On the way reduce the scope of a variable (which makes sense per se and avoids introducing a compiler warning with this change).
From: Gerald Pfeifer gerald@pfeifer.com
find_device_from_devnode was guarded by HAVE_SYS_INOTIFY_H, alas its use in process_monitor_event was not, so linking failed.
On the way reduce the scope of a variable (which makes sense per se and avoids introducing a compiler warning with this change). --- dlls/winebus.sys/bus_udev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 71b9ef84530..dfd9c97fdc6 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1714,7 +1714,6 @@ error:
static void process_monitor_event(struct udev_monitor *monitor) { - struct base_device *impl; struct udev_device *dev; const char *action;
@@ -1735,9 +1734,13 @@ static void process_monitor_event(struct udev_monitor *monitor) udev_add_device(dev, -1); else { +#ifdef HAVE_SYS_INOTIFY_H + struct base_device *impl; + impl = find_device_from_devnode(udev_device_get_devnode(dev)); if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device for udev device %p\n", dev); +#endif }
udev_device_unref(dev);
Alex Henrie (@alexhenrie) commented about dlls/winebus.sys/bus_udev.c:
udev_add_device(dev, -1); else {
+#ifdef HAVE_SYS_INOTIFY_H
struct base_device *impl;
impl = find_device_from_devnode(udev_device_get_devnode(dev)); if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device for udev device %p\n", dev);
Would it be helpful to print a (different) warning message if inotify.h was not available at compile time?
This doesn't seem right; we shouldn't be guarding udev code based on inotify. Probably the function needs to be moved.
On Tue Dec 13 21:56:51 2022 +0000, Zebediah Figura wrote:
This doesn't seem right; we shouldn't be guarding udev code based on inotify. Probably the function needs to be moved.
I gave this a quick try and it appears to work. I'll try to submit and updated patch in the next 24 hours.
Thanks for the good feedback!
find_device_from_devnode doesn't depend on inotify. It's declared as a static function in bus_udev.c. Additionally this code must be executed, otherwise the device will not be properly removed after a device removal event from the system.