user_events.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2021, Microsoft Corporation.
  4. *
  5. * Authors:
  6. * Beau Belgrave <[email protected]>
  7. */
  8. #ifndef _UAPI_LINUX_USER_EVENTS_H
  9. #define _UAPI_LINUX_USER_EVENTS_H
  10. #include <linux/types.h>
  11. #include <linux/ioctl.h>
  12. #ifdef __KERNEL__
  13. #include <linux/uio.h>
  14. #else
  15. #include <sys/uio.h>
  16. #endif
  17. #define USER_EVENTS_SYSTEM "user_events"
  18. #define USER_EVENTS_PREFIX "u:"
  19. /* Create dynamic location entry within a 32-bit value */
  20. #define DYN_LOC(offset, size) ((size) << 16 | (offset))
  21. /*
  22. * Describes an event registration and stores the results of the registration.
  23. * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
  24. * must set the size and name_args before invocation.
  25. */
  26. struct user_reg {
  27. /* Input: Size of the user_reg structure being used */
  28. __u32 size;
  29. /* Input: Pointer to string with event name, description and flags */
  30. __u64 name_args;
  31. /* Output: Bitwise index of the event within the status page */
  32. __u32 status_bit;
  33. /* Output: Index of the event to use when writing data */
  34. __u32 write_index;
  35. } __attribute__((__packed__));
  36. #define DIAG_IOC_MAGIC '*'
  37. /* Requests to register a user_event */
  38. #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg*)
  39. /* Requests to delete a user_event */
  40. #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char*)
  41. #endif /* _UAPI_LINUX_USER_EVENTS_H */