On Mon, Aug 19, 2013 at 1:39 PM, Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote: > recvmsg() waits until something is queued if udev_monitor->sock is blocking, Only on a blocking socket, which it isn't by default: http://www.freedesktop.org/software/systemd/libudev/libudev-udev-monitor.html#udev-monitor-receive-device > but poll() does not wait until something is queued even if udev_monitor->sock > is blocking. > > I think that this inconsistency makes udev_monitor_receive_device() > to immediately return NULL when an event where passes_filter() returns 0 was > already queued but another event where passes_filter() returns 1 is not yet > queued, making wait-for-root utility which is waiting for only "block" subsystem > events fail. > > Why don't we unconditionally go to retry rather than poll(pfd, 1, 0) so that > "blocking socket can wait for next event" and "non-blocking socket can return > immediately"? It's from a time where the socket was still blocking, but we still used poll() in calling code. We didn't want to block the caller, hence the poll() inside the library. The poll() inside of libudev-monitor.c can probably just be removed today. Or even the whole retry be removed, it might not be a useful optimization at all. Kay -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html