Systemd/udev
Scott James Remnant bb38678e3c udevadm: settle - synchronise with the udev daemon
There's still a slight race condition when using udevadm settle, if the
udev daemon has a pending inotify event but hasn't yet generated the
"change" uevent for it, the kernel and udev sequence numbers will match
and settle will exit.

Now udevadm settle will send a control message to udevd, which will
respond by sending SIGUSR1 back to the waiting udevadm settle once it
has completed the main loop iteration in which it received the control
message.

If there were no pending inotify events, this will simply wake up the
udev daemon and allow settle to continue.  If there are pending inotify
events, they are handled first in the main loop so when settle is
continued they will have been turned into uevents and the kernel
sequence number will have been incremented.

Since the inotify event is pending for udevd when the close() system
call returns (it's queued as part of the kernel handling for that system
call), and since the kernel sequence number is incremented by writing to
the uevent file (as udevd does), this solves the race.

When the settle continues, if there were pending inotify events that
udevd had not read, they are now pending uevents which settle can wait
for.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-03-12 10:02:37 +00:00
..
lib udevadm: settle - synchronise with the udev daemon 2009-03-12 10:02:37 +00:00
.gitignore
Makefile.am udevd: optionally watch device nodes with inotify 2009-02-11 17:38:56 +00:00
test-udev.c
udev-event.c use the event udev_device to disable the watch on "remove" 2009-02-24 15:11:17 +01:00
udev-node.c
udev-rules.c fix compile error in debug mode 2009-03-03 17:27:00 +01:00
udev-selinux.c
udev-sysdeps.h
udev-util.c
udev-watch.c udevd: switch watch symlinks to devpath 2009-03-05 00:35:58 +01:00
udev.h Use the udevdb to speed up watch clearing. 2009-02-23 17:43:53 +00:00
udev.xml udevd: optionally watch device nodes with inotify 2009-02-11 17:38:56 +00:00
udevadm-control.c
udevadm-info.c udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
udevadm-monitor.c udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
udevadm-settle.c udevadm: settle - synchronise with the udev daemon 2009-03-12 10:02:37 +00:00
udevadm-test.c udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
udevadm-trigger.c udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
udevadm.c remove stray initializer 2009-01-16 21:33:33 +01:00
udevadm.xml udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
udevd.c udevadm: settle - synchronise with the udev daemon 2009-03-12 10:02:37 +00:00
udevd.xml Expose delayed name resolution 2009-01-20 21:36:09 +00:00