Commit graph

14 commits

Author SHA1 Message Date
Kay Sievers 4061ab9f4b libudev: GPL -> LGPL 2009-03-26 19:29:36 +01:00
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
Kay Sievers 89d080c3ae libudev: ctrl - return error after sending ctrl message 2009-03-11 13:32:39 +01:00
Kay Sievers 86b5778857 move some info() to dbg() 2008-11-01 20:16:24 +01:00
Alan Jenkins b29a5e4ab9 use more appropriate alternatives to malloc()
Use calloc to request cleared memory instead.
Kernel and libc conspire to make this more efficient.

Also, replace one malloc() + strcpy() with strdup().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 12:54:57 +02:00
Kay Sievers b692a75089 libudev: ctrl - change magic to integer 2008-10-17 17:32:17 +02:00
Kay Sievers 6a95b1e7d6 libudev: ctrl - fix typo in set_env() 2008-10-16 13:34:11 +02:00
Alan Jenkins 659353f5a9 replace strerror() usage with threadsafe "%m" format string
strerror() is not threadsafe.  It uses a buffer to build messages of the form
"Unknown error 387689".

syslog() provides a %m format which is equivalent to strerror(errno).
As a GNU extension, this is also accepted by printf and friends.
At least in the current implementation, it is correctly threadsafe.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-09-29 17:06:00 +02:00
Kay Sievers 38f27948cd always include config.h from Makefile 2008-09-19 23:03:49 -07:00
Kay Sievers 7b3a52f499 libudev: rename ctrl_msg to ctrl_msg_wire 2008-09-15 18:01:15 -07:00
Kay Sievers 3eb46ec6dd libudev: do not use any udev source file 2008-09-10 18:00:31 +02:00
Kay Sievers 55e9959b15 update file headers 2008-09-10 02:40:42 +02:00
Kay Sievers 3bc7c84cf0 udevd: remove max_childs_running logic
This was needed in the old days, where all the hotplug scripts did
nothing better than sleep for seconds to work around timing issues.
It made sure, that w continued to fork processes, while the machine
was doing nothing than sleeping, but the maximim number of childs
was already reached. This is no longer needed today, we do not run
many of these scripts anymore.
2008-09-09 15:14:38 +02:00
Kay Sievers d59f11e140 move udev_ctrl to libudev-private 2008-09-08 17:59:00 +02:00