| 1 | /* -*- linux-c -*- |
|---|
| 2 | * |
|---|
| 3 | * |
|---|
| 4 | * Linux Magic System Request Key Hacks |
|---|
| 5 | * |
|---|
| 6 | * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> |
|---|
| 7 | * |
|---|
| 8 | * (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com> |
|---|
| 9 | * overhauled to use key registration |
|---|
| 10 | * based upon discusions in irc://irc.openprojects.net/#kernelnewbies |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | struct pt_regs; |
|---|
| 15 | struct tty_struct; |
|---|
| 16 | |
|---|
| 17 | /* Possible values of bitmask for enabling sysrq functions */ |
|---|
| 18 | /* 0x0001 is reserved for enable everything */ |
|---|
| 19 | #define SYSRQ_ENABLE_LOG 0x0002 |
|---|
| 20 | #define SYSRQ_ENABLE_KEYBOARD 0x0004 |
|---|
| 21 | #define SYSRQ_ENABLE_DUMP 0x0008 |
|---|
| 22 | #define SYSRQ_ENABLE_SYNC 0x0010 |
|---|
| 23 | #define SYSRQ_ENABLE_REMOUNT 0x0020 |
|---|
| 24 | #define SYSRQ_ENABLE_SIGNAL 0x0040 |
|---|
| 25 | #define SYSRQ_ENABLE_BOOT 0x0080 |
|---|
| 26 | #define SYSRQ_ENABLE_RTNICE 0x0100 |
|---|
| 27 | |
|---|
| 28 | struct sysrq_key_op { |
|---|
| 29 | void (*handler)(int, struct pt_regs *, struct tty_struct *); |
|---|
| 30 | char *help_msg; |
|---|
| 31 | char *action_msg; |
|---|
| 32 | int enable_mask; |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | #ifdef CONFIG_MAGIC_SYSRQ |
|---|
| 36 | |
|---|
| 37 | /* Generic SysRq interface -- you may call it from any device driver, supplying |
|---|
| 38 | * ASCII code of the key, pointer to registers and kbd/tty structs (if they |
|---|
| 39 | * are available -- else NULL's). |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| 42 | void handle_sysrq(int, struct pt_regs *, struct tty_struct *); |
|---|
| 43 | void __handle_sysrq(int, struct pt_regs *, struct tty_struct *, int check_mask); |
|---|
| 44 | int register_sysrq_key(int, struct sysrq_key_op *); |
|---|
| 45 | int unregister_sysrq_key(int, struct sysrq_key_op *); |
|---|
| 46 | struct sysrq_key_op *__sysrq_get_key_op(int key); |
|---|
| 47 | |
|---|
| 48 | #else |
|---|
| 49 | |
|---|
| 50 | static inline int __reterr(void) |
|---|
| 51 | { |
|---|
| 52 | return -EINVAL; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | #define register_sysrq_key(ig,nore) __reterr() |
|---|
| 56 | #define unregister_sysrq_key(ig,nore) __reterr() |
|---|
| 57 | |
|---|
| 58 | #endif |
|---|