1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Copyright (c) 2021-2022, Microsoft Corporation.
6 * Beau Belgrave <beaub@linux.microsoft.com>
8 #ifndef _UAPI_LINUX_USER_EVENTS_H
9 #define _UAPI_LINUX_USER_EVENTS_H
11 #include <linux/types.h>
12 #include <linux/ioctl.h>
14 #define USER_EVENTS_SYSTEM "user_events"
15 #define USER_EVENTS_PREFIX "u:"
17 /* Create dynamic location entry within a 32-bit value */
18 #define DYN_LOC(offset, size) ((size) << 16 | (offset))
20 /* List of supported registration flags */
22 /* Event will not delete upon last reference closing */
23 USER_EVENT_REG_PERSIST = 1U << 0,
25 /* This value or above is currently non-ABI */
26 USER_EVENT_REG_MAX = 1U << 1,
30 * Describes an event registration and stores the results of the registration.
31 * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
32 * must set the size and name_args before invocation.
36 /* Input: Size of the user_reg structure being used */
39 /* Input: Bit in enable address to use */
42 /* Input: Enable size in bytes at address */
45 /* Input: Flags to use, if any */
48 /* Input: Address to update when enabled */
51 /* Input: Pointer to string with event name, description and flags */
54 /* Output: Index of the event to use when writing data */
56 } __attribute__((__packed__));
59 * Describes an event unregister, callers must set the size, address and bit.
60 * This structure is passed to the DIAG_IOCSUNREG ioctl to disable bit updates.
63 /* Input: Size of the user_unreg structure being used */
66 /* Input: Bit to unregister */
69 /* Input: Reserved, set to 0 */
72 /* Input: Reserved, set to 0 */
75 /* Input: Address to unregister */
77 } __attribute__((__packed__));
79 #define DIAG_IOC_MAGIC '*'
81 /* Request to register a user_event */
82 #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
84 /* Request to delete a user_event */
85 #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
87 /* Requests to unregister a user_event */
88 #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
90 #endif /* _UAPI_LINUX_USER_EVENTS_H */