diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-15 22:04:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 11:21:47 -0700 |
commit | f40cbaa5b0a4719489e6e7947351c99a159aca30 (patch) | |
tree | 3e5ce20d5f56acabe588344dd187228d12343541 /drivers/char | |
parent | ac0d86f5809598ddcd6bfa0ea8245ccc910e9eac (diff) | |
download | op-kernel-dev-f40cbaa5b0a4719489e6e7947351c99a159aca30.zip op-kernel-dev-f40cbaa5b0a4719489e6e7947351c99a159aca30.tar.gz |
proc: move sysrq-trigger out of fs/proc/
Move it into sysrq.c, along with the rest of the sysrq implementation.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/sysrq.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 2aa79ab..dce4cc0 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -23,6 +23,7 @@ #include <linux/reboot.h> #include <linux/sysrq.h> #include <linux/kbd_kern.h> +#include <linux/proc_fs.h> #include <linux/quotaops.h> #include <linux/kernel.h> #include <linux/module.h> @@ -534,3 +535,32 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) return __sysrq_swap_key_ops(key, NULL, op_p); } EXPORT_SYMBOL(unregister_sysrq_key); + +#ifdef CONFIG_PROC_FS +/* + * writing 'C' to /proc/sysrq-trigger is like sysrq-C + */ +static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +{ + if (count) { + char c; + + if (get_user(c, buf)) + return -EFAULT; + __handle_sysrq(c, NULL, 0); + } + return count; +} + +static const struct file_operations proc_sysrq_trigger_operations = { + .write = write_sysrq_trigger, +}; + +static int __init sysrq_init(void) +{ + proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); + return 0; +} +module_init(sysrq_init); +#endif |