mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 14:41:32 +00:00
clean up platform-specific syscall code
This commit is contained in:
@ -489,13 +489,12 @@ pub fn fd_pread(
|
||||
debug!("wasi::fd_pread");
|
||||
let memory = ctx.memory(0);
|
||||
|
||||
if let ((Ok(iov_cells), Ok(nread_cell))) =
|
||||
(iovs.deref(memory, 0, iovs_len), nread.deref(memory))
|
||||
{
|
||||
platform_fd_pread(fd, iov_cells, iovs_len, offset, nread_cell)
|
||||
} else {
|
||||
__WASI_EFAULT
|
||||
}
|
||||
let iov_cells = wasi_try!(iovs.deref(memory, 0, iovs_len));
|
||||
let nread_cell = wasi_try!(nread.deref(memory));
|
||||
|
||||
unimplemented!();
|
||||
|
||||
__WASI_ESUCCESS
|
||||
}
|
||||
|
||||
/// ### `fd_prestat_get()`
|
||||
|
@ -1,36 +0,0 @@
|
||||
use crate::syscalls::types::*;
|
||||
use std::cell::Cell;
|
||||
use std::mem;
|
||||
|
||||
use libc::preadv;
|
||||
|
||||
pub fn platform_fd_pread(
|
||||
fd: __wasi_fd_t,
|
||||
iovs: &[Cell<__wasi_iovec_t>],
|
||||
iovs_len: u32,
|
||||
offset: __wasi_filesize_t,
|
||||
nread: &Cell<u32>,
|
||||
) -> __wasi_errno_t {
|
||||
let (result, iovec) = unsafe {
|
||||
let mut iovec = vec![mem::uninitialized(); iovs_len as usize];
|
||||
(
|
||||
preadv(
|
||||
fd as i32,
|
||||
iovec.as_mut_ptr(),
|
||||
iovs_len as i32,
|
||||
offset as i64,
|
||||
),
|
||||
iovec,
|
||||
)
|
||||
};
|
||||
nread.set(result as u32);
|
||||
/*for (i, arr_cell) in iovs.iter().enumerate() {
|
||||
let wasi_iovec = __wasi_iovec_t {
|
||||
buf: iovec[i] as _,
|
||||
buf_len: iovec[i].iov_len as u32,
|
||||
};
|
||||
arr_cell.set(wasi_iovec);
|
||||
}*/
|
||||
|
||||
__WASI_ESUCCESS
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
use crate::syscalls::types::*;
|
||||
use std::cell::Cell;
|
||||
|
||||
pub fn platform_fd_pread(
|
||||
fd: __wasi_fd_t,
|
||||
iovs: &[Cell<__wasi_iovec_t>],
|
||||
iovs_len: u32,
|
||||
offset: __wasi_filesize_t,
|
||||
nread: &Cell<u32>,
|
||||
) -> __wasi_errno_t {
|
||||
unimplemented!()
|
||||
}
|
@ -1,15 +1,3 @@
|
||||
#[cfg(target_os = "linux")]
|
||||
pub mod linux;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod macos;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub use linux::*;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use macos::*;
|
||||
|
||||
use crate::syscalls::types::*;
|
||||
use libc::{
|
||||
clock_getres, clock_gettime, timespec, CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID,
|
||||
|
@ -15,13 +15,3 @@ pub fn platform_clock_time_get(
|
||||
) -> __wasi_errno_t {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn platform_fd_pread(
|
||||
fd: __wasi_fd_t,
|
||||
iovs: &[Cell<__wasi_iovec_t>],
|
||||
iovs_len: u32,
|
||||
offset: __wasi_filesize_t,
|
||||
nread: &Cell<u32>,
|
||||
) -> __wasi_errno_t {
|
||||
unimplemented!()
|
||||
}
|
||||
|
Reference in New Issue
Block a user