2 #![allow(missing_docs, nonstandard_style)]
3 #![deny(unsafe_op_in_unsafe_fn)]
17 use super::unsupported;
22 #[path = "../unsupported/args.rs"]
24 #[path = "../unix/cmath.rs"]
27 // `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
28 // `crate::sys::error`
34 #[path = "../unix/os_str.rs"]
37 #[path = "../unsupported/pipe.rs"]
39 #[path = "../unsupported/process.rs"]
42 pub use self::itron::thread;
44 pub mod thread_local_dtor;
45 pub mod thread_local_key;
47 pub use self::itron::wait_flag;
52 pub use super::itron::condvar::*;
53 pub use super::itron::mutex::*;
54 pub use super::rwlock::*;
57 // SAFETY: must be called only once during runtime initialization.
58 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
59 pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
61 // SAFETY: must be called only once during runtime cleanup.
62 pub unsafe fn cleanup() {}
64 pub fn unsupported<T>() -> crate::io::Result<T> {
65 Err(unsupported_err())
68 pub fn unsupported_err() -> crate::io::Error {
69 crate::io::const_io_error!(
70 crate::io::ErrorKind::Unsupported,
71 "operation not supported on this platform",
75 pub fn decode_error_kind(code: i32) -> crate::io::ErrorKind {
76 error::decode_error_kind(code)
80 pub fn abort_internal() -> ! {
81 unsafe { libc::abort() }
84 pub fn hashmap_random_keys() -> (u64, u64) {
86 let mut out = crate::mem::MaybeUninit::<[u64; 2]>::uninit();
87 let result = abi::SOLID_RNG_SampleRandomBytes(out.as_mut_ptr() as *mut u8, 16);
88 assert_eq!(result, 0, "SOLID_RNG_SampleRandomBytes failed: {result}");
89 let [x1, x2] = out.assume_init();