1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-31 16:21:11 +03:00
Commit Graph

137 Commits

Author SHA1 Message Date
Kay Sievers
5005ca5991 remove udevsend 2006-05-27 12:20:51 +02:00
Kay Sievers
0e385feecc udevd: create leading directories for /dev/.udev/uevent_seqnum 2006-04-28 00:34:05 +02:00
Kay Sievers
90cd961e2c udevd: export initial sequence number on startup 2006-04-25 18:50:56 +02:00
Kay Sievers
03149e13c2 let udevmonitor show the possibly renamed devpath
For renamed network interfaces, the udev socket message header
contained the original devpath, which we have updated in the
environment after the kernel has silently renamed the netif.
2006-04-06 20:56:15 +02:00
Marco d'Itri
750d10daac add inotify support for hppa and MIPS and log if inotify is not available 2006-04-06 19:52:41 +02:00
Kay Sievers
7baada47be udevd: export current seqnum and add udevsettle 2006-04-05 00:08:10 +02:00
Kay Sievers
f660222775 correct use of fcntl() 2006-03-16 10:47:31 +01:00
Kay Sievers
3e5e833253 reset signal handler in event process 2006-03-16 10:46:30 +01:00
Kay Sievers
1a4e5303e0 udevd: fix queue export for multiple events for the same device
Identified by Joachim Plack <jplack@suse.de> while working around
the problem that the device nodes appear and disappear while the
partitiontable is re-read and the application need to waait for an
empty udevd queue.
2006-02-23 20:10:49 +01:00
Kay Sievers
4179809b22 remove UDEVD_UEVENT_INITSEND
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-28 05:04:38 +01:00
Kay Sievers
37854ffc9a let "ignore_device" always return the event successfully
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-25 02:21:07 +01:00
Kay Sievers
a9bd2ed84a rename apply_format() cause it is public now
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-25 01:28:31 +01:00
Andrey Borzenkov
f5f0c34f6d substitute format chars in RUN after rule matching
Apply substitutions before running a program, not while the rule
is parsed. It allows to use environment variables set during rule
processing as command arguments.
2006-01-24 20:10:48 +01:00
Kay Sievers
7d1e179f86 increase kernel uevent buffer size
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-24 12:12:07 +01:00
Kay Sievers
0ec819d92b ignore all messages with missing devpath or action
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-20 02:54:31 +01:00
Kay Sievers
1aa1e24848 replace libsysfs
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>
2006-01-09 21:18:00 +01:00
Kay Sievers
a2f87fddbf update SUSE rules
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-12-04 01:48:53 +01:00
Kay Sievers
997b164d56 move SEQNUM event skipping to udevsend
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-25 19:03:16 +01:00
Scott James Remnant
1b75f1096e clean-up empty queue directories
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-22 15:49:49 +01:00
Kay Sievers
8813e55c74 udevd: add a missing return
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-17 18:53:53 +01:00
Kay Sievers
82de5983ab udevd: track killed event processes as failed
Thanks to Marco for catching this.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-17 16:34:37 +01:00
Kay Sievers
fc55cf68ca remove "udev_db" option from config file
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-16 04:14:15 +01:00
Kay Sievers
7a77025092 udevd: export event queue and event state
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-16 04:12:53 +01:00
Kay Sievers
f4fc013652 udevd: track exit status of event process
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16 02:06:46 +01:00
Kay Sievers
e825b59b07 udevd: ignore all messages without DEVPATH
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16 00:13:28 +01:00
Kay Sievers
62821d0de1 add linux/types.h back, old glibc-kernel-headers want it
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-12 05:09:34 +01:00
Marco d'Itri
df4e89bfa6 move some logging from dbg() to info() 2005-11-07 18:52:03 +01:00
Marco d'Itri
ff3e4bed21 add strerror() to error logs 2005-11-07 18:44:18 +01:00
Kay Sievers
fc465079ca never queue events with TIMEOUT set
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-07 14:10:09 +01:00
Kay Sievers
0b3dfb3d72 udevd: depend on netlink and remove all sequence reorder logic
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-07 02:22:44 +01:00
Kay Sievers
74adec7d97 fix typo in umask()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05 22:02:21 +01:00
Kay Sievers
287814b23c remove precompiled rules option
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-05 20:00:31 +01:00
Kay Sievers
3904a75817 udevd: disable OOM
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05 19:41:00 +01:00
Kay Sievers
833b3c680b udevd: don't daemonize before initialization
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-11-04 05:25:15 +01:00
Kay Sievers
c895fd0027 move rules parsing into daemon
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-27 21:04:38 +02:00
Kay Sievers
916c5e4725 fix the new warnings I asked for
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-27 20:32:07 +02:00
Kay Sievers
dfedc446db udevd: move logging from err to info for non-hotplug uevent
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-10-12 11:55:49 +02:00
Kay Sievers
a5c606f6c3 force event socket buffer size to 16MB
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-11 21:06:50 +02:00
Kay Sievers
133326dc74 udevd: fix initial timeout handling
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-10-03 16:36:52 +02:00
Amir Shalem
b4f192f054 udevd: fix udevd read() calls to leave room for null byte 2005-09-14 14:28:13 +02:00
Kay Sievers
69348b66ff remove special TIMEOUT handling from incoming queue
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-29 01:19:02 +02:00
Kay Sievers
199cdd8675 udevd: move some logging to "info" and "err"
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:19:45 +02:00
Kay Sievers
d2ecd6a19d don't reenter get_udevd_msg() if message is ignored
Check all event sources with every iteration.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:14:59 +02:00
Kay Sievers
c6303c1316 remove not needed sig_flag for state of signal_pipe
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-28 23:13:14 +02:00
Kay Sievers
f1ff8d7b4a use WRITE_END/READ_END for the pipe index
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 20:25:37 +02:00
Kay Sievers
e7f247503c udevd: keep the right order for messages without SEQNUM
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-23 00:57:46 +02:00
Kay Sievers
3f9f8de4de bring std(in|out|err) fd's in a sane state
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-18 13:07:15 +02:00
Kay Sievers
40caaeec51 cleanup some debug output and move to info level + unify select() loops
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15 11:57:04 +02:00
Kay Sievers
af5461f72f don't fail too bad, if /dev/null does not exist
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13 02:36:12 +02:00
Kay Sievers
2b996ad193 add Usage: to udevmonitor and udevcontrol
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 20:34:24 +02:00