logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

user_events.h (2494B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2021-2022, Microsoft Corporation.
  4. *
  5. * Authors:
  6. * Beau Belgrave <beaub@linux.microsoft.com>
  7. */
  8. #ifndef _LINUX_USER_EVENTS_H
  9. #define _LINUX_USER_EVENTS_H
  10. #include <linux/types.h>
  11. #include <linux/ioctl.h>
  12. #define USER_EVENTS_SYSTEM "user_events"
  13. #define USER_EVENTS_MULTI_SYSTEM "user_events_multi"
  14. #define USER_EVENTS_PREFIX "u:"
  15. /* Create dynamic location entry within a 32-bit value */
  16. #define DYN_LOC(offset, size) ((size) << 16 | (offset))
  17. /* List of supported registration flags */
  18. enum user_reg_flag {
  19. /* Event will not delete upon last reference closing */
  20. USER_EVENT_REG_PERSIST = 1U << 0,
  21. /* Event will be allowed to have multiple formats */
  22. USER_EVENT_REG_MULTI_FORMAT = 1U << 1,
  23. /* This value or above is currently non-ABI */
  24. USER_EVENT_REG_MAX = 1U << 2,
  25. };
  26. /*
  27. * Describes an event registration and stores the results of the registration.
  28. * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
  29. * must set the size and name_args before invocation.
  30. */
  31. struct user_reg {
  32. /* Input: Size of the user_reg structure being used */
  33. __u32 size;
  34. /* Input: Bit in enable address to use */
  35. __u8 enable_bit;
  36. /* Input: Enable size in bytes at address */
  37. __u8 enable_size;
  38. /* Input: Flags to use, if any */
  39. __u16 flags;
  40. /* Input: Address to update when enabled */
  41. __u64 enable_addr;
  42. /* Input: Pointer to string with event name, description and flags */
  43. __u64 name_args;
  44. /* Output: Index of the event to use when writing data */
  45. __u32 write_index;
  46. } __attribute__((__packed__));
  47. /*
  48. * Describes an event unregister, callers must set the size, address and bit.
  49. * This structure is passed to the DIAG_IOCSUNREG ioctl to disable bit updates.
  50. */
  51. struct user_unreg {
  52. /* Input: Size of the user_unreg structure being used */
  53. __u32 size;
  54. /* Input: Bit to unregister */
  55. __u8 disable_bit;
  56. /* Input: Reserved, set to 0 */
  57. __u8 __reserved;
  58. /* Input: Reserved, set to 0 */
  59. __u16 __reserved2;
  60. /* Input: Address to unregister */
  61. __u64 disable_addr;
  62. } __attribute__((__packed__));
  63. #define DIAG_IOC_MAGIC '*'
  64. /* Request to register a user_event */
  65. #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
  66. /* Request to delete a user_event */
  67. #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
  68. /* Requests to unregister a user_event */
  69. #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
  70. #endif /* _LINUX_USER_EVENTS_H */