summaryrefslogtreecommitdiff
path: root/udevstart.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-01 05:07:19 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-01 05:07:19 +0200
commitd455b0085d65cd25915a34d84f894a4950d313a2 (patch)
tree9d948af85de34d1a5e210362e6b50f40ce4ee996 /udevstart.c
parent70721db6d7ba0d4f3ac5c17f2cedac056065ad8a (diff)
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>
Diffstat (limited to 'udevstart.c')
-rw-r--r--udevstart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/udevstart.c b/udevstart.c
index 0bcbc39737..5f3ba711f0 100644
--- a/udevstart.c
+++ b/udevstart.c
@@ -160,8 +160,12 @@ run:
struct name_entry *name_loop;
dbg("executing run list");
- list_for_each_entry(name_loop, &udev.run_list, node)
- execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL);
+ list_for_each_entry(name_loop, &udev.run_list, node) {
+ if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0)
+ pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add");
+ else
+ execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL);
+ }
}
exit:
sysfs_close_class_device(class_dev);