-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Implement accept4 on Android as raw syscall. #1968
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
3c8fd95
to
5bcac36
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.
Looks fine to me, thanks!
@bors r+ |
📌 Commit 5bcac36 has been approved by |
Implement accept4 on Android as raw syscall. This PR implements `accept4()` on Android using `syscall()` instead of the `accept4()` wrapper. This is done because the `accept4()` wrapper wasn't added to Androids `libc` until version 5.0 (API level 21). By using `syscall` directly, `accept4` will also work on older Android versions. The kernel itself has supported it since Linux 2.6.28, which was shipped with stock Android since version 1.6 already: https://en.wikipedia.org/wiki/Android_version_history#Android_1.6_Donut_(API_4) At the moment, the CI for the rust repo still uses API level 14. Although I also opened a PR to bump that too: rust-lang/rust#78601. However, it might make sense to keep the old API level in CI if this is merged.
💔 Test failed - checks-actions |
Applied the suggestion :) Also had to remove the trailing comma from the argument list. Should I squash the commits? |
Yeah, r=me once it's done. |
This avoids relying on Android 5.0 / API level 21. The Linux kernel used by Android supports the syscall (except in truly ancient Android versions), but the Android libc did not expose a wrapper.
9c8b7c8
to
36affa2
Compare
Squashed :) @bors r=JohnTitor |
@de-vri-es: 🔑 Insufficient privileges: Not in reviewers |
Awh, bors didn't like that :( |
Thanks! |
📌 Commit 36affa2 has been approved by |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
This PR implements
accept4()
on Android usingsyscall()
instead of theaccept4()
wrapper.This is done because the
accept4()
wrapper wasn't added to Androidslibc
until version 5.0 (API level 21). By usingsyscall
directly,accept4
will also work on older Android versions.The kernel itself has supported it since Linux 2.6.28, which was shipped with stock Android since version 1.6 already: https://en.wikipedia.org/wiki/Android_version_history#Android_1.6_Donut_(API_4)
At the moment, the CI for the rust repo still uses API level 14. Although I also opened a PR to bump that too: rust-lang/rust#78601. However, it might make sense to keep the old API level in CI if this is merged.