#![doc = include_str!("../README.md")]
#![no_std]
#![no_builtins] #![feature(thread_local)] #![feature(c_variadic)] #![feature(rustc_private)] #![feature(strict_provenance)]
#![feature(inline_const)]
#![feature(sync_unsafe_cell)]
#![deny(fuzzy_provenance_casts)]
#![deny(lossy_provenance_casts)]
#![feature(try_blocks)]
#[cfg(all(feature = "coexist-with-libc", feature = "take-charge"))]
compile_error!("Enable only one of \"coexist-with-libc\" and \"take-charge\".");
#[cfg(all(not(feature = "coexist-with-libc"), not(feature = "take-charge")))]
compile_error!("Enable one \"coexist-with-libc\" and \"take-charge\".");
extern crate alloc;
extern crate compiler_builtins;
pub use libc::*;
#[macro_use]
mod use_libc;
#[cfg(not(target_os = "wasi"))]
mod at_fork;
mod error_str;
mod sync_ptr;
use errno::{set_errno, Errno};
mod ctype;
mod env;
mod fs;
mod io;
#[cfg(feature = "take-charge")]
mod malloc;
mod math;
mod mem;
#[cfg(not(target_os = "wasi"))]
mod mmap;
mod net;
#[cfg(not(target_os = "wasi"))]
mod process;
mod rand;
mod rand48;
#[cfg(not(target_os = "wasi"))]
#[cfg(feature = "take-charge")]
mod signal;
mod termios_;
#[cfg(feature = "thread")]
#[cfg(feature = "take-charge")]
mod threads;
mod errno_;
mod exec;
mod exit;
mod glibc_versioning;
mod nss;
mod posix_spawn;
mod process_;
mod rand_;
mod setjmp;
mod syscall;
mod time;
#[cfg(feature = "take-charge")]
#[no_mangle]
static __dso_handle: UnsafeSendSyncVoidStar =
UnsafeSendSyncVoidStar(&__dso_handle as *const _ as *const _);
#[repr(transparent)]
#[cfg(feature = "take-charge")]
struct UnsafeSendSyncVoidStar(*const core::ffi::c_void);
#[cfg(feature = "take-charge")]
unsafe impl Send for UnsafeSendSyncVoidStar {}
#[cfg(feature = "take-charge")]
unsafe impl Sync for UnsafeSendSyncVoidStar {}
#[cfg(feature = "take-charge")]
#[cfg(feature = "call-main")]
#[no_mangle]
fn origin_main(argc: usize, argv: *mut *mut u8, envp: *mut *mut u8) -> i32 {
extern "C" {
fn main(argc: i32, argv: *const *const u8, envp: *const *const u8) -> i32;
}
unsafe { main(argc as _, argv as _, envp as _) }
}
fn convert_res<T>(result: Result<T, rustix::io::Errno>) -> Option<T> {
result
.map_err(|err| set_errno(Errno(err.raw_os_error())))
.ok()
}