Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * Copyright (c) 2021, Microsoft Corporation.
0004  *
0005  * Authors:
0006  *   Beau Belgrave <beaub@linux.microsoft.com>
0007  */
0008 #ifndef _UAPI_LINUX_USER_EVENTS_H
0009 #define _UAPI_LINUX_USER_EVENTS_H
0010 
0011 #include <linux/types.h>
0012 #include <linux/ioctl.h>
0013 
0014 #ifdef __KERNEL__
0015 #include <linux/uio.h>
0016 #else
0017 #include <sys/uio.h>
0018 #endif
0019 
0020 #define USER_EVENTS_SYSTEM "user_events"
0021 #define USER_EVENTS_PREFIX "u:"
0022 
0023 /* Bits 0-6 are for known probe types, Bit 7 is for unknown probes */
0024 #define EVENT_BIT_FTRACE 0
0025 #define EVENT_BIT_PERF 1
0026 #define EVENT_BIT_OTHER 7
0027 
0028 #define EVENT_STATUS_FTRACE (1 << EVENT_BIT_FTRACE)
0029 #define EVENT_STATUS_PERF (1 << EVENT_BIT_PERF)
0030 #define EVENT_STATUS_OTHER (1 << EVENT_BIT_OTHER)
0031 
0032 /* Create dynamic location entry within a 32-bit value */
0033 #define DYN_LOC(offset, size) ((size) << 16 | (offset))
0034 
0035 /*
0036  * Describes an event registration and stores the results of the registration.
0037  * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
0038  * must set the size and name_args before invocation.
0039  */
0040 struct user_reg {
0041 
0042     /* Input: Size of the user_reg structure being used */
0043     __u32 size;
0044 
0045     /* Input: Pointer to string with event name, description and flags */
0046     __u64 name_args;
0047 
0048     /* Output: Byte index of the event within the status page */
0049     __u32 status_index;
0050 
0051     /* Output: Index of the event to use when writing data */
0052     __u32 write_index;
0053 };
0054 
0055 #define DIAG_IOC_MAGIC '*'
0056 
0057 /* Requests to register a user_event */
0058 #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg*)
0059 
0060 /* Requests to delete a user_event */
0061 #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char*)
0062 
0063 #endif /* _UAPI_LINUX_USER_EVENTS_H */