mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-19 20:01:20 +00:00
Improved ioctl calls
This commit is contained in:
@ -355,41 +355,46 @@ pub fn ___syscall54(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
|
||||
debug!("emscripten::___syscall54 (ioctl) {}", _which);
|
||||
let fd: i32 = varargs.get(ctx);
|
||||
let request: u32 = varargs.get(ctx);
|
||||
debug!("fd: {}, op: {}", fd, request);
|
||||
debug!("=> fd: {}, op: {}", fd, request);
|
||||
// Got the equivalents here: https://code.woboq.org/linux/linux/include/uapi/asm-generic/ioctls.h.html
|
||||
match request as _ {
|
||||
21537 => {
|
||||
// FIONBIO
|
||||
let argp: u32 = varargs.get(ctx);
|
||||
let argp_ptr = emscripten_memory_pointer!(ctx.memory(0), argp) as *mut c_void;
|
||||
let ret = unsafe { ioctl(fd, FIONBIO, argp_ptr) };
|
||||
debug!("ret(FIONBIO): {}", ret);
|
||||
ret
|
||||
// 0
|
||||
}
|
||||
21523 => {
|
||||
// TIOCGWINSZ
|
||||
let argp: u32 = varargs.get(ctx);
|
||||
let argp_ptr = emscripten_memory_pointer!(ctx.memory(0), argp) as *mut c_void;
|
||||
let ret = unsafe { ioctl(fd, TIOCGWINSZ, argp_ptr) };
|
||||
debug!("ret(TIOCGWINSZ): {} (harcoded to 0)", ret);
|
||||
// ret
|
||||
// TODO: We hardcode the value to have emscripten tests pass, as for some reason
|
||||
// when the capturer is active, ioctl returns -1 instead of 0
|
||||
if ret == -1 {
|
||||
0
|
||||
} else {
|
||||
ret
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
debug!(
|
||||
"emscripten::___syscall54 -> non implemented case {}",
|
||||
request
|
||||
);
|
||||
0
|
||||
}
|
||||
}
|
||||
let argp: u32 = varargs.get(ctx);
|
||||
let argp_ptr = emscripten_memory_pointer!(ctx.memory(0), argp) as *mut c_void;
|
||||
let ret = unsafe { ioctl(fd, request as _, argp_ptr) };
|
||||
debug!("=> {}", ret);
|
||||
ret
|
||||
// match request as _ {
|
||||
// 21537 => {
|
||||
// // FIONBIO
|
||||
// let argp: u32 = varargs.get(ctx);
|
||||
// let argp_ptr = emscripten_memory_pointer!(ctx.memory(0), argp) as *mut c_void;
|
||||
// let ret = unsafe { ioctl(fd, FIONBIO, argp_ptr) };
|
||||
// debug!("ret(FIONBIO): {}", ret);
|
||||
// ret
|
||||
// // 0
|
||||
// }
|
||||
// 21523 => {
|
||||
// // TIOCGWINSZ
|
||||
// let argp: u32 = varargs.get(ctx);
|
||||
// let argp_ptr = emscripten_memory_pointer!(ctx.memory(0), argp) as *mut c_void;
|
||||
// let ret = unsafe { ioctl(fd, TIOCGWINSZ, argp_ptr) };
|
||||
// debug!("ret(TIOCGWINSZ): {} (harcoded to 0)", ret);
|
||||
// // ret
|
||||
// // TODO: We hardcode the value to have emscripten tests pass, as for some reason
|
||||
// // when the capturer is active, ioctl returns -1 instead of 0
|
||||
// if ret == -1 {
|
||||
// 0
|
||||
// } else {
|
||||
// ret
|
||||
// }
|
||||
// }
|
||||
// _ => {
|
||||
// debug!(
|
||||
// "emscripten::___syscall54 -> non implemented case {}",
|
||||
// request
|
||||
// );
|
||||
// 0
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// socketcall
|
||||
|
Reference in New Issue
Block a user