2005-04-17 06:20:36 +08:00
|
|
|
/* -*- linux-c -*-
|
|
|
|
*
|
|
|
|
* $Id: sysrq.h,v 1.3 1997/07/17 11:54:33 mj Exp $
|
|
|
|
*
|
|
|
|
* Linux Magic System Request Key Hacks
|
|
|
|
*
|
|
|
|
* (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
|
|
|
|
*
|
|
|
|
* (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com>
|
|
|
|
* overhauled to use key registration
|
|
|
|
* based upon discusions in irc://irc.openprojects.net/#kernelnewbies
|
|
|
|
*/
|
|
|
|
|
2006-10-01 14:27:54 +08:00
|
|
|
#ifndef _LINUX_SYSRQ_H
|
|
|
|
#define _LINUX_SYSRQ_H
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-07-06 03:08:23 +08:00
|
|
|
#include <linux/errno.h>
|
2010-08-18 12:15:47 +08:00
|
|
|
#include <linux/types.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Possible values of bitmask for enabling sysrq functions */
|
|
|
|
/* 0x0001 is reserved for enable everything */
|
|
|
|
#define SYSRQ_ENABLE_LOG 0x0002
|
|
|
|
#define SYSRQ_ENABLE_KEYBOARD 0x0004
|
|
|
|
#define SYSRQ_ENABLE_DUMP 0x0008
|
|
|
|
#define SYSRQ_ENABLE_SYNC 0x0010
|
|
|
|
#define SYSRQ_ENABLE_REMOUNT 0x0020
|
|
|
|
#define SYSRQ_ENABLE_SIGNAL 0x0040
|
|
|
|
#define SYSRQ_ENABLE_BOOT 0x0080
|
|
|
|
#define SYSRQ_ENABLE_RTNICE 0x0100
|
|
|
|
|
|
|
|
struct sysrq_key_op {
|
2010-08-18 12:15:46 +08:00
|
|
|
void (*handler)(int);
|
2005-04-17 06:20:36 +08:00
|
|
|
char *help_msg;
|
|
|
|
char *action_msg;
|
|
|
|
int enable_mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_MAGIC_SYSRQ
|
|
|
|
|
|
|
|
/* Generic SysRq interface -- you may call it from any device driver, supplying
|
|
|
|
* ASCII code of the key, pointer to registers and kbd/tty structs (if they
|
|
|
|
* are available -- else NULL's).
|
|
|
|
*/
|
|
|
|
|
2010-08-18 12:15:47 +08:00
|
|
|
void handle_sysrq(int key);
|
|
|
|
void __handle_sysrq(int key, bool check_mask);
|
2006-12-13 16:34:36 +08:00
|
|
|
int register_sysrq_key(int key, struct sysrq_key_op *op);
|
|
|
|
int unregister_sysrq_key(int key, struct sysrq_key_op *op);
|
2005-04-17 06:20:36 +08:00
|
|
|
struct sysrq_key_op *__sysrq_get_key_op(int key);
|
|
|
|
|
2010-03-22 13:31:26 +08:00
|
|
|
int sysrq_toggle_support(int enable_mask);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
|
|
|
|
2010-08-18 12:15:47 +08:00
|
|
|
static inline void handle_sysrq(int key)
|
2006-12-13 16:34:36 +08:00
|
|
|
{
|
|
|
|
}
|
2010-03-22 13:31:26 +08:00
|
|
|
|
2010-08-18 12:15:47 +08:00
|
|
|
static inline void __handle_sysrq(int key, bool check_mask)
|
2010-08-18 12:15:46 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-22 13:31:26 +08:00
|
|
|
static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2010-03-22 13:31:26 +08:00
|
|
|
|
|
|
|
static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
|
2006-12-13 16:34:36 +08:00
|
|
|
{
|
2010-03-22 13:31:26 +08:00
|
|
|
return -EINVAL;
|
2006-12-13 16:34:36 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#endif
|
2006-10-01 14:27:54 +08:00
|
|
|
|
|
|
|
#endif /* _LINUX_SYSRQ_H */
|