
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
36 lines
975 B
Rust
36 lines
975 B
Rust
use crate::io as std_io;
|
|
|
|
pub mod memchr {
|
|
pub use core::slice::memchr::{memchr, memrchr};
|
|
}
|
|
|
|
// SAFETY: must be called only once during runtime initialization.
|
|
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
|
|
pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
|
|
|
|
// SAFETY: must be called only once during runtime cleanup.
|
|
// NOTE: this is not guaranteed to run, for example when the program aborts.
|
|
pub unsafe fn cleanup() {}
|
|
|
|
pub fn unsupported<T>() -> std_io::Result<T> {
|
|
Err(unsupported_err())
|
|
}
|
|
|
|
pub fn unsupported_err() -> std_io::Error {
|
|
std_io::const_io_error!(
|
|
std_io::ErrorKind::Unsupported,
|
|
"operation not supported on this platform",
|
|
)
|
|
}
|
|
|
|
pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
|
|
crate::io::ErrorKind::Uncategorized
|
|
}
|
|
|
|
pub fn abort_internal() -> ! {
|
|
core::intrinsics::abort();
|
|
}
|
|
|
|
pub fn hashmap_random_keys() -> (u64, u64) {
|
|
(1, 2)
|
|
}
|