aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-11-10 22:58:04 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 19:18:07 -0500
commit0f76e5acf9dc788e664056dda1e461f0bec93948 (patch)
treefdb7db438cb03fb3e0508d582a7cc1321c62efed
parent0296b2281352e4794e174b393c37f131502e09f0 (diff)
[PATCH] add uevent_helper control in /sys/kernel/
This deprecates the /proc/sys/kernel/hotplug file, as all this stuff should be in /sys some day, right? :) In /sys/kernel/ we have now uevent_seqnum and uevent_helper. The seqnum is no longer used by udev, as the version for this kernel depends on netlink which events will never get out-of-order. Recent udev versions disable the /sbin/hotplug helper with an init script, cause it leads to OOM on big boxes by running hundreds of shells in parallel. It should be done now by: echo "" > /sys/kernel/uevent_helper (Note that "-n" does not work, cause neighter proc nor sysfs support truncate().) Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--kernel/ksysfs.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 015fb69ad94d..e975a76a9d5b 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -23,11 +23,29 @@ static struct subsys_attribute _name##_attr = \
23 __ATTR(_name, 0644, _name##_show, _name##_store) 23 __ATTR(_name, 0644, _name##_show, _name##_store)
24 24
25#ifdef CONFIG_HOTPLUG 25#ifdef CONFIG_HOTPLUG
26static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page) 26/* current uevent sequence number */
27static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page)
27{ 28{
28 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum); 29 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
29} 30}
30KERNEL_ATTR_RO(hotplug_seqnum); 31KERNEL_ATTR_RO(uevent_seqnum);
32
33/* uevent helper program, used during early boo */
34static ssize_t uevent_helper_show(struct subsystem *subsys, char *page)
35{
36 return sprintf(page, "%s\n", hotplug_path);
37}
38static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count)
39{
40 if (count+1 > HOTPLUG_PATH_LEN)
41 return -ENOENT;
42 memcpy(hotplug_path, page, count);
43 hotplug_path[count] = '\0';
44 if (count && hotplug_path[count-1] == '\n')
45 hotplug_path[count-1] = '\0';
46 return count;
47}
48KERNEL_ATTR_RW(uevent_helper);
31#endif 49#endif
32 50
33#ifdef CONFIG_KEXEC 51#ifdef CONFIG_KEXEC
@@ -45,7 +63,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys);
45 63
46static struct attribute * kernel_attrs[] = { 64static struct attribute * kernel_attrs[] = {
47#ifdef CONFIG_HOTPLUG 65#ifdef CONFIG_HOTPLUG
48 &hotplug_seqnum_attr.attr, 66 &uevent_seqnum_attr.attr,
67 &uevent_helper_attr.attr,
49#endif 68#endif
50#ifdef CONFIG_KEXEC 69#ifdef CONFIG_KEXEC
51 &crash_notes_attr.attr, 70 &crash_notes_attr.attr,