-
Notifications
You must be signed in to change notification settings - Fork 666
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
expose memfd on freebsd #1808
expose memfd on freebsd #1808
Conversation
546512f
to
1e93e4c
Compare
@@ -40,7 +42,15 @@ libc_bitflags!( | |||
/// [`memfd_create(2)`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html | |||
pub fn memfd_create(name: &CStr, flags: MemFdCreateFlag) -> Result<RawFd> { | |||
let res = unsafe { | |||
libc::syscall(libc::SYS_memfd_create, name.as_ptr(), flags.bits()) |
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.
I would rather not bend over backwards to cater to the obscure arches. If they don't define the libc symbol, then I think we should just not bind it. We can do it like this:
#[cfg(any(target_os = "freebsd", target_env = "gnu", target_env = "musl"))]
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.
Sorry it wasn't architecture, it seems that it's just armv7 uclibceabihf that's failing
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.
I have some solution but it's a more ugly cfg block.
Essentially use the libc symbol if it's freebsd or gnu/musl linux and otherwise use the syscall function.
Or was the intention to gate memfd_create from all linuxes that aren't using a gnu or musl libc?
a1428e4
to
b0531ae
Compare
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.
bors r+
Merge conflict. |
b0531ae
to
622c7d7
Compare
622c7d7
to
cf15c2b
Compare
conflicts are fixed |
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.
bors r+
Build failed: |
The failures appear to be unrelated to this pull request. It's new clippy lints firing |
The build should be fixed if you rebase. |
bors r+ |
Resolves #1775