-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add prctl constants on android #4531
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
base: main
Are you sure you want to change the base?
Conversation
Some changes occurred in the Android module cc @maurer |
I am not sure if those FreeBSD failures have anything to do with my change. The errors appear to be about a missing symbol that only appears in the FreeBSD path. |
src/unix/linux_like/android/mod.rs
Outdated
#[cfg_attr(termux, link(name = "android-posix-semaphore"))] | ||
extern "C" {} |
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.
What is this added for?
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.
On Android's bionic, there are some libc functions which are not supported, like sem_open
, sem_close
, and sem_unlink
, which causes link failures when compiling anything with libc as a dependency.
On the Android terminal app Termux, there is a substitute port available as a separate library, which must be linked in explicitly.
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 think this is outside of the scope of libc
. We are trying to reduce the number of libraries that get implicitly linked, and a third party library that isn't libc
doesn't seem to make the cutoff.
Are the sem_*
functions you mentioned not available via bionic in some cases?
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.
Fair enough. At the end of the day, it's easy enough to work around in downstream projects by linking in this third party lib via rustflags, etc. I've removed this.
The sem_*
functions are not available at all. Or rather, they are "there", but are simply stubbed out, so anything that tries to use them just fails.
In the case of termux, for example, this would render python script that used multiprocessing
broken.
bionic simply doesn't implement all of libc, so there are a few shims that are needed to supplement what's missing.
libc-test/build.rs
Outdated
| "toupper" | "getpwuid_r" | "tmpfile" | "getpwnam" | "getpwuid" | "tcdrain" | ||
| "cfgetispeed" | "cfgetospeed" | "cfsetispeed" | "cfsetospeed" | "tcgetattr" | ||
| "tcsetattr" | "tcflow" | "tcflush" | "tcgetsid" | "tcsendbreak" | "cfmakeraw" | ||
| "cfsetspeed" => true, |
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.
These don't seem relevant to the change here
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.
It's not strictly related, but tests for all these functions fail currently.
I split it out into another commit to make that clearer
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.
What circumstances make these fail? We have Android tests in CI and as far as I know this hasn't been a problem
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'm not sure, to be honest; I didn't spend the time to dig into the failures. It could be something specific to termux.
I went ahead and removed these changes.
Add all constants from bionic's `prctl.h` header https://android.googlesource.com/platform/bionic/+/7ac54f5c391bf3aeb9fec84a158939421fd8f505/libc/kernel/uapi/linux/prctl.h
f5e4401
to
5905f0a
Compare
Description
Add all constants from bionic's
prctl.h
headerSources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI
@rustbot label +stable-nominated