1 use crate::prelude::*; 2 pub type size_t = usize; 3 pub type ssize_t = isize; 4 5 pub type off_t = i64; 6 7 pub type c_uint8_t = u8; 8 pub type c_uint16_t = u16; 9 pub type c_uint32_t = u32; 10 pub type c_uint64_t = u64; 11 12 pub type c_int8_t = i8; 13 pub type c_int16_t = i16; 14 pub type c_int32_t = i32; 15 pub type c_int64_t = i64; 16 17 pub type intptr_t = isize; 18 pub type uintptr_t = usize; 19 20 pub type time_t = c_long; 21 22 pub type clockid_t = c_int; 23 24 s! { 25 pub struct iovec { 26 pub iov_base: *mut c_void, 27 pub iov_len: size_t, 28 } 29 30 pub struct timespec { 31 pub tv_sec: time_t, 32 pub tv_nsec: c_long, 33 } 34 } 35 36 pub const PROT_READ: i32 = 1; 37 pub const PROT_WRITE: i32 = 2; 38 39 // Trusty only supports `CLOCK_BOOTTIME`. 40 pub const CLOCK_BOOTTIME: clockid_t = 7; 41 42 pub const STDOUT_FILENO: c_int = 1; 43 pub const STDERR_FILENO: c_int = 2; 44 45 pub const AT_PAGESZ: c_ulong = 6; 46 47 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; 48 49 extern "C" { calloc(nobj: size_t, size: size_t) -> *mut c_void50 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; malloc(size: size_t) -> *mut c_void51 pub fn malloc(size: size_t) -> *mut c_void; realloc(p: *mut c_void, size: size_t) -> *mut c_void52 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; free(p: *mut c_void)53 pub fn free(p: *mut c_void); memalign(align: size_t, size: size_t) -> *mut c_void54 pub fn memalign(align: size_t, size: size_t) -> *mut c_void; posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int55 pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int; write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t56 pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t57 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; close(fd: c_int) -> c_int58 pub fn close(fd: c_int) -> c_int; strlen(cs: *const c_char) -> size_t59 pub fn strlen(cs: *const c_char) -> size_t; getauxval(type_: c_ulong) -> c_ulong60 pub fn getauxval(type_: c_ulong) -> c_ulong; mmap( addr: *mut c_void, len: size_t, prot: c_int, flags: c_int, fd: c_int, offset: off_t, ) -> *mut c_void61 pub fn mmap( 62 addr: *mut c_void, 63 len: size_t, 64 prot: c_int, 65 flags: c_int, 66 fd: c_int, 67 offset: off_t, 68 ) -> *mut c_void; munmap(addr: *mut c_void, len: size_t) -> c_int69 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int; clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int70 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int71 pub fn nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int; 72 } 73