aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/sysrq.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-16 01:04:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:47 -0400
commitf40cbaa5b0a4719489e6e7947351c99a159aca30 (patch)
tree3e5ce20d5f56acabe588344dd187228d12343541 /drivers/char/sysrq.c
parentac0d86f5809598ddcd6bfa0ea8245ccc910e9eac (diff)
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/sysrq.c')
-rw-r--r--drivers/char/sysrq.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 2aa79ab1930d..dce4cc0e6953 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -23,6 +23,7 @@
23#include <linux/reboot.h> 23#include <linux/reboot.h>
24#include <linux/sysrq.h> 24#include <linux/sysrq.h>
25#include <linux/kbd_kern.h> 25#include <linux/kbd_kern.h>
26#include <linux/proc_fs.h>
26#include <linux/quotaops.h> 27#include <linux/quotaops.h>
27#include <linux/kernel.h> 28#include <linux/kernel.h>
28#include <linux/module.h> 29#include <linux/module.h>
@@ -534,3 +535,32 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op_p)
534 return __sysrq_swap_key_ops(key, NULL, op_p); 535 return __sysrq_swap_key_ops(key, NULL, op_p);
535} 536}
536EXPORT_SYMBOL(unregister_sysrq_key); 537EXPORT_SYMBOL(unregister_sysrq_key);
538
539#ifdef CONFIG_PROC_FS
540/*
541 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
542 */
543static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
544 size_t count, loff_t *ppos)
545{
546 if (count) {
547 char c;
548
549 if (get_user(c, buf))
550 return -EFAULT;
551 __handle_sysrq(c, NULL, 0);
552 }
553 return count;
554}
555
556static const struct file_operations proc_sysrq_trigger_operations = {
557 .write = write_sysrq_trigger,
558};
559
560static int __init sysrq_init(void)
561{
562 proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
563 return 0;
564}
565module_init(sysrq_init);
566#endif