interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / trusty.rs

73 lines · 2023 bytes Raw Blame History
1use crate::prelude::*;
2pub type size_t = usize;
3pub type ssize_t = isize;
4
5pub type off_t = i64;
6
7pub type c_uint8_t = u8;
8pub type c_uint16_t = u16;
9pub type c_uint32_t = u32;
10pub type c_uint64_t = u64;
11
12pub type c_int8_t = i8;
13pub type c_int16_t = i16;
14pub type c_int32_t = i32;
15pub type c_int64_t = i64;
16
17pub type intptr_t = isize;
18pub type uintptr_t = usize;
19
20pub type time_t = c_long;
21
22pub type clockid_t = c_int;
23
24s! {
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
37pub const PROT_READ: i32 = 1;
38pub const PROT_WRITE: i32 = 2;
39
40// Trusty only supports `CLOCK_BOOTTIME`.
41pub const CLOCK_BOOTTIME: clockid_t = 7;
42
43pub const STDOUT_FILENO: c_int = 1;
44pub const STDERR_FILENO: c_int = 2;
45
46pub const AT_PAGESZ: c_ulong = 6;
47
48pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
49
50extern "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}