[Bug 296887] devel/libudev-devd: udev-monitor: make the monitor fd non-blocking

[email protected] Sat, 18 Jul 2026 19:19:08 +0000
Newsgroups gmane.os.freebsd.devel.x11
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296887

            Bug ID: 296887
           Summary: devel/libudev-devd: udev-monitor: make the monitor fd
                    non-blocking
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: [email protected]
          Reporter: [email protected]
             Flags: maintainer-feedback?([email protected])
          Assignee: [email protected]

Created attachment 272972
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=272972&action=edit
v1

systemd's libudev documents that the monitor socket is non-blocking by default:

https://github.com/systemd/systemd/blob/v261/src/libudev/libudev-monitor.c#L228-L231

It also creates the monitor socket with SOCK_NONBLOCK:

https://github.com/systemd/systemd/blob/v261/src/libsystemd/sd-device/device-monitor.c#L179-L183

libudev-devd currently uses a blocking pipe. Once all pending events have been
consumed, another call to udev_monitor_receive_device() blocks instead of
returning NULL with EAGAIN.

This was observed in KWin, where display hotplug handling stalled after
disconnecting and reconnecting an external display in a KDE/Wayland session.

Set O_NONBLOCK on the read end returned by udev_monitor_get_fd(). Keep the
internal write end blocking to preserve the current producer and backpressure
behavior.

-- 
You are receiving this mail because:
You are the assignee for the bug.