nix-rust / nix

Rust friendly bindings to *nix APIs
MIT License
2.68k stars 668 forks source link

Add `getregs()`/`setregs()`/`getregset()`/`setregset()` for Linux/musl/aarch64 #2502

Closed orhun closed 2 months ago

orhun commented 2 months ago

What does this PR do

I needed this specific API for packaging my project for Alpine Linux distribution:

I added support for aarch64-unknown-linux-musl for getregs() function and it builds fine now, but I don't have a way to test it. Also, I'm not sure if this is the correct way to add support for this architecture - but should be fine!

Let me know what you think and I can try adding support for other functions (such as setregs()) as well.

BTW this is my first PR to the nix crate so please let me know if I'm doing something wrong :bear:

Checklist:

SteveLauC commented 2 months ago

but I don't have a way to test it.

Here is a test, maybe you can take a look and try enabling it for musl as well:)

orhun commented 2 months ago

I expanded the scope of this PR a bit and enable the tests. Thought I still wonder why Linux/musl/aarch64 wasn't enabled in the initial implementation in #2044

orhun commented 2 months ago

The tests seem to be passing 🤔

SteveLauC commented 2 months ago

Thought I still wonder why Linux/musl/aarch64 wasn't enabled in the initial implementation in https://github.com/nix-rust/nix/pull/2044

I think it is because the author's use case does not target aarch64-unknown-linux-musl.

I expanded the scope of this PR a bit and enable the tests.

Looks like setregs() is also added, let me edit the PR title (as it will be used as the commit message, we use squash merge).

orhun commented 2 months ago

Awesome, thanks for the merge!

When should we expect a new release? 😇

SteveLauC commented 2 months ago

When should we expect a new release? 😇

Probably not soon, the I/O safety port is still not done, even though we finish it quickly, we still need to test it. Can you guys use a git dependency, though this would stop you from releasing to crates.io, I am not sure if this will block lurk from being included in Alpine Linux

orhun commented 2 months ago

Thanks for letting me know!

Can you guys use a git dependency, though this would stop you from releasing to crates.io,

Yeah, weekly alpha/rc releases would be really useful for these cases. Both for accessing the versions quickly and testing it :)

I am not sure if this will block lurk from being included in Alpine Linux

I'm not sure as well, just asked them 👀