From ea27effdb3d95907c3d8d34e4442b9cdf2ced20c Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Fri, 29 Mar 2019 10:20:08 -0700 Subject: [PATCH] keeep top level wasi calls that call out to platform-specific impls --- lib/wasi/src/syscalls/mod.rs | 17 +++++++++++++++++ lib/wasi/src/syscalls/unix/linux.rs | 4 ++-- lib/wasi/src/syscalls/unix/macos.rs | 4 ++-- lib/wasi/src/syscalls/windows.rs | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/wasi/src/syscalls/mod.rs b/lib/wasi/src/syscalls/mod.rs index 077a61155..380adc68b 100644 --- a/lib/wasi/src/syscalls/mod.rs +++ b/lib/wasi/src/syscalls/mod.rs @@ -72,6 +72,23 @@ pub fn args_sizes_get(ctx: &mut Ctx, argc_out: u32, argv_buf_size_out: u32) { memory.view::()[(argv_buf_size_out / 4) as usize].set(total_arg_size as u32); } +pub fn clock_res_get( + ctx: &mut Ctx, + clock_id: __wasi_clockid_t, + resolution: WasmPtr<__wasi_timestamp_t>, +) -> __wasi_errno_t { + platform_clock_res_get(ctx, clock_id, resolution) +} + +pub fn clock_time_get( + ctx: &mut Ctx, + clock_id: __wasi_clockid_t, + precision: __wasi_timestamp_t, + time: WasmPtr<__wasi_timestamp_t>, +) -> __wasi_errno_t { + platform_clock_time_get(ctx, clock_id, precision, time) +} + /// ### `environ_get()` /// Read environment variable data. /// The sizes of the buffers should match that returned by [`environ_sizes_get()`](#environ_sizes_get). diff --git a/lib/wasi/src/syscalls/unix/linux.rs b/lib/wasi/src/syscalls/unix/linux.rs index c3556faba..43ca2cb6d 100644 --- a/lib/wasi/src/syscalls/unix/linux.rs +++ b/lib/wasi/src/syscalls/unix/linux.rs @@ -1,7 +1,7 @@ use crate::syscalls::types::*; use wasmer_runtime_core::{memory::Memory, vm::Ctx}; -pub fn clock_res_get( +pub fn platform_clock_res_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, resolution: WasmPtr<__wasi_timestamp_t>, @@ -9,7 +9,7 @@ pub fn clock_res_get( __WASI_EINVAL } -pub fn clock_time_get( +pub fn platform_clock_time_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, precision: __wasi_timestamp_t, diff --git a/lib/wasi/src/syscalls/unix/macos.rs b/lib/wasi/src/syscalls/unix/macos.rs index c3556faba..43ca2cb6d 100644 --- a/lib/wasi/src/syscalls/unix/macos.rs +++ b/lib/wasi/src/syscalls/unix/macos.rs @@ -1,7 +1,7 @@ use crate::syscalls::types::*; use wasmer_runtime_core::{memory::Memory, vm::Ctx}; -pub fn clock_res_get( +pub fn platform_clock_res_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, resolution: WasmPtr<__wasi_timestamp_t>, @@ -9,7 +9,7 @@ pub fn clock_res_get( __WASI_EINVAL } -pub fn clock_time_get( +pub fn platform_clock_time_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, precision: __wasi_timestamp_t, diff --git a/lib/wasi/src/syscalls/windows.rs b/lib/wasi/src/syscalls/windows.rs index c3556faba..43ca2cb6d 100644 --- a/lib/wasi/src/syscalls/windows.rs +++ b/lib/wasi/src/syscalls/windows.rs @@ -1,7 +1,7 @@ use crate::syscalls::types::*; use wasmer_runtime_core::{memory::Memory, vm::Ctx}; -pub fn clock_res_get( +pub fn platform_clock_res_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, resolution: WasmPtr<__wasi_timestamp_t>, @@ -9,7 +9,7 @@ pub fn clock_res_get( __WASI_EINVAL } -pub fn clock_time_get( +pub fn platform_clock_time_get( ctx: &mut Ctx, clock_id: __wasi_clockid_t, precision: __wasi_timestamp_t,