sysrq.h 1.7 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/* -*- 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
 */

14 15
#ifndef _LINUX_SYSRQ_H
#define _LINUX_SYSRQ_H
L
Linus Torvalds 已提交
16

17
#include <linux/errno.h>
18
#include <linux/types.h>
L
Linus Torvalds 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31

/* 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 {
32
	void (*handler)(int);
L
Linus Torvalds 已提交
33 34 35 36 37 38 39 40 41 42 43 44
	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).
 */

45 46
void handle_sysrq(int key);
void __handle_sysrq(int key, bool check_mask);
47 48
int register_sysrq_key(int key, struct sysrq_key_op *op);
int unregister_sysrq_key(int key, struct sysrq_key_op *op);
L
Linus Torvalds 已提交
49 50
struct sysrq_key_op *__sysrq_get_key_op(int key);

51 52
int sysrq_toggle_support(int enable_mask);

L
Linus Torvalds 已提交
53 54
#else

55
static inline void handle_sysrq(int key)
56 57
{
}
58

59
static inline void __handle_sysrq(int key, bool check_mask)
60 61 62
{
}

63
static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
L
Linus Torvalds 已提交
64 65 66
{
	return -EINVAL;
}
67 68

static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
69
{
70
	return -EINVAL;
71
}
L
Linus Torvalds 已提交
72 73

#endif
74 75

#endif /* _LINUX_SYSRQ_H */