mconsole.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  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
  5. */
  6. #ifndef __MCONSOLE_H__
  7. #define __MCONSOLE_H__
  8. #ifdef __UM_HOST__
  9. #include <stdint.h>
  10. #define u32 uint32_t
  11. #endif
  12. #include <sysdep/ptrace.h>
  13. #define MCONSOLE_MAGIC (0xcafebabe)
  14. #define MCONSOLE_MAX_DATA (512)
  15. #define MCONSOLE_VERSION 2
  16. struct mconsole_request {
  17. u32 magic;
  18. u32 version;
  19. u32 len;
  20. char data[MCONSOLE_MAX_DATA];
  21. };
  22. struct mconsole_reply {
  23. u32 err;
  24. u32 more;
  25. u32 len;
  26. char data[MCONSOLE_MAX_DATA];
  27. };
  28. struct mconsole_notify {
  29. u32 magic;
  30. u32 version;
  31. enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
  32. MCONSOLE_USER_NOTIFY } type;
  33. u32 len;
  34. char data[MCONSOLE_MAX_DATA];
  35. };
  36. struct mc_request;
  37. enum mc_context { MCONSOLE_INTR, MCONSOLE_PROC };
  38. struct mconsole_command
  39. {
  40. char *command;
  41. void (*handler)(struct mc_request *req);
  42. enum mc_context context;
  43. };
  44. struct mc_request
  45. {
  46. int len;
  47. int as_interrupt;
  48. int originating_fd;
  49. unsigned int originlen;
  50. unsigned char origin[128]; /* sockaddr_un */
  51. struct mconsole_request request;
  52. struct mconsole_command *cmd;
  53. struct uml_pt_regs regs;
  54. };
  55. extern char mconsole_socket_name[];
  56. extern int mconsole_unlink_socket(void);
  57. extern int mconsole_reply_len(struct mc_request *req, const char *reply,
  58. int len, int err, int more);
  59. extern int mconsole_reply(struct mc_request *req, const char *str, int err,
  60. int more);
  61. extern void mconsole_version(struct mc_request *req);
  62. extern void mconsole_help(struct mc_request *req);
  63. extern void mconsole_halt(struct mc_request *req);
  64. extern void mconsole_reboot(struct mc_request *req);
  65. extern void mconsole_config(struct mc_request *req);
  66. extern void mconsole_remove(struct mc_request *req);
  67. extern void mconsole_sysrq(struct mc_request *req);
  68. extern void mconsole_cad(struct mc_request *req);
  69. extern void mconsole_stop(struct mc_request *req);
  70. extern void mconsole_go(struct mc_request *req);
  71. extern void mconsole_log(struct mc_request *req);
  72. extern void mconsole_proc(struct mc_request *req);
  73. extern void mconsole_stack(struct mc_request *req);
  74. extern int mconsole_get_request(int fd, struct mc_request *req);
  75. extern int mconsole_notify(char *sock_name, int type, const void *data,
  76. int len);
  77. extern char *mconsole_notify_socket(void);
  78. extern void lock_notify(void);
  79. extern void unlock_notify(void);
  80. #endif