Repository navigation
Rustix for android, part deux - #1577
gurchetansingh wants to merge 4 commits into
Conversation
gurchetansingh
commented
Feb 2, 2026
e97ec4e to
f5b00ae
Compare
|
Also, getting a new release for this would be most terrific for downstream integrators. |
|
|
||
| /// Convenience macro for Rustix's ioctl read | ||
| #[macro_export] | ||
| macro_rules! ioctl_readwrite { |
There was a problem hiding this comment.
These seem like weird inclusions for the public API.
There was a problem hiding this comment.
so nix has them too:
https://github.com/nix-rust/nix/blob/master/src/sys/ioctl/mod.rs#L652
I know of two places that are duplicating this logic:
https://github.com/Smithay/drm-rs/blob/develop/drm-ffi/src/ioctl.rs#L6
https://github.com/magma-gpu/rutabaga_gfx/blob/main/third_party/mesa3d/src/magma/sys/linux/amdgpu.rs#L43 (the project I work on)
Anything particularly wrong with these APIs? Otherwise, people have to excessively define things like ioctl::Updater and ioctl::opcode::read_write.
There was a problem hiding this comment.
Could you write down what these new macros do that can't be done with rustix's existing ioctl API?
We would like to land: #36 But that'll break Android until the following rustix change lands: bytecodealliance/rustix#1577 and it can take a few months to get something through rustix due to limited maintainer bandwidth. Stopgap solution: cut releases and branches for libkrun until Rustix change is merged. Unlike the "chromeos" branch, the libkrun branch will eventually be merged with main.
We would like to land: #36 But that'll break Android until the following rustix change lands: bytecodealliance/rustix#1577 and it can take a few months to get something through rustix due to limited maintainer bandwidth. Stopgap solution: cut releases and branches for libkrun until Rustix change is merged. Unlike the "chromeos" branch, the libkrun branch will eventually be merged with main.
|
gentle ping. Perhaps added more reviewers/maintainers could help with the backlog? |
|
|
||
| /// Convenience macro for Rustix's ioctl read | ||
| #[macro_export] | ||
| macro_rules! ioctl_readwrite { |
f5b00ae to
3ec91c2
Compare
|
@sunfishcode ping |
3ec91c2 to
31c894e
Compare
|
CI/CD failures look related to #1606, it passed last time I tried. |
This contains downstream patches for Rustix, from: bytecodealliance/rustix#1577 I think the people are cool with the changes generally, but we're essentially running into https://xkcd.com/2347/ right now. The cost of local patches in Rustix now is lower than forking mesa3d_util and friends indefinitely.
31c894e to
5fa428d
Compare
This contains downstream patches for Rustix, from: bytecodealliance/rustix#1577 I think the people are cool with the changes generally, but we're essentially running into https://xkcd.com/2347/ right now. The cost of local patches in Rustix now is lower than forking mesa3d_util and friends indefinitely.
This contains downstream patches for Rustix, from: bytecodealliance/rustix#1577 I think the people are cool with the changes generally, but we're essentially running into https://xkcd.com/2347/ right now and the maintainer doesn't have time to even look at it. To ease in the development of mesa3d_util, it's better to keep 3 downstream patches here, than potentially diverging mesa3d_util for actual consumers. Reviewed-by: LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41321>
This contains downstream patches for Rustix, from: bytecodealliance/rustix#1577 I think the people are cool with the changes generally, but we're essentially running into https://xkcd.com/2347/ right now and the maintainer doesn't have time to even look at it. To ease in the development of mesa3d_util, it's better to keep 3 downstream patches here, than potentially diverging mesa3d_util for actual consumers. Reviewed-by: LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41321>
This comment was marked as resolved.
This comment was marked as resolved.
5fa428d to
d37956f
Compare
Rebased! Good to see the project is accepting patches again. PTAL! |
sunfishcode
left a comment
There was a problem hiding this comment.
The meson build seems to require embedding a lot of version strings, hash codes, and build metadata in the rustix repository which will be a chore to maintain.
If the goal is to test rustix with the set of cfgs that Android developers would use, would that be possible to acheve using cargo? Even if cargo isn't how Android developers themselves would actually use it, could we test the needed cfgs that way?
|
|
||
| /// Convenience macro for Rustix's ioctl read | ||
| #[macro_export] | ||
| macro_rules! ioctl_readwrite { |
There was a problem hiding this comment.
Could you write down what these new macros do that can't be done with rustix's existing ioctl API?
These ioctl wrappers are used by rustix users. For example: https://github.com/Smithay/drm-rs/blob/develop/drm-ffi/src/ioctl.rs#L6 Roughly, they match the ones provided by nix. I'm upstreaming the portion I have personally tested.
Android likes to build host tools (adb, Cuttlefish, ..) via musl, using the same hermetic tree as for Bionic build. And linux-raw-sys isn't in that hermetic tree, so add support for the libc-backend.
It's desirable to enable futex for some cases that will be run on Android. The strategy is just to define the constants needed by the libc ourselves, if libc doesn't provide the necessary constant. Long-term, that could make the libc backend only depend on libc.
Android platform developers (AOSP) and external build systems like Meson build rustix with the libc backend and without linux-raw-sys (--cfg=rustix_no_linux_raw): bytecodealliance#1095 bytecodealliance#1478 rust-vsock/vsock-rs#60 Meanwhile, Android app developers using Cargo may want linux-raw-sys enabled by default: bytecodealliance#1528 Gate the linux-raw-sys target dependencies in Cargo.toml on not(rustix_no_linux_raw), ensure --cfg=rustix_no_linux_raw implies the libc backend in build.rs, and test both configurations (with and without rustix_no_linux_raw) on Android and musl targets in CI. To locally test the no-linux-raw-sys path on Android: rustup target add aarch64-linux-android RUSTFLAGS="--cfg rustix_no_linux_raw" cargo check \ --target=aarch64-linux-android \ -F use-libc,net,std,alloc,event,fs,mm,param,pipe,thread \ -F use-libc-auxv,libc_errno \ --all-targets And to verify linux-raw-sys is excluded from the dependency graph: RUSTFLAGS="--cfg rustix_no_linux_raw" cargo tree --edges normal \ --target=aarch64-linux-android \ -F use-libc,net,std,alloc,event,fs,mm,param,pipe,thread \ -F use-libc-auxv,libc_errno
d37956f to
34e00d3
Compare
It's important to make the distinction between:
My original CL fixed the issue for Android platform developers: But Android app developers undid that change: I didn't think it was possible for cargo to test two Android configurations (one with
While they expand to rustix’s existing API, these macros solve three issues:
|