2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
15 #include "sysdep/ptrace.h"
17 #define MCONSOLE_MAGIC (0xcafebabe)
18 #define MCONSOLE_MAX_DATA (512)
19 #define MCONSOLE_VERSION 2
21 struct mconsole_request {
25 char data[MCONSOLE_MAX_DATA];
28 struct mconsole_reply {
32 char data[MCONSOLE_MAX_DATA];
35 struct mconsole_notify {
38 enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
39 MCONSOLE_USER_NOTIFY } type;
41 char data[MCONSOLE_MAX_DATA];
46 enum mc_context { MCONSOLE_INTR, MCONSOLE_PROC };
48 struct mconsole_command
51 void (*handler)(struct mc_request *req);
52 enum mc_context context;
61 unsigned int originlen;
62 unsigned char origin[128]; /* sockaddr_un */
64 struct mconsole_request request;
65 struct mconsole_command *cmd;
66 struct uml_pt_regs regs;
69 extern char mconsole_socket_name[];
71 extern int mconsole_unlink_socket(void);
72 extern int mconsole_reply_len(struct mc_request *req, const char *reply,
73 int len, int err, int more);
74 extern int mconsole_reply(struct mc_request *req, const char *str, int err,
77 extern void mconsole_version(struct mc_request *req);
78 extern void mconsole_help(struct mc_request *req);
79 extern void mconsole_halt(struct mc_request *req);
80 extern void mconsole_reboot(struct mc_request *req);
81 extern void mconsole_config(struct mc_request *req);
82 extern void mconsole_remove(struct mc_request *req);
83 extern void mconsole_sysrq(struct mc_request *req);
84 extern void mconsole_cad(struct mc_request *req);
85 extern void mconsole_stop(struct mc_request *req);
86 extern void mconsole_go(struct mc_request *req);
87 extern void mconsole_log(struct mc_request *req);
88 extern void mconsole_proc(struct mc_request *req);
89 extern void mconsole_stack(struct mc_request *req);
91 extern int mconsole_get_request(int fd, struct mc_request *req);
92 extern int mconsole_notify(char *sock_name, int type, const void *data,
94 extern char *mconsole_notify_socket(void);
95 extern void lock_notify(void);
96 extern void unlock_notify(void);