sysrq.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. struct pt_regs;
  14. struct tty_struct;
  15. /* Possible values of bitmask for enabling sysrq functions */
  16. /* 0x0001 is reserved for enable everything */
  17. #define SYSRQ_ENABLE_LOG 0x0002
  18. #define SYSRQ_ENABLE_KEYBOARD 0x0004
  19. #define SYSRQ_ENABLE_DUMP 0x0008
  20. #define SYSRQ_ENABLE_SYNC 0x0010
  21. #define SYSRQ_ENABLE_REMOUNT 0x0020
  22. #define SYSRQ_ENABLE_SIGNAL 0x0040
  23. #define SYSRQ_ENABLE_BOOT 0x0080
  24. #define SYSRQ_ENABLE_RTNICE 0x0100
  25. struct sysrq_key_op {
  26. void (*handler)(int, struct pt_regs *, struct tty_struct *);
  27. char *help_msg;
  28. char *action_msg;
  29. int enable_mask;
  30. };
  31. #ifdef CONFIG_MAGIC_SYSRQ
  32. /* Generic SysRq interface -- you may call it from any device driver, supplying
  33. * ASCII code of the key, pointer to registers and kbd/tty structs (if they
  34. * are available -- else NULL's).
  35. */
  36. void handle_sysrq(int, struct pt_regs *, struct tty_struct *);
  37. void __handle_sysrq(int, struct pt_regs *, struct tty_struct *, int check_mask);
  38. int register_sysrq_key(int, struct sysrq_key_op *);
  39. int unregister_sysrq_key(int, struct sysrq_key_op *);
  40. struct sysrq_key_op *__sysrq_get_key_op(int key);
  41. #else
  42. static inline int __reterr(void)
  43. {
  44. return -EINVAL;
  45. }
  46. #define register_sysrq_key(ig,nore) __reterr()
  47. #define unregister_sysrq_key(ig,nore) __reterr()
  48. #endif