mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 02:12:13 +00:00
add syscalls for sqlite3
This commit is contained in:
parent
18a6c8a611
commit
1ce29e788f
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -1333,6 +1333,7 @@ dependencies = [
|
||||
"structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-clif-backend 0.2.0",
|
||||
"wasmer-dynasm-backend 0.1.0",
|
||||
"wasmer-emscripten 0.2.1",
|
||||
"wasmer-llvm-backend 0.1.0",
|
||||
"wasmer-runtime 0.2.1",
|
||||
@ -1371,6 +1372,8 @@ dependencies = [
|
||||
"dynasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-runtime-core 0.2.1",
|
||||
"wasmparser 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -474,10 +474,12 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
|
||||
"___syscall75" => func!(crate::syscalls::___syscall75),
|
||||
"___syscall85" => func!(crate::syscalls::___syscall85),
|
||||
"___syscall91" => func!(crate::syscalls::___syscall191),
|
||||
"___syscall94" => func!(crate::syscalls::___syscall194),
|
||||
"___syscall97" => func!(crate::syscalls::___syscall97),
|
||||
"___syscall102" => func!(crate::syscalls::___syscall102),
|
||||
"___syscall110" => func!(crate::syscalls::___syscall110),
|
||||
"___syscall114" => func!(crate::syscalls::___syscall114),
|
||||
"___syscall118" => func!(crate::syscalls::___syscall118),
|
||||
"___syscall122" => func!(crate::syscalls::___syscall122),
|
||||
"___syscall140" => func!(crate::syscalls::___syscall140),
|
||||
"___syscall142" => func!(crate::syscalls::___syscall142),
|
||||
@ -496,6 +498,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
|
||||
"___syscall199" => func!(crate::syscalls::___syscall199),
|
||||
"___syscall201" => func!(crate::syscalls::___syscall201),
|
||||
"___syscall202" => func!(crate::syscalls::___syscall202),
|
||||
"___syscall207" => func!(crate::syscalls::___syscall207),
|
||||
"___syscall212" => func!(crate::syscalls::___syscall212),
|
||||
"___syscall220" => func!(crate::syscalls::___syscall220),
|
||||
"___syscall221" => func!(crate::syscalls::___syscall221),
|
||||
|
@ -4,7 +4,6 @@ use crate::varargs::VarArgs;
|
||||
use libc::{
|
||||
accept,
|
||||
bind,
|
||||
// ENOTTY,
|
||||
c_char,
|
||||
c_int,
|
||||
c_void,
|
||||
@ -12,17 +11,23 @@ use libc::{
|
||||
// fcntl, setsockopt, getppid
|
||||
connect,
|
||||
dup2,
|
||||
fchmod,
|
||||
fchown,
|
||||
fcntl,
|
||||
// ENOTTY,
|
||||
fsync,
|
||||
getgid,
|
||||
getpeername,
|
||||
getsockname,
|
||||
getsockopt,
|
||||
gid_t,
|
||||
in_addr_t,
|
||||
in_port_t,
|
||||
ioctl,
|
||||
// iovec,
|
||||
listen,
|
||||
mkdir,
|
||||
mode_t,
|
||||
msghdr,
|
||||
open,
|
||||
pid_t,
|
||||
@ -43,6 +48,7 @@ use libc::{
|
||||
sockaddr,
|
||||
socket,
|
||||
socklen_t,
|
||||
uid_t,
|
||||
uname,
|
||||
utsname,
|
||||
EINVAL,
|
||||
@ -134,6 +140,15 @@ pub fn ___syscall202(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// fchown
|
||||
pub fn ___syscall207(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall207 (fchown) {}", _which);
|
||||
let fd: c_int = varargs.get(ctx);
|
||||
let owner: uid_t = varargs.get(ctx);
|
||||
let group: gid_t = varargs.get(ctx);
|
||||
unsafe { fchown(fd, owner, group) }
|
||||
}
|
||||
|
||||
/// dup3
|
||||
pub fn ___syscall330(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> pid_t {
|
||||
// Implementation based on description at https://linux.die.net/man/2/dup3
|
||||
@ -499,6 +514,14 @@ pub fn ___syscall181(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
|
||||
status
|
||||
}
|
||||
|
||||
/// fchmod
|
||||
pub fn ___syscall94(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall118 (fchmod) {}", _which);
|
||||
let fd: c_int = varargs.get(ctx);
|
||||
let mode: mode_t = varargs.get(ctx);
|
||||
unsafe { fchmod(fd, mode) }
|
||||
}
|
||||
|
||||
/// wait4
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
pub fn ___syscall114(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> pid_t {
|
||||
@ -517,6 +540,13 @@ pub fn ___syscall114(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> pid_
|
||||
res
|
||||
}
|
||||
|
||||
/// fsync
|
||||
pub fn ___syscall118(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall118 (fsync) {}", _which);
|
||||
let fd: c_int = varargs.get(ctx);
|
||||
unsafe { fsync(fd) }
|
||||
}
|
||||
|
||||
// select
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
pub fn ___syscall142(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||
|
@ -103,6 +103,12 @@ pub fn ___syscall54(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_in
|
||||
-1
|
||||
}
|
||||
|
||||
/// fchmod
|
||||
pub fn ___syscall94(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall118 (fchmod) {}", _which);
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
// socketcall
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
pub fn ___syscall102(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_int {
|
||||
@ -112,6 +118,12 @@ pub fn ___syscall102(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
|
||||
-1
|
||||
}
|
||||
|
||||
/// fsync
|
||||
pub fn ___syscall118(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall118 (fsync) {}", _which);
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
// pread
|
||||
pub fn ___syscall180(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall180 (pread) {}", which);
|
||||
@ -160,3 +172,9 @@ pub fn ___syscall122(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
|
||||
let _ = which;
|
||||
-1
|
||||
}
|
||||
|
||||
/// fchown
|
||||
pub fn ___syscall207(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
|
||||
debug!("emscripten::___syscall207 (fchown) {}", _which);
|
||||
unimplemented!()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user