sysrq.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* -*- linux-c -*-
  2. *
  3. * $Id: sysrq.h,v 1.3 1997/07/17 11:54:33 mj Exp $
  4. *
  5. * Linux Magic System Request Key Hacks
  6. *
  7. * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  8. *
  9. * (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com>
  10. * overhauled to use key registration
  11. * based upon discusions in irc://irc.openprojects.net/#kernelnewbies
  12. */
  13. #ifndef _LINUX_SYSRQ_H
  14. #define _LINUX_SYSRQ_H
  15. #include <linux/errno.h>
  16. #include <linux/types.h>
  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. struct sysrq_key_op {
  28. void (*handler)(int);
  29. char *help_msg;
  30. char *action_msg;
  31. int enable_mask;
  32. };
  33. #ifdef CONFIG_MAGIC_SYSRQ
  34. /* Generic SysRq interface -- you may call it from any device driver, supplying
  35. * ASCII code of the key, pointer to registers and kbd/tty structs (if they
  36. * are available -- else NULL's).
  37. */
  38. void handle_sysrq(int key);
  39. void __handle_sysrq(int key, bool check_mask);
  40. int register_sysrq_key(int key, struct sysrq_key_op *op);
  41. int unregister_sysrq_key(int key, struct sysrq_key_op *op);
  42. struct sysrq_key_op *__sysrq_get_key_op(int key);
  43. int sysrq_toggle_support(int enable_mask);
  44. #else
  45. static inline void handle_sysrq(int key)
  46. {
  47. }
  48. static inline void __handle_sysrq(int key, bool check_mask)
  49. {
  50. }
  51. static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
  52. {
  53. return -EINVAL;
  54. }
  55. static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
  56. {
  57. return -EINVAL;
  58. }
  59. #endif
  60. #endif /* _LINUX_SYSRQ_H */