Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/libc/src/trusty.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / libc / src / trusty.rs` 73 lines ยท 2023 bytes Raw Blame History 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 #[derive(Default)] 31 pub struct timespec { 32 pub tv_sec: time_t, 33 pub tv_nsec: c_long, 34 } 35 } 36 37 pub const PROT_READ: i32 = 1; 38 pub const PROT_WRITE: i32 = 2; 39 40 // Trusty only supports `CLOCK_BOOTTIME`. 41 pub const CLOCK_BOOTTIME: clockid_t = 7; 42 43 pub const STDOUT_FILENO: c_int = 1; 44 pub const STDERR_FILENO: c_int = 2; 45 46 pub const AT_PAGESZ: c_ulong = 6; 47 48 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; 49 50 extern "C" { 51 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; 52 pub fn malloc(size: size_t) -> *mut c_void; 53 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; 54 pub fn free(p: *mut c_void); 55 pub fn memalign(align: size_t, size: size_t) -> *mut c_void; 56 pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int; 57 pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; 58 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; 59 pub fn close(fd: c_int) -> c_int; 60 pub fn strlen(cs: *const c_char) -> size_t; 61 pub fn getauxval(type_: c_ulong) -> c_ulong; 62 pub fn mmap( 63 addr: *mut c_void, 64 len: size_t, 65 prot: c_int, 66 flags: c_int, 67 fd: c_int, 68 offset: off_t, 69 ) -> *mut c_void; 70 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int; 71 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; 72 pub fn nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int; 73 }