-
Notifications
You must be signed in to change notification settings - Fork 732
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
sys: add windows support #1685
Merged
Merged
sys: add windows support #1685
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35ae4b8
to
a50a821
Compare
lmb
commented
Feb 17, 2025
lmb
commented
Feb 17, 2025
lmb
commented
Feb 17, 2025
lmb
commented
Feb 17, 2025
lmb
commented
Feb 17, 2025
ti-mo
reviewed
Feb 17, 2025
ti-mo
approved these changes
Feb 17, 2025
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.
Thanks! Left a few nits.
Add basic infrastructure to call into the eBPF for Windows runtime. This uses runtime dynamic linking to call into ebpfapi.dll instead of relying on CGo. Ultimately this boils down to using syscall.SyscallN to call into specific functions in the DLL and looks very similar to what we do on Linux. The most important function is a wrapper for the bpf() function in ebpfapi.dll. This is an ABI compatible re-implementation of the Linux bpf() syscall. Of course, not all of the syscall is implemented yet. In addition to that there are a variety of helper functions that do not have a bpf() equivalent and therefore need to be called directly. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
The sys package is at the core of the library, so make it work on Windows to minimise changes to the rest of the code base. The first important piece is a custom FD abstraction. On Windows, operating system resources are identified by handles. The differences are large enough that the efW runtime decided to wrap them in a file descriptor abstraction, most of which is provided by the Universal C Runtime on Windows. Change our FD type to call into the efW runtime. Second, Windows does not have the equivalent of bpffs. Instead objects are stored in a global table, keyed by a string. This means that we can't use file system APIs to manipulate pinning. Third, the bpf() syscall is emulated by calling into ebpfapi.dll. This is the key piece which allows most code to work unchanged. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More Windows pieces. Note that package ebpf, btf, link need follow up work.
efw: add wrappers for eBPF for Windows runtime
sys: add windows support