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

Implement accept4 on Android as raw syscall. #1968

Merged
merged 1 commit into from
Nov 3, 2020

Conversation

de-vri-es
Copy link
Contributor

@de-vri-es de-vri-es commented Oct 31, 2020

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.

@rust-highfive
Copy link

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.

Copy link
Member

@JohnTitor JohnTitor left a 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!

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 2, 2020

📌 Commit 5bcac36 has been approved by JohnTitor

@bors
Copy link
Contributor

bors commented Nov 2, 2020

⌛ Testing commit 5bcac36 with merge 1cb2bc9...

bors added a commit that referenced this pull request Nov 2, 2020
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.
@bors
Copy link
Contributor

bors commented Nov 2, 2020

💔 Test failed - checks-actions

@de-vri-es
Copy link
Contributor Author

de-vri-es commented Nov 2, 2020

Applied the suggestion :)

Also had to remove the trailing comma from the argument list.

Should I squash the commits?

@JohnTitor
Copy link
Member

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.
@de-vri-es
Copy link
Contributor Author

Squashed :)

@bors r=JohnTitor

@bors
Copy link
Contributor

bors commented Nov 3, 2020

@de-vri-es: 🔑 Insufficient privileges: Not in reviewers

@de-vri-es
Copy link
Contributor Author

Awh, bors didn't like that :(

@JohnTitor
Copy link
Member

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Nov 3, 2020

📌 Commit 36affa2 has been approved by JohnTitor

@bors
Copy link
Contributor

bors commented Nov 3, 2020

⌛ Testing commit 36affa2 with merge ae65df5...

@bors
Copy link
Contributor

bors commented Nov 3, 2020

☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13
Approved by: JohnTitor
Pushing ae65df5 to master...

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

Successfully merging this pull request may close these issues.

5 participants