Commit graph

145 commits

Author SHA1 Message Date
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 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 c86be870ce remove all built-in wait_for_sysfs logic
Most of the issues are fixed with the kernel we depend on, for the
remaing ones see the RELEASE-NOTES for a special rule to add.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-12 04:17:48 +01:00
Marco d'Itri ff3e4bed21 add strerror() to error logs 2005-11-07 18:44:18 +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 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 4937afa402 move some logging to the info level
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 21:01:46 +02:00
Kay Sievers 27f877e60f allow logging of all output from executed tools
If USE_DEBUG=true and udev_log="debug", all output of the forked
programs to stdout and stderr is send to syslog.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 17:32:59 +02:00
Kay Sievers bfd1294892 add flag for reading of precompiled rules
Rules can be precompiled and stored on disk for initramfs, to avoid
parsing the rules with every event again and again. Also the OWNER and
GROUP names are already resolved to numerical values in the compiled
rules. This flag is used for the upcoming move of the rules parsing
into udevd:
  If the real root is mounted udevd is started and parses the rules
  only once. The event processes will inherit the already parsed rules
  from the daemon, so we want to ignore any precompiled rules and
  use the real rules files and watch the filesystem for changes to
  reload the rules automatically.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08 17:43:42 +02:00
Kay Sievers 13d11705bf switch some strlcpy's to memcpy
strlcpy counts the sourec string lengt and is therefore not suitable
to copy a defined length of characters from one string to another.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08 02:21:55 +02:00
Kay Sievers d455b0085d allow RUN to send the environment to a local socket
RUN="socket:<name>" will send the environment in the kernel uevent
format to the named destination. Using the socket instead of the program
to pass the hotplug events to the HAL daemon, cuts down the running
time of udevstart from 0.8 to 0.4 seconds on my box.

  env -i ACTION=add DEVPATH=/block/hda/hda1 strace -s10000 ./udev block
  sendto(3, "add@/block/hda/hda1\0
    ACTION=add\0DEVPATH=/block/hda/hda1\0UDEV_LOG=3\0
    ID_TYPE=disk\0ID_MODEL=HTS726060M9AT00\0ID_SERIAL=MRH401M4G6UM9B\0
    ID_REVISION=MH4OA6BA\0ID_BUS=ata\0ID_PATH=pci-0000:00:1f.1-ide-0:0\0
    ID_FS_USAGE=other\0ID_FS_TYPE=swap\0ID_FS_VERSION=2\0
    ID_FS_UUID=9352cfef-7687-47bc-a2a3-34cf136f72e1\0
    ID_FS_LABEL=ThisIsSwap\0ID_FS_LABEL_SAFE=ThisIsSwap\0
    DEVNAME=/dev/hda1\0"

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-01 05:07:19 +02:00
Kay Sievers e8d569b414 move code to its own files
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-22 12:35:58 -04:00
Kay Sievers 761e5b476f make SYSFS{} usable for all devices
Patch from:
  Hannes Reinecke <hare@suse.de>
2005-07-20 12:12:56 -04:00
Kay Sievers 8815afa1df rename ALARM_TIMEOUT to UDEV_ALARM_TIMEOUT
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-06 14:42:26 +02:00
Kay Sievers 8bd41f36f7 pack parsed rules list
This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory
or file-size with precompiled rules.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-05 15:24:41 +02:00
Kay Sievers be4bedd16b unify execute_command() and execute_program()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-25 15:35:14 +02:00
Kay Sievers c9b8dbfb65 fix the fix and change the file to wait for to the "bus" link
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-22 02:11:59 +02:00
Kay Sievers d27d3bb052 fix udevstart and let all events trvel trough udev
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-22 01:31:24 +02:00
Kay Sievers 8ab44e3fd0 udevd: control log-priority of the running daemon with udevcontrol
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-16 01:58:47 +02:00
Hannes Reinecke d27d8d6a8d udev: fix netdev RUN handling
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-14 16:12:31 +02:00
Kay Sievers c07669bd66 udev: handle all events - not only class and block devices
Handle all events with rules. If udev is expected to handle hotplug.d/
the exernal helper must be called.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05 15:55:29 +02:00
Kay Sievers c2401132bf volume_id: use udev-provided log-level
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05 05:17:21 +02:00
Kay Sievers 6a522681e1 udev: move dev.d/ handling to external helper
Modern rules are expected to call notification and postprocessing with    
the RUN key. For compatibility the current behavior can be emulated
with an external helper.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05 05:11:29 +02:00
Kay Sievers 88f4b6485e udevd: listen for netlink events
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>
2005-06-05 04:38:10 +02:00
kay.sievers@vrfy.org 81af4e0519 [PATCH] export DEVNAME to RUN-key executed programs 2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org 821d0ec803 [PATCH] add RUN key to be able to run rule based notification
SUBSYSTEM=="block", RUN="/sbin/program"
  will execute the program only for block device events.

ACTION="remove", SUBSYSTEM=="block", RUN"/sbin/program"
  will execute the program, if a block device is removed.
2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org fb39f0566e [PATCH] move execute_program to utils + add action to init_device 2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org 6b493a20e1 [PATCH] support log-priority levels in udev.conf 2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org e5e322bc62 [PATCH] rename namedev_dev to udev_rule 2005-04-26 23:53:17 -07:00
kay.sievers@vrfy.org e6764498e7 [PATCH] correct enum device_type 2005-04-26 23:53:17 -07:00
kay.sievers@vrfy.org 63f61c5cf6 [PATCH] replace strncpy()/strncat() by strlcpy()/strlcat() 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org 56a8a624ee [PATCH] split udev and udevstart 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org 6c18b1fb87 [PATCH] rename LOG to USE_LOG in all places 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org e48fc108d9 [PATCH] allow unlimitied count of symlinks 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org 03cfa1394f [PATCH] correct udev_init_device 2005-04-26 23:39:48 -07:00
kay.sievers@vrfy.org 2a9a19245b [PATCH] determine device type in udev_init_device() 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org 5ef4268205 [PATCH] switch device type to enum 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org eabfc97367 [PATCH] handle renamed network interfaces properly if we manage hotplug.d/
If we take over the hotplug call and manage the events we don't need
to call the event fake script in dev.d/. Just set all expected values
to the new network interface name and call hotplug.d/. This way the
device renaming is completely handled inside of udev and userspace
can't get confused.
2005-04-26 23:19:09 -07:00
kay.sievers@vrfy.org 8b36cc0f17 [PATCH] complete removal of explicit udev permissions config file 2005-04-26 23:17:47 -07:00
kay.sievers@vrfy.org 82ca88904d [PATCH] klibc supports LOG_PID now, so remove our own implementation 2005-04-26 23:17:47 -07:00
Greg KH 18ebc43050 bleah, more merge fixes... 2005-04-26 23:15:56 -07:00
kay.sievers@vrfy.org bc0410fdb6 [PATCH] export DEVNAME regardless of the state of udev_dev_d 2005-04-26 23:13:48 -07:00
kay.sievers@vrfy.org 7e0bd58475 [PATCH] check earlier if we should run as udevstart 2005-04-26 23:13:48 -07:00
kay.sievers@vrfy.org 8544c9ad4f [PATCH] remove double initialization 2005-04-26 23:13:48 -07:00
kay.sievers@vrfy.org 51737eb8b8 [PATCH] add -V option to udev to print the version number
On Sat, 2004-12-11 at 18:44 +0200, Martin Schlemmer [c] wrote:
> 
> Any suggestions to determining the version of the installed udev?
> This is now during startup, to see if we can make use of using
> udevsend as hotplug agent.  If the system was up, udevinfo could
> be used, but that is in /usr/bin that might be on a seperate /usr.
> I know we might move udevinfo to /bin, but that might be an issue
> for some, and adding a -V switch to /sbin/udev might be a better
> choice.
2005-04-26 23:13:47 -07:00
kay.sievers@vrfy.org 927bda3792 [PATCH] handle /etc/hotplug.d/ only if the event comes from udevd 2005-04-26 23:00:29 -07:00
kay.sievers@vrfy.org 2af003feb2 [PATCH] trivial cleanups and change some comments 2005-04-26 23:00:29 -07:00