mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 14:41:32 +00:00
fix lstat64; increase num returned by heap size
This commit is contained in:
@ -20,7 +20,7 @@ pub fn _emscripten_memcpy_big(ctx: &mut Ctx, dest: u32, src: u32, len: u32) -> u
|
|||||||
pub fn _emscripten_get_heap_size(_ctx: &mut Ctx) -> u32 {
|
pub fn _emscripten_get_heap_size(_ctx: &mut Ctx) -> u32 {
|
||||||
debug!("emscripten::_emscripten_get_heap_size",);
|
debug!("emscripten::_emscripten_get_heap_size",);
|
||||||
// TODO: Fix implementation
|
// TODO: Fix implementation
|
||||||
162_107_392
|
162_107_392 * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
/// emscripten: _emscripten_resize_heap
|
/// emscripten: _emscripten_resize_heap
|
||||||
|
@ -418,6 +418,24 @@ pub fn ___syscall197(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// lstat64
|
||||||
|
pub fn ___syscall196(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
|
||||||
|
debug!("emscripten::___syscall196 (lstat64) {}", _which);
|
||||||
|
let path_ptr: c_int = varargs.get(ctx);
|
||||||
|
let buf_ptr: u32 = varargs.get(ctx);
|
||||||
|
let path = emscripten_memory_pointer!(ctx.memory(0), path_ptr) as *const i8;
|
||||||
|
unsafe {
|
||||||
|
let mut stat: stat = std::mem::zeroed();
|
||||||
|
let ret = lstat64(path, &mut stat as *mut stat as *mut c_void);
|
||||||
|
debug!("ret: {}", ret);
|
||||||
|
if ret != 0 {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
copy_stat_into_wasm(ctx, buf_ptr, &stat);
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
pub fn ___syscall220(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
|
pub fn ___syscall220(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
|
||||||
debug!("emscripten::___syscall220");
|
debug!("emscripten::___syscall220");
|
||||||
-1
|
-1
|
||||||
|
@ -759,25 +759,6 @@ pub fn ___syscall122(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
|
|||||||
unsafe { uname(buf_addr) }
|
unsafe { uname(buf_addr) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// lstat64
|
|
||||||
pub fn ___syscall196(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
|
|
||||||
debug!("emscripten::___syscall196 (lstat64) {}", _which);
|
|
||||||
let path_ptr: c_int = varargs.get(ctx);
|
|
||||||
let buf_ptr: c_int = varargs.get(ctx);
|
|
||||||
let path = emscripten_memory_pointer!(ctx.memory(0), path_ptr) as *const c_char;
|
|
||||||
let buf = emscripten_memory_pointer!(ctx.memory(0), buf_ptr) as *mut c_void;
|
|
||||||
let result = unsafe { lstat64(path, buf as _) };
|
|
||||||
debug!(
|
|
||||||
"=> path: {}, buf: {} = fd: {}\npath: {}\nlast os error: {}",
|
|
||||||
path_ptr,
|
|
||||||
buf_ptr,
|
|
||||||
result,
|
|
||||||
unsafe { std::ffi::CStr::from_ptr(path).to_str().unwrap() },
|
|
||||||
Error::last_os_error(),
|
|
||||||
);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
/// fallocate
|
/// fallocate
|
||||||
pub fn ___syscall324(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
pub fn ___syscall324(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||||
debug!("emscripten::___syscall324 (fallocate) {}", _which);
|
debug!("emscripten::___syscall324 (fallocate) {}", _which);
|
||||||
|
Reference in New Issue
Block a user