diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-22 01:31:26 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-04-14 02:26:02 -0400 |
commit | 97f5f0cd8cd0a05449cbb77d1e6f02e026875802 (patch) | |
tree | e101f38dfd7bf4e759e96617f69ceedd497608e3 /kernel/sysctl.c | |
parent | b91c4be730668e801aa6a2ea95f467cd9a1e0983 (diff) |
Input: implement SysRq as a separate input handler
Instead of keeping SysRq support inside of legacy keyboard driver split
it out into a separate input handler (filter). This stops most SysRq input
events from leaking into evdev clients (some events, such as first SysRq
scancode - not keycode - event, are still leaked into both legacy keyboard
and evdev).
[martinez.javier@gmail.com: fix compile error when CONFIG_MAGIC_SYSRQ is
not defined]
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8686b0f5fc12..ce724a0dd0bb 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -163,6 +163,27 @@ static int proc_taint(struct ctl_table *table, int write, | |||
163 | void __user *buffer, size_t *lenp, loff_t *ppos); | 163 | void __user *buffer, size_t *lenp, loff_t *ppos); |
164 | #endif | 164 | #endif |
165 | 165 | ||
166 | #ifdef CONFIG_MAGIC_SYSRQ | ||
167 | static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ | ||
168 | |||
169 | static int sysrq_sysctl_handler(ctl_table *table, int write, | ||
170 | void __user *buffer, size_t *lenp, | ||
171 | loff_t *ppos) | ||
172 | { | ||
173 | int error; | ||
174 | |||
175 | error = proc_dointvec(table, write, buffer, lenp, ppos); | ||
176 | if (error) | ||
177 | return error; | ||
178 | |||
179 | if (write) | ||
180 | sysrq_toggle_support(__sysrq_enabled); | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | #endif | ||
186 | |||
166 | static struct ctl_table root_table[]; | 187 | static struct ctl_table root_table[]; |
167 | static struct ctl_table_root sysctl_table_root; | 188 | static struct ctl_table_root sysctl_table_root; |
168 | static struct ctl_table_header root_table_header = { | 189 | static struct ctl_table_header root_table_header = { |
@@ -567,7 +588,7 @@ static struct ctl_table kern_table[] = { | |||
567 | .data = &__sysrq_enabled, | 588 | .data = &__sysrq_enabled, |
568 | .maxlen = sizeof (int), | 589 | .maxlen = sizeof (int), |
569 | .mode = 0644, | 590 | .mode = 0644, |
570 | .proc_handler = proc_dointvec, | 591 | .proc_handler = sysrq_sysctl_handler, |
571 | }, | 592 | }, |
572 | #endif | 593 | #endif |
573 | #ifdef CONFIG_PROC_SYSCTL | 594 | #ifdef CONFIG_PROC_SYSCTL |