diff options
-rw-r--r-- | drivers/char/sysrq.c | 30 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 26 |
2 files changed, 30 insertions, 26 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 | } |
536 | EXPORT_SYMBOL(unregister_sysrq_key); | 537 | EXPORT_SYMBOL(unregister_sysrq_key); |
538 | |||
539 | #ifdef CONFIG_PROC_FS | ||
540 | /* | ||
541 | * writing 'C' to /proc/sysrq-trigger is like sysrq-C | ||
542 | */ | ||
543 | static 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 | |||
556 | static const struct file_operations proc_sysrq_trigger_operations = { | ||
557 | .write = write_sysrq_trigger, | ||
558 | }; | ||
559 | |||
560 | static int __init sysrq_init(void) | ||
561 | { | ||
562 | proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | ||
563 | return 0; | ||
564 | } | ||
565 | module_init(sysrq_init); | ||
566 | #endif | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index b675a49c1823..59ea42e1ef03 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/hugetlb.h> | 46 | #include <linux/hugetlb.h> |
47 | #include <linux/jiffies.h> | 47 | #include <linux/jiffies.h> |
48 | #include <linux/sysrq.h> | ||
49 | #include <linux/vmalloc.h> | 48 | #include <linux/vmalloc.h> |
50 | #include <linux/crash_dump.h> | 49 | #include <linux/crash_dump.h> |
51 | #include <linux/pid_namespace.h> | 50 | #include <linux/pid_namespace.h> |
@@ -704,28 +703,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off, | |||
704 | return proc_calc_metrics(page, start, off, count, eof, len); | 703 | return proc_calc_metrics(page, start, off, count, eof, len); |
705 | } | 704 | } |
706 | 705 | ||
707 | #ifdef CONFIG_MAGIC_SYSRQ | ||
708 | /* | ||
709 | * writing 'C' to /proc/sysrq-trigger is like sysrq-C | ||
710 | */ | ||
711 | static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, | ||
712 | size_t count, loff_t *ppos) | ||
713 | { | ||
714 | if (count) { | ||
715 | char c; | ||
716 | |||
717 | if (get_user(c, buf)) | ||
718 | return -EFAULT; | ||
719 | __handle_sysrq(c, NULL, 0); | ||
720 | } | ||
721 | return count; | ||
722 | } | ||
723 | |||
724 | static const struct file_operations proc_sysrq_trigger_operations = { | ||
725 | .write = write_sysrq_trigger, | ||
726 | }; | ||
727 | #endif | ||
728 | |||
729 | #ifdef CONFIG_PROC_PAGE_MONITOR | 706 | #ifdef CONFIG_PROC_PAGE_MONITOR |
730 | #define KPMSIZE sizeof(u64) | 707 | #define KPMSIZE sizeof(u64) |
731 | #define KPMMASK (KPMSIZE - 1) | 708 | #define KPMMASK (KPMSIZE - 1) |
@@ -934,7 +911,4 @@ void __init proc_misc_init(void) | |||
934 | #ifdef CONFIG_PROC_VMCORE | 911 | #ifdef CONFIG_PROC_VMCORE |
935 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); | 912 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); |
936 | #endif | 913 | #endif |
937 | #ifdef CONFIG_MAGIC_SYSRQ | ||
938 | proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | ||
939 | #endif | ||
940 | } | 914 | } |