1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
macro_rules! hostcalls {
($(pub unsafe fn $name:ident($($arg:ident: $ty:ty,)*) -> $ret:ty;)*) => ($(
#[wasi_common_cbindgen::wasi_common_cbindgen]
pub unsafe fn $name($($arg: $ty,)*) -> $ret {
let ret = crate::hostcalls_impl::$name($($arg,)*)
.err()
.unwrap_or(crate::Error::ESUCCESS)
.as_wasi_error();
log::trace!(" | errno={}", ret);
ret.as_raw_errno()
}
)*)
}
macro_rules! hostcalls_old {
($(pub unsafe fn $name:ident($($arg:ident: $ty:ty,)*) -> $ret:ty;)*) => ($(
#[wasi_common_cbindgen::wasi_common_cbindgen_old]
pub unsafe fn $name($($arg: $ty,)*) -> $ret {
let ret = crate::old::snapshot_0::hostcalls_impl::$name($($arg,)*)
.err()
.unwrap_or(crate::old::snapshot_0::Error::ESUCCESS)
.as_wasi_error();
log::trace!(" | errno={}", ret);
ret.as_raw_errno()
}
)*)
}