Skip to content
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

Use rustix instead of libc #24

Merged
merged 1 commit into from
Oct 19, 2023
Merged

Use rustix instead of libc #24

merged 1 commit into from
Oct 19, 2023

Conversation

swsnr
Copy link
Owner

@swsnr swsnr commented Oct 19, 2023

rustix provides safe alternatives to everything we do with libc and
lets us get rid of a bunch of weird code.

@swsnr swsnr self-assigned this Oct 19, 2023
@swsnr swsnr force-pushed the rustix branch 3 times, most recently from de6e118 to 39be659 Compare October 19, 2023 06:59
@daniestevez
Copy link

rustix's memfd_create implementation uses some magic to call the libc function if present or perform a syscall if not. So it seems that this will solve the problems I described in #22, which is great news.

@swsnr
Copy link
Owner Author

swsnr commented Oct 19, 2023

I thought rustix doesn't use libc at all unless the use-libc feature was set?

In any case, it doesn't work, so don't have your hopes too high. For some reason sending the FD over an unconnected socket returns EINVAL 🤷, hence the test failure. Haven't had time to take a closer look yet.

@daniestevez
Copy link

I thought rustix doesn't use libc at all unless the use-libc feature was set?

I was reading the #[cfg]'s in lib.rs wrong. By default it uses the linux_raw backed, as the documentation says.

@swsnr
Copy link
Owner Author

swsnr commented Oct 19, 2023

Blocked on bytecodealliance/rustix#884

rustix provides safe alternatives to everything we do with libc and
lets us get rid of a bunch of weird code.
@swsnr swsnr marked this pull request as ready for review October 19, 2023 17:51
@swsnr swsnr merged commit a1145b7 into main Oct 19, 2023
3 checks passed
@swsnr swsnr deleted the rustix branch October 19, 2023 18:09
@swsnr
Copy link
Owner Author

swsnr commented Oct 19, 2023

Released as 2.1.0, thanks to the very very fast fix by the rustix maintainers. Thanks @sunfishcode 👏🏿

@daniestevez
Copy link

Thank you! I have tested this new release in my embedded platform with an old glibc and it works perfectly. I can now continue using an unmodified version of this crate.

@swsnr
Copy link
Owner Author

swsnr commented Oct 20, 2023

Your welcome. It's just coincidental though; I just wanted to get rid of all the unsafe code 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants