-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[EventPipe][UserEvents] Add copy of user_events structs #116930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces fallback definitions for specific user_events structs and associated macros to support cross builds of the Linux .NET SDK when the linux/user_events.h header is unavailable. Key changes include:
- Adding local definitions for user_reg, user_unreg, DIAG_IOCSREG, and DIAG_IOCSUNREG in ep-session-provider.h.
- Removing the direct inclusion of linux/user_events.h in ep-session-provider.c and adapting conditional compilation blocks accordingly.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/native/eventpipe/ep-session-provider.h | Adds fallback user_events definitions with conditional inclusion to support cross builds. |
src/native/eventpipe/ep-session-provider.c | Removes redundant header inclusion and updates preprocessor conditions for tracepoint support. |
Comments suppressed due to low confidence (2)
src/native/eventpipe/ep-session-provider.h:14
- Consider adding a comment here noting that the local definitions for user_events structures are a fallback for when linux/user_events.h is missing, and they should be maintained in sync with upstream changes.
#if HAVE_LINUX_USER_EVENTS_H
src/native/eventpipe/ep-session-provider.c:148
- Review the updated preprocessor condition that now only checks HAVE_SYS_IOCTL_H rather than both HAVE_LINUX_USER_EVENTS_H and HAVE_SYS_IOCTL_H to ensure this change covers all expected platforms without causing unintended behavior.
#if HAVE_SYS_IOCTL_H
__attribute__((__packed__)) isn't declared in src/native uint8_t __reserved as a field name will somehow be interpreted as unsigned char
/ba-g Failure is unrelated. #116734 (comment) also observed the same failure, and #116746 is suspected to be the same issue. |
The Linux .NET SDK build will build with
--cross
, which ends up not finding thelinux/user_events.h
header.For now, as only the
user_reg
,user_unreg
,DIAG_IOCSREG
, andDIAG_IOCSUNREG
types are needed, add a copy of those definitions in the event that thelinux/user_events.h
header is not found.NOTE: DIAG_IOCSREG and DIAG_IOCSUNREG are a user facing ABI value, and I grabbed them by printing out the macros in the linux user_events example here
After figuring out how to properly include the
linux/user_events.h
header in the cross build, this change will be reverted.Testing
Grabbed the Linux daily SDK build, built a simple console app, and sent the IPC Command to enable a user_events eventpipe session, received
0x80004005
which corresponds to DS_IPC_E_FAIL for the diagnostic server.Built these changes in a docker container running the same image that the machine that builds the SDK using
ROOTFS_DIR=/crossrootfs/x64 ./build.sh --cross -s clr -c Release
, copied over the artifacts into the console app's artifacts, and sent the IPC Command to enable a user_events eventpipe session and received a valid EventPipe Session ID.Enabling the user_events tracepoint enable bits, saw the expected events written to the trace file.