1// libc port for HermitCore (https://hermitcore.org) 2// 3// Ported by Colin Fink <colin.finck@rwth-aachen.de> 4// and Stefan Lankes <slankes@eonerc.rwth-aachen.de> 5 6pub type c_schar = i8; 7pub type c_uchar = u8; 8pub type c_short = i16; 9pub type c_ushort = u16; 10pub type c_int = i32; 11pub type c_uint = u32; 12pub type c_float = f32; 13pub type c_double = f64; 14pub type c_longlong = i64; 15pub type c_ulonglong = u64; 16pub type intmax_t = i64; 17pub type uintmax_t = u64; 18 19pub type size_t = usize; 20pub type ptrdiff_t = isize; 21pub type intptr_t = isize; 22pub type uintptr_t = usize; 23pub type ssize_t = isize; 24 25pub type c_long = i64; 26pub type c_ulong = u64; 27 28pub type wint_t = u32; 29pub type wctype_t = i64; 30 31pub type regoff_t = size_t; 32pub type off_t = c_long; 33 34cfg_if! { 35 if #[cfg(target_arch = "aarch64")] { 36 mod aarch64; 37 pub use self::aarch64::*; 38 } else if #[cfg(target_arch = "x86_64")] { 39 mod x86_64; 40 pub use self::x86_64::*; 41 } else { 42 // Unknown target_arch 43 } 44} 45 46cfg_if! { 47 if #[cfg(libc_core_cvoid)] { 48 pub use ::ffi::c_void; 49 } else { 50 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 51 // enable more optimization opportunities around it recognizing things 52 // like malloc/free. 53 #[repr(u8)] 54 #[allow(missing_copy_implementations)] 55 #[allow(missing_debug_implementations)] 56 pub enum c_void { 57 // Two dummy variants so the #[repr] attribute can be used. 58 #[doc(hidden)] 59 __variant1, 60 #[doc(hidden)] 61 __variant2, 62 } 63 } 64} 65