mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
add some syscall skeletons; context switching
This commit is contained in:
parent
42e8523c0b
commit
5cee576b7b
@ -240,16 +240,39 @@ pub fn fd_prestat_get(
|
||||
fd: __wasi_fd_t,
|
||||
buf: WasmPtr<__wasi_prestat_t>,
|
||||
) -> __wasi_errno_t {
|
||||
unimplemented!()
|
||||
let memory = ctx.memory(0);
|
||||
|
||||
if let Some(prestat_ptr) = buf.deref(memory) {
|
||||
// open fd
|
||||
// write info to prestat_ptr
|
||||
__WASI_ESUCCESS
|
||||
} else {
|
||||
__WASI_EFAULT
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fd_prestat_dir_name(
|
||||
ctx: &mut Ctx,
|
||||
fd: __wasi_fd_t,
|
||||
path: WasmPtr<u8, Array>,
|
||||
path_len: u32,
|
||||
) -> __wasi_errno_t {
|
||||
unimplemented!()
|
||||
let memory = ctx.memory(0);
|
||||
|
||||
if let Some(path_chars) = path.deref(memory, 0, path_len) {
|
||||
if true /* check if dir */ {
|
||||
// get name
|
||||
// write name
|
||||
// if overflow __WASI_EOVERFLOW
|
||||
__WASI_ESUCCESS
|
||||
} else {
|
||||
__WASI_ENOTDIR
|
||||
}
|
||||
} else {
|
||||
__WASI_EFAULT
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fd_pwrite(
|
||||
ctx: &mut Ctx,
|
||||
fd: __wasi_fd_t,
|
||||
|
Loading…
Reference in New Issue
Block a user