summaryrefslogtreecommitdiff
path: root/udev/udevd.c
AgeCommit message (Collapse)Author
2010-01-13udevd: inotify - do not parse rules at create but at closeKay Sievers
We do not need to get notified about created files, only about moved ones or files closed-after-writing.
2009-12-25remove UDEV_RUN environment variableKay Sievers
It handles only RUN but not IMPORT and PROGRAM. There is no sane way to suppress program execution. Most important programs run with IMPORT these days. Also events can no longer suppressed with the libudev netlink messages, so UDEV_RUN does nothing useful and is just inconsistent.
2009-12-15remove remaining support for CONFIG_SYSFS_DEPRECATEDKay Sievers
2009-11-16remove "ignore_device"Kay Sievers
There is no way to ignore an event these days. Libudev events can not be suppressed. It only prevents RUN keys from being executed, which results in an inconsistent behavior in current setups.
2009-11-04udevd: create /dev/.udev/rules.d/ before watching it wit inotifyKay Sievers
This should also address: On Tue, Nov 3, 2009 at 16:21, Marco d'Itri <md@linux.it> wrote: > udev_rules_new() in udev/udev-rules.c unconditionally creates the > directory. > This is a problem because the function is called also by e.g. udevadm > test, and creating /dev/.udev/ when it does not exist is an unacceptable > side effect which will break everything else that checks for its > existence to know if udev is running.
2009-10-30use CLOEXEC flags instead of fcntl()Kay Sievers
2009-10-08udevd: serialize events for with the same major/minorKay Sievers
On Wed, Oct 7, 2009 at 21:46, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote: > Udev would have avoided the race prior to > > 82c785e "udevd: remove check for dev_t, DEVPATH_OLD takes care of that" > > (the "check" removed here used to serialize events based on the device > major:minor number). On Wed, Oct 7, 2009 at 22:31, Michael Guntsche <mike@it-loops.com> wrote: > add /module/8250_pnp (module) > remove /devices/platform/serial8250/tty/ttyS0 (tty) > add /devices/pnp0/00:05/tty/ttyS0 (tty)
2009-09-24fix wrong parameter size on ioctl FIONREADAndrew Church
On Wed, Sep 23, 2009 at 23:11, Matthias Schwarzott <zzam@gentoo.org> wrote: > It is about ioctl failures on amd64: > http://bugs.gentoo.org/show_bug.cgi?id=286041 > > A bad parameter type to an ioctl() call causes udev-146 to generate "error > getting buffer for inotify" messages in syslog. The offending code is > roughly: > > ssize_t nbytes, pos; > // ... > ioctl(fd, FIONREAD, &nbytes); > > where ssize_t is 64 bits on amd64, but the kernel code for FIONREAD (at least > through gentoo-sources-2.6.31) uses type int: > > p = (void __user *) arg; > switch (cmd) { > case FIONREAD: > // ... > ret = put_user(send_len, (int __user *) p); > > so the upper 32 bits of "nbytes" are left uninitialized, and the subsequent > malloc(nbytes) fails unless those 32 bits happen to be zero (or the system has > a LOT of memory).
2009-09-07util_run_program: restore signal mask before executing event RUN commandsJeremy Kerr
External programs triggered by events (via RUN=) will inherit udev's signal mask, which is set to block all but SIGALRM. For most utilities, this is OK, but if we start daemons from RUN=, we run into trouble (especially as SIGCHLD is blocked). This change saves the original sigmask when udev starts, and restores it just before we exec() the external command. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
2009-08-08udevd: block for 15 seconds after error when too old kernel is detectedKay Sievers
The compat code will go away some day and CONFIG_SYSFS_DEPRECATED kernels fail in too many setups now to be worth to support them.
2009-08-06re-enable failed event trackingKay Sievers
It did not work for the last couple of releases. If RUN{record_failed}+="..." is given, a non-zero execution will mark the event as failed. Recorded failed events can be re-triggered with: udevadm trigger --type=failed The failed tracking _might_ be useful for things which might not be ready to be executed at early bootup, but a bit later when the needed dependencies are available. In many cases though, it indicates that something is used in a way it should not.
2009-07-17udevd: add timestamp to --debug outputKay Sievers
2009-07-13udevd: use boolKay Sievers
2009-07-13udevd: handle SIGCHLD before the worker event messageKay Sievers
We may need to handle SIGCHLD before the queued worker message. The last reference, from the SIGCHLD or the worker message will clean up the worker context. In case we receive an unexpected SIGCHLD with an error, we let the event fail and clean up the worker context.
2009-07-11udevd: make sure a worker finishes event handling before exitingKay Sievers
Persistent network rules write out new rules files. When rules change, we need to kill all workers to update the in-memory copy of the rules. We need to make sure, that a worker finshes its work for all device messages it has accepted, before it exits after a SIGTERM from the main process.
2009-07-08udevd: detach event from worker if we kill a workerKay Sievers
Jul 8 09:36:41 udevd[663]: worker [5491] did not accept message, kill it Jul 8 09:36:41 udevd[663]: worker [5491] unexpectedly returned with 0 Jul 8 09:36:41 udevd[663]: worker [5551] unexpectedly returned with 0 Jul 8 09:36:41 kernel: [ 156.832086] <6>udevd[663]: segfault at 4 ip 00959fbc sp bfbe7b78 error 6 in udevd[94f000+1c000] https://bugs.launchpad.net/ubuntu/+source/udev/+bug/396957
2009-06-17cleanup ./configure installation directory optionsKay Sievers
2009-06-09move syslog wrapper to libudevKay Sievers
2009-06-09udevd: log info for created/killed workersKay Sievers
2009-06-08udevd: print error if worker dies unexpectedlyKay Sievers
2009-06-04udevd: close netlink socket in worker and set cloexecKay Sievers
2009-06-04udevd: convert to event worker processesKay Sievers
Event processes now get re-used after they handled an event. This reduces pressure on the CPU significantly because cloned event processes no longer cause page faults in the main daemon. After the events have settled, the no longer needed worker processes get killed.
2009-05-29udevd: remove check for dev_t, DEVPATH_OLD takes care of thatKay Sievers
2009-05-21udevd: implement a more efficient queue file formatAlan Jenkins
Directory lookups show up in profiling. The queue files are responsible for a large proportion of file-related system calls in udev coldplug. Instead of creating a file for each event, append their details to a log file. The file is periodically rebuilt (garbage-collected) to prevent it from growing indefinitely. This single queue file replaces both the queue directory and the uevent_seqnum file. On desktop systems the file tends not to grow beyond one page. So it should also save a small amount of memory in tmpfs. Tests on a running EeePC indicate average savings of 5% *udevd* cpu time as measured by oprofile. __link_path_walk is reduced from 1.5% to 1.3%. It is not completely clear where the rest of the gains come from. In tests running ~400 events, the queue file is rebuilt about 5 times. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-05-21udevd: remove tiny bit of dead codeAlan Jenkins
2009-05-21keep the ifdef'd udevd testing/profiling hackKay Sievers
2009-05-20use openat(), unlinkat(), fstatat()Kay Sievers
2009-05-20use more efficient string copyingKay Sievers
2009-05-05remove asmlinkageKay Sievers
2009-05-04remove all PHYSDEVPATH handling and warning aboutKay Sievers
2009-05-02udevd: revert initial device node creationKay Sievers
2009-04-19udevd: at startup create /dev/null, /dev/console, /dev/kmsgKay Sievers
2009-04-16udevd: log error for too old kernels or CONFIG_SYSFS_DEPRECATEDKay Sievers
2009-03-29"UDEV_MONITOR_KERNEL/UDEV" -> "kernel/udev"Kay Sievers
2009-03-29send monitor events back to netlink socketKay Sievers
Instead of of our own private monitor socket, we send the processed event back to our netlink socket, to the multicast group 2 -- so any number of users can listen to udev events, just like they can listen to kernel emitted events on group 1.
2009-03-12udevadm: settle - synchronise with the udev daemonScott James Remnant
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-02-24use the event udev_device to disable the watch on "remove"Kay Sievers
2009-02-23Look at more inotify events in the buffer than just the first.Scott James Remnant
2009-02-23lookup the old watch handle; reload only if has a pathScott James Remnant
2009-02-23Put a log message in a more sensible place.Scott James Remnant
2009-02-23Use the udevdb to speed up watch clearing.Scott James Remnant
Also return a udev_device when looking up by handle as well, so everything works the same way.
2009-02-23Cleanup a little.Scott James Remnant
Move some of the checks into udev_watch_begin() and udev_watch_clear() so we don't have to repeat them all the time.
2009-02-23Clear existing inotify watch before processing.Scott James Remnant
Likewise when re-processing an event, we want to drop the existing inotify watch first to avoid side-effects.
2009-02-23Don't add inotify watch until RUN rules processed.Scott James Remnant
The programs we RUN can open device nodes, and thus we can end up chasing our own tail.
2009-02-11use global "reload_config" flagKay Sievers
2009-02-11udevd: optionally watch device nodes with inotifyScott James Remnant
This allows you to re-process the rules if the content of the device has been changed, most useful for block subsystem to cause vol_id to be run again.
2009-01-21udevd: add back SA_RESTARTKay Sievers
<Keybuk> poll, select, ppoll, pselect, epoll, etc. are *explicitly* NOT restarted in case of signal <kay> ok
2009-01-21split up long lineKay Sievers
2009-01-21Merge commit '9032f119f07ad3b5116b3d4858816d851d4127de'Kay Sievers
2009-01-21Merge commit '5f03ed8a56d308af72db8a48ab66ed68667af2c6'Kay Sievers
Conflicts: udev/udevd.c