-
Notifications
You must be signed in to change notification settings - Fork 19
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
Provide a custom getrandom (crate) implementation #43
Comments
We could make a module for third-party crate implementations, that looks to be a common thing we’ll have to do. Still, I bet that after getting an STD PR merged other crate distributors will be ok with the further support. |
BTW one reason we'd want this is to inspect running programs using tokio-console: |
Functions can only be registered in the root binary crate. Attempting to register a function in a non-root crate will result in a linker error. This is similar to From getrandom's docs. Makes sense honestly. It looks like they are keen on supporting new targets though. We should PR once the |
We could technically make a PR beforehand since it's a no_std crate and just uses libc. But std is more of a priority. |
@Meziu I'm working on a getrandom PR btw. It should be quick, and it unblocks using some third party crates. |
Opened rust-random/getrandom#248 I realized we need to make another PR to libc before it can get merged, since upstream libc doesn't have |
Cool! Hope it goes well. I am still wondering about making having the |
I'm not sure if atexit is implemented, but that might work. |
It is! I remember some example using it to close the |
This got merged and is now released in getrandom 0.2.6! |
The getrandom crate fails to compile for unsupported systems (they don't blanket support
unix
-like systems), but it has a mechanism we can use to register a custom backing implementation:https://docs.rs/getrandom/latest/getrandom/#unsupported-targets
https://docs.rs/getrandom/latest/getrandom/macro.register_custom_getrandom.html
We could implement this in ctru-rs and users would be able to use getrandom without issues.
Alternatively (and maybe in parallel), we could make a PR to getrandom to add support. We'd have to make sure to only depend on
libc::get_random
and not libctru.The text was updated successfully, but these errors were encountered: