summaryrefslogtreecommitdiff
path: root/udevd.c
AgeCommit message (Collapse)Author
2006-01-09replace libsysfsKay Sievers
We never used any of the libsysfs convenience features. Here we replace it completely with 300 lines of code, which are much simpler and a bit faster cause udev(d) does not open any syfs file for a simple event which does not need any parent device information. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-12-04update SUSE rulesKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-25move SEQNUM event skipping to udevsendKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-22clean-up empty queue directoriesScott James Remnant
This allows scripts to do: while test -d /dev/.udev/queue; do sleep 0.1; done And don't create a failed symlink if there is another event for the same devpath in the queue.
2005-11-17udevd: add a missing returnKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-17udevd: track killed event processes as failedKay Sievers
Thanks to Marco for catching this. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16remove "udev_db" option from config fileKay Sievers
All udev state is kept in /$udev_root/.udev/ now. No option to configure that anymore, it will always be there. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16udevd: export event queue and event stateKay Sievers
All pending and running events can be found as symlinks to the actual device in /dev/.udev/queue/ now. This way we can lookup if specific events are still in the queue, before doing actions which require events to have finished. All failed event processes can be found in /dev/.udev/failed/. This makes it possible to retry a failed event process at a later time in the boot process. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16udevd: track exit status of event processKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16udevd: ignore all messages without DEVPATHKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-12add linux/types.h back, old glibc-kernel-headers want itKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-07move some logging from dbg() to info()Marco d'Itri
2005-11-07add strerror() to error logsMarco d'Itri
2005-11-07never queue events with TIMEOUT setKay Sievers
With removing the event reorder queue, we can fix the TIMEOUT events like firmware loading proper, and never delay any of these events. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-07udevd: depend on netlink and remove all sequence reorder logicKay Sievers
Netlink will never get out-of-order and we just depend on it from now on. Udevsend messages will have no effect if they contain a sequence number (SEQNUM). Thanks to Bastian Blank <waldi@debian.org>, for the debugging session which identified a bug where the timeouts are not working if inotify was not available. All the timeout handling is removed now and this issue should be solved. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05fix typo in umask()Kay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05remove precompiled rules optionKay Sievers
It was a workaround for speed up udev "coldplug", where ~800 events happened a second time during bootup. No need for it with the rules aleady parsed in the daemon. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05udevd: disable OOMKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-04udevd: don't daemonize before initializationKay Sievers
Move socket init and rule parsing before forking, so we can start emitting event immediately after udevd has started. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
2005-10-27move rules parsing into daemonKay Sievers
The rules files are parsed only once at daemon startup. Every udev event process will be fork()'d from udevd without exec()'ing the udev binary. The in-memory rules will be inherited from the daemon itself. If inotify is available, udevd will reload all rules if any change in /etc/udev/rules.d/ happens. Otherwise -HUP or "udevcontrol reload_rules" can be used. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-27fix the new warnings I asked forKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-12udevd: move logging from err to info for non-hotplug ueventKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-11force event socket buffer size to 16MBKay Sievers
Netlink events get lost when the kernel creates thousends of events faster than udevd reads it. The default is 128 KB, which can carry app. 500 events. Set it to 16 MB now. I have 4000 fibrechannel LUNs connected to my system. There are two paths to the devices and two ports on the host connected via a switch. This gives 16000 when probed. I have had problems getting all of the entries in /dev created. -- Mark Haverkamp <markh@osdl.org> Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-03udevd: fix initial timeout handlingKay Sievers
UDEVD_EVENT_TIMEOUT=0 didn't work directly after udevd startup. The whole event timeout handling is not needed since we use netlink. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-09-14udevd: fix udevd read() calls to leave room for null byteAmir Shalem
2005-08-29remove special TIMEOUT handling from incoming queueKay Sievers
Moving events directly to the exec queue instead of the reordering incoming queue, leaves holes in the sequence, that lead to timeouts for all other events. Remove that part of the special handling. (With netlink, events can't get out-of-order and the maximum timeout is 5 seconds and should not cause any trouble with the 10 sec timout for the firmware class anyway. Events with timeouts are still prioritized for execution, but don't bypass the incoming queue anymore.) Many thanks to: Uberto Barbini <uberto@ubiland.net> for his endless debugging and sending all the traces, that showed this failure with his DVB device: UEVENT[1124474094] add@/module/stv0299 UEVENT[1124474094] add@/module/ves1x93 UEVENT[1124474094] add@/module/ttpci_eeprom UEVENT[1124474094] add@/module/saa7146 UEVENT[1124474094] add@/module/video_buf UEVENT[1124474094] add@/module/saa7146_vv UEVENT[1124474094] add@/module/dvb_core UEVENT[1124474094] add@/module/dvb_ttpci UEVENT[1124474094] add@/bus/pci/drivers/dvb UEVENT[1124474094] add@/class/firmware/0000:00:14.0 UDEV [1124474094] add@/module/dvb_core UDEV [1124474094] add@/module/saa7146_vv UDEV [1124474094] add@/module/dvb_ttpci UDEV [1124474094] add@/module/ves1x93 UDEV [1124474094] add@/module/ttpci_eeprom UDEV [1124474094] add@/module/saa7146 UDEV [1124474094] add@/module/stv0299 UDEV [1124474094] add@/module/video_buf UDEV [1124474094] add@/bus/pci/drivers/dvb UEVENT[1124474094] remove@/class/firmware/0000:00:14.0 <- event with TIMEOUT will leave a hole in the incoming UDEV [1124474094] add@/class/firmware/0000:00:14.0 sequence, which will cause a wait for the alarm() UEVENT[1124474094] add@/class/i2c-adapter/i2c-1 that flushes the queue UEVENT[1124474094] add@/class/i2c-dev/i2c-1 UDEV [1124474094] remove@/class/firmware/0000:00:14.0 <- event also has TIMEOUT and is executed immediately UEVENT[1124474095] add@/class/dvb/dvb0.demux0 UEVENT[1124474095] add@/class/dvb/dvb0.dvr0 UEVENT[1124474095] add@/class/dvb/dvb0.video0 UEVENT[1124474095] add@/class/dvb/dvb0.audio0 UEVENT[1124474095] add@/class/dvb/dvb0.ca0 UEVENT[1124474095] add@/class/dvb/dvb0.osd0 UEVENT[1124474095] add@/class/dvb/dvb0.net0 UEVENT[1124474095] add@/class/video4linux/video1 UEVENT[1124474095] add@/class/dvb/dvb0.frontend0 UDEV [1124474099] add@/class/i2c-adapter/i2c-1 <- all others have 5 seconds delay cause of the missing event UDEV [1124474099] add@/class/dvb/dvb0.ca0 missing events UDEV [1124474099] add@/class/dvb/dvb0.osd0 UDEV [1124474099] add@/class/video4linux/video1 UDEV [1124474099] add@/class/dvb/dvb0.frontend0 UDEV [1124474099] add@/class/dvb/dvb0.video0 UDEV [1124474099] add@/class/dvb/dvb0.audio0 UDEV [1124474099] add@/class/i2c-dev/i2c-1 UDEV [1124474099] add@/class/dvb/dv My test program that simulates a similar sequence, runs without any delay now. (With one of the next versions we will make netlink mandatory, then we can remove the whole input queue crap with the reordering anyway.) Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28udevd: move some logging to "info" and "err"Kay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28don't reenter get_udevd_msg() if message is ignoredKay Sievers
Check all event sources with every iteration. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28remove not needed sig_flag for state of signal_pipeKay Sievers
Less internal state is better. And, we don't need to call read() twice with every signal handling. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28use WRITE_END/READ_END for the pipe indexKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-23udevd: keep the right order for messages without SEQNUMKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-18bring std(in|out|err) fd's in a sane stateKay Sievers
If the kernel forks us as an usermodhelper, we don't have any of the standard fd's and the first open() will start with fd=0. This is inherited to all forked childs and confuses later forked helpers where we want to read from a pipe connected to the helpers stdout/stderr. # ls -l /proc/$(pidof udevd)/fd total 6 dr-x------ 2 root root 0 2005-08-18 12:44 . dr-xr-xr-x 4 root root 0 2005-08-18 12:44 .. lrwx------ 1 root root 64 2005-08-18 12:44 0 -> /dev/null lrwx------ 1 root root 64 2005-08-18 12:44 1 -> socket:[1274617] lr-x------ 1 root root 64 2005-08-18 12:44 2 -> pipe:[1274618] l-wx------ 1 root root 64 2005-08-18 12:44 3 -> pipe:[1274618] lrwx------ 1 root root 64 2005-08-18 12:44 4 -> socket:[1274619] lrwx------ 1 root root 64 2005-08-18 12:44 5 -> socket:[1274620] Ouch! This will obviously not redirect sterr, it will kill the pipe we established between the parent and the child: devnull = open("/dev/null", O_RDWR); dup2(devnull, STDERR_FILENO); Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15cleanup some debug output and move to info level + unify select() loopsKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13don't fail too bad, if /dev/null does not existKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11add Usage: to udevmonitor and udevcontrolKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-09update READMEKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08allow clean shutdown of udevdKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-04add NETLINK define for the lazy distrosKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-20make SYSFS{} usable for all devicesKay Sievers
Patch from: Hannes Reinecke <hare@suse.de>
2005-07-12udevd: set incoming socket buffer SO_RCVBUF to maximumKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-06udevd: optimize env-key parsingKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-01[PATCH] #define NETLINK_KOBJECT_UEVENTMarco d'Itri
On many systems the system kernel headers are not recent enough to compile udev.
2005-06-27add ID_TYPE to the id probersKay Sievers
Export the type of device from ata_id and scsi_id, also strip leading and trailing whitespace and substitute consecutive whitespace with a single underline char. From: Hannes Reinecke <hare@suse.de> Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-16udevd: control log-priority of the running daemon with udevcontrolKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-15udeveventrecorder: add small program that writes an event to diskKay Sievers
Used for debugging and event replay from initramfs. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-14udevinitsend: handle replay messages correctlyKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-08udevd: allow starting of udevd with stopped exec-queueKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05udevd: improve timeout handlingKay Sievers
Allow to override some parameters by environment keys. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05udevd: add udevcontrolKay Sievers
Controls the behavior of the running daemon. Currently only stopping and starting of the execution queue is supported. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05udevd: listen for netlink eventsKay Sievers
After the first valid netlink-event all event with a serial number received on the udevsend socket will be ignored. Signed-off-by: Kay Sievers <kay.sievers@suse.de>