-
-
Notifications
You must be signed in to change notification settings - Fork 3k
#24471: add mlock syscalls in std.os.linux #24473
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.
This looks like a reasonable addition to the ZIg linux syscall wrappers. I've got a couple notes, but feel free to ignore me as I'm just a drive-by reviewer.
In addition to the notes below, I also suggest adding some very simple tests. Its okay if they just return EPERM
or EINVAL
for the calls, the important thing is to make sure the wrapper code is at least compiled, as unreached code is ignored.
86cb7da
to
7caf40b
Compare
Fixes LGTM. |
Will wait for additional guidance on this from core team |
I'd love to see these implemented as well (and @jeffective - feel free to compare/steal anything from my abandoned old draft PR here (this was from before the std.os/posix re-org, no longer directly-applicabe) - https://github.com/ziglang/zig/pull/19203/commits |
Linux already gained the relevant syscalls and consts in ziglang#24473 The basic mlock() and munlock() are fairly universal across the *nix world with a consistent interface, but are missing on wasi and windows. The mlockall() and munlockall() calls are not as widely supported as the basic ones. Notable non-implementers include darwin, haiku, and serenity (and of course wasi and windows again). mlock2() is Linux-only, as are its MLOCK flags.
Linux already gained the relevant syscalls and consts in ziglang#24473 The basic mlock() and munlock() are fairly universal across the *nix world with a consistent interface, but are missing on wasi and windows. The mlockall() and munlockall() calls are not as widely supported as the basic ones. Notable non-implementers include darwin, haiku, and serenity (and of course wasi and windows again). mlock2() is Linux-only, as are its MLOCK flags.
Linux already gained the relevant syscalls and consts in ziglang#24473 The basic mlock() and munlock() are fairly universal across the *nix world with a consistent interface, but are missing on wasi and windows. The mlockall() and munlockall() calls are not as widely supported as the basic ones. Notable non-implementers include darwin, haiku, and serenity (and of course wasi and windows again). mlock2() is Linux-only, as are its MLOCK flags.
Linux already gained the relevant syscalls and consts in #24473 The basic mlock() and munlock() are fairly universal across the *nix world with a consistent interface, but are missing on wasi and windows. The mlockall() and munlockall() calls are not as widely supported as the basic ones. Notable non-implementers include darwin, haiku, and serenity (and of course wasi and windows again). mlock2() is Linux-only, as are its MLOCK flags.
Linux already gained the relevant syscalls and consts in ziglang#24473 The basic mlock() and munlock() are fairly universal across the *nix world with a consistent interface, but are missing on wasi and windows. The mlockall() and munlockall() calls are not as widely supported as the basic ones. Notable non-implementers include darwin, haiku, and serenity (and of course wasi and windows again). mlock2() is Linux-only, as are its MLOCK flags.
closes #24471
MCL Flags
Please double-check the implementation of
MCL
. I interpreted results of searching the linux source tree:https://github.com/search?q=repo%3Atorvalds%2Flinux+MCL_ONFAULT&type=code
I found the flags by referencing
man mlock
: https://man7.org/linux/man-pages/man2/mlock.2.htmlVerification evidence
Create file
mlock-test.zig
:Run using zig built from source at commit 7caf40b (this PR)
Prior Art
https://github.com/tigerbeetle/tigerbeetle/blob/41c9a90dd930d360914f96bb2bd8a46d0ea2104d/src/stdx/mlock.zig#L29