coredump.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_LINUX_COREDUMP_H
  3. #define _UAPI_LINUX_COREDUMP_H
  4. #include <linux/types.h>
  5. /**
  6. * coredump_{req,ack} flags
  7. * @COREDUMP_KERNEL: kernel writes coredump
  8. * @COREDUMP_USERSPACE: userspace writes coredump
  9. * @COREDUMP_REJECT: don't generate coredump
  10. * @COREDUMP_WAIT: wait for coredump server
  11. */
  12. enum {
  13. COREDUMP_KERNEL = (1ULL << 0),
  14. COREDUMP_USERSPACE = (1ULL << 1),
  15. COREDUMP_REJECT = (1ULL << 2),
  16. COREDUMP_WAIT = (1ULL << 3),
  17. };
  18. /**
  19. * struct coredump_req - message kernel sends to userspace
  20. * @size: size of struct coredump_req
  21. * @size_ack: known size of struct coredump_ack on this kernel
  22. * @mask: supported features
  23. *
  24. * When a coredump happens the kernel will connect to the coredump
  25. * socket and send a coredump request to the coredump server. The @size
  26. * member is set to the size of struct coredump_req and provides a hint
  27. * to userspace how much data can be read. Userspace may use MSG_PEEK to
  28. * peek the size of struct coredump_req and then choose to consume it in
  29. * one go. Userspace may also simply read a COREDUMP_ACK_SIZE_VER0
  30. * request. If the size the kernel sends is larger userspace simply
  31. * discards any remaining data.
  32. *
  33. * The coredump_req->mask member is set to the currently know features.
  34. * Userspace may only set coredump_ack->mask to the bits raised by the
  35. * kernel in coredump_req->mask.
  36. *
  37. * The coredump_req->size_ack member is set by the kernel to the size of
  38. * struct coredump_ack the kernel knows. Userspace may only send up to
  39. * coredump_req->size_ack bytes to the kernel and must set
  40. * coredump_ack->size accordingly.
  41. */
  42. struct coredump_req {
  43. __u32 size;
  44. __u32 size_ack;
  45. __u64 mask;
  46. };
  47. enum {
  48. COREDUMP_REQ_SIZE_VER0 = 16U, /* size of first published struct */
  49. };
  50. /**
  51. * struct coredump_ack - message userspace sends to kernel
  52. * @size: size of the struct
  53. * @spare: unused
  54. * @mask: features kernel is supposed to use
  55. *
  56. * The @size member must be set to the size of struct coredump_ack. It
  57. * may never exceed what the kernel returned in coredump_req->size_ack
  58. * but it may of course be smaller (>= COREDUMP_ACK_SIZE_VER0 and <=
  59. * coredump_req->size_ack).
  60. *
  61. * The @mask member must be set to the features the coredump server
  62. * wants the kernel to use. Only bits the kernel returned in
  63. * coredump_req->mask may be set.
  64. */
  65. struct coredump_ack {
  66. __u32 size;
  67. __u32 spare;
  68. __u64 mask;
  69. };
  70. enum {
  71. COREDUMP_ACK_SIZE_VER0 = 16U, /* size of first published struct */
  72. };
  73. /**
  74. * enum coredump_mark - Markers for the coredump socket
  75. *
  76. * The kernel will place a single byte on the coredump socket. The
  77. * markers notify userspace whether the coredump ack succeeded or
  78. * failed.
  79. *
  80. * @COREDUMP_MARK_MINSIZE: the provided coredump_ack size was too small
  81. * @COREDUMP_MARK_MAXSIZE: the provided coredump_ack size was too big
  82. * @COREDUMP_MARK_UNSUPPORTED: the provided coredump_ack mask was invalid
  83. * @COREDUMP_MARK_CONFLICTING: the provided coredump_ack mask has conflicting options
  84. * @COREDUMP_MARK_REQACK: the coredump request and ack was successful
  85. * @__COREDUMP_MARK_MAX: the maximum coredump mark value
  86. */
  87. enum coredump_mark {
  88. COREDUMP_MARK_REQACK = 0U,
  89. COREDUMP_MARK_MINSIZE = 1U,
  90. COREDUMP_MARK_MAXSIZE = 2U,
  91. COREDUMP_MARK_UNSUPPORTED = 3U,
  92. COREDUMP_MARK_CONFLICTING = 4U,
  93. __COREDUMP_MARK_MAX = (1U << 31),
  94. };
  95. #endif /* _UAPI_LINUX_COREDUMP_H */