Browse Source

Document init function and add psInit to getrandom

pull/16/head
Andrea Ciliberti 2 years ago
parent
commit
a3aa4423e7
  1. 6
      src/lib.rs

6
src/lib.rs

@ -1,9 +1,6 @@
#![no_std] #![no_std]
/// Call this somewhere to force Rust to link this module. /// Reference this function somewhere (eg. ´use linker_fix_3sd::init´ in the main crate) to import all missing implementations.
/// The call doesn't need to execute, just exist.
///
/// See <https://github.com/rust-lang/rust/issues/47384>
pub fn init() {} pub fn init() {}
extern "C" { extern "C" {
@ -54,6 +51,7 @@ pub unsafe extern "C" fn getrandom(
}; };
buflen = buflen.min(maxlen); buflen = buflen.min(maxlen);
ctru_sys::psInit();
let ret = ctru_sys::PS_GenerateRandomBytes(buf, buflen); let ret = ctru_sys::PS_GenerateRandomBytes(buf, buflen);
// avoid conflicting a real POSIX errno by using a value < 0 // avoid conflicting a real POSIX errno by using a value < 0

Loading…
Cancel
Save