2019-02-07 16:56:44 -08:00
|
|
|
use crate::varargs::VarArgs;
|
|
|
|
use libc::mkdir;
|
|
|
|
use std::os::raw::c_int;
|
|
|
|
use wasmer_runtime_core::vm::Ctx;
|
|
|
|
|
|
|
|
type pid_t = c_int;
|
|
|
|
|
|
|
|
// chown
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall212(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall212 (chown) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// mkdir
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall39(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall39 (mkdir) {}", which);
|
|
|
|
let pathname: u32 = varargs.get(ctx);
|
|
|
|
let mode: u32 = varargs.get(ctx);
|
|
|
|
let pathname_addr = emscripten_memory_pointer!(ctx.memory(0), pathname) as *const i8;
|
|
|
|
unsafe { mkdir(pathname_addr) }
|
|
|
|
}
|
|
|
|
|
|
|
|
// getgid
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall201(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall201 (getgid)");
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// getgid32
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall202(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
|
2019-02-07 16:56:44 -08:00
|
|
|
// gid_t
|
|
|
|
debug!("emscripten::___syscall202 (getgid32)");
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
/// dup3
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall330(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> pid_t {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall330 (dup3)");
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ioctl
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall54(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall54 (ioctl) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// socketcall
|
|
|
|
#[allow(clippy::cast_ptr_alignment)]
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall102(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall102 (socketcall) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// pread
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall180(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall180 (pread) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// pwrite
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall181(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall181 (pwrite) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
/// wait4
|
|
|
|
#[allow(clippy::cast_ptr_alignment)]
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall114(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> pid_t {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall114 (wait4)");
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// select
|
|
|
|
#[allow(clippy::cast_ptr_alignment)]
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall142(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall142 (newselect) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
// setpgid
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall57(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall57 (setpgid) {}", which);
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
|
|
|
/// uname
|
|
|
|
// NOTE: Wondering if we should return custom utsname, like Emscripten.
|
2019-02-09 13:58:05 -08:00
|
|
|
pub fn ___syscall122(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
|
2019-02-07 16:56:44 -08:00
|
|
|
debug!("emscripten::___syscall122 (uname) {}", which);
|
|
|
|
-1
|
|
|
|
}
|