Bug 51202

Summary: Be more clear that udev_monitor_receive_device() is non-blocking
Product: systemd Reporter: Sam Thursfield <ssssam>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: minor    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to fix doc for udev_monitor_receive_device()
Cleaner patch

Description Sam Thursfield 2012-06-18 04:37:57 UTC
Since v171, the socket used by udev-monitor is non-blocking.  From the code, I'm assuming it is considered an error to call the function if no data is avaiable.  It would help if the documentation was clearer about this.
Comment 1 Sam Thursfield 2012-06-18 04:40:19 UTC
Created attachment 63173 [details] [review]
Patch to fix doc for udev_monitor_receive_device()
Comment 2 Sam Thursfield 2012-06-18 04:42:36 UTC
Created attachment 63174 [details] [review]
Cleaner patch

Always proof-read patches before submitting
Comment 3 Kay Sievers 2012-06-18 06:56:02 UTC
+ * It is an error to call this function if there is no data available.
+ * The function will return #NULL in this case. You should monitor the
+ * file handle returned by udev_monitor_get_fd() to ensure data is available
+ * before calling. Note that the behaviour of this function changed in
+ * libudev 171. Code that assumes this function will block should be changed
+ * to use poll().

Hmm, it's not really an *error*, sure, also not very useful, but it just
returns EAGAIN and NULL.

Also users are free to change the flags of the file descriptor to blocking mode.

I added a sentence to explain that.

Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.