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_MULTI_SYSTEM "user_events_multi"
16 #define USER_EVENTS_PREFIX "u:"
18 /* Create dynamic location entry within a 32-bit value */
19 #define DYN_LOC(offset, size) ((size) << 16 | (offset))
21 /* List of supported registration flags */
23 /* Event will not delete upon last reference closing */
24 USER_EVENT_REG_PERSIST = 1U << 0,
26 /* Event will be allowed to have multiple formats */
27 USER_EVENT_REG_MULTI_FORMAT = 1U << 1,
29 /* This value or above is currently non-ABI */
30 USER_EVENT_REG_MAX = 1U << 2,
34 * Describes an event registration and stores the results of the registration.
35 * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
36 * must set the size and name_args before invocation.
40 /* Input: Size of the user_reg structure being used */
43 /* Input: Bit in enable address to use */
46 /* Input: Enable size in bytes at address */
49 /* Input: Flags to use, if any */
52 /* Input: Address to update when enabled */
55 /* Input: Pointer to string with event name, description and flags */
58 /* Output: Index of the event to use when writing data */
60 } __attribute__((__packed__));
63 * Describes an event unregister, callers must set the size, address and bit.
64 * This structure is passed to the DIAG_IOCSUNREG ioctl to disable bit updates.
67 /* Input: Size of the user_unreg structure being used */
70 /* Input: Bit to unregister */
73 /* Input: Reserved, set to 0 */
76 /* Input: Reserved, set to 0 */
79 /* Input: Address to unregister */
81 } __attribute__((__packed__));
83 #define DIAG_IOC_MAGIC '*'
85 /* Request to register a user_event */
86 #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
88 /* Request to delete a user_event */
89 #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
91 /* Requests to unregister a user_event */
92 #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
94 #endif /* _UAPI_LINUX_USER_EVENTS_H */