remove leading underscores from execvp and exit

This commit is contained in:
Mackenzie Clark 2019-03-06 10:18:00 -08:00
parent 84c8be6b33
commit b1739d93ec
3 changed files with 7 additions and 7 deletions

View File

@ -1,9 +1,9 @@
use libc::execvp; use libc::execvp as libc_execvp;
use std::cell::Cell; use std::cell::Cell;
use std::ffi::CString; use std::ffi::CString;
use wasmer_runtime_core::vm::Ctx; use wasmer_runtime_core::vm::Ctx;
pub fn _execvp(ctx: &mut Ctx, command_name_offset: u32, argv_offset: u32) -> i32 { pub fn execvp(ctx: &mut Ctx, command_name_offset: u32, argv_offset: u32) -> i32 {
// a single reference to re-use // a single reference to re-use
let emscripten_memory = ctx.memory(0); let emscripten_memory = ctx.memory(0);
@ -36,5 +36,5 @@ pub fn _execvp(ctx: &mut Ctx, command_name_offset: u32, argv_offset: u32) -> i32
// construct raw pointers and hand them to `execvp` // construct raw pointers and hand them to `execvp`
let command_pointer = command_name_string.as_ptr() as *const i8; let command_pointer = command_name_string.as_ptr() as *const i8;
let args_pointer = argv.as_ptr(); let args_pointer = argv.as_ptr();
unsafe { execvp(command_pointer, args_pointer) } unsafe { libc_execvp(command_pointer, args_pointer) }
} }

View File

@ -1,7 +1,7 @@
use wasmer_runtime_core::vm::Ctx; use wasmer_runtime_core::vm::Ctx;
// __exit // __exit
pub fn __exit(_ctx: &mut Ctx, value: i32) { pub fn exit(_ctx: &mut Ctx, value: i32) {
debug!("emscripten::__exit {}", value); debug!("emscripten::exit {}", value);
::std::process::exit(value); ::std::process::exit(value);
} }

View File

@ -442,10 +442,10 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___wait" => func!(crate::lock::___wait), "___wait" => func!(crate::lock::___wait),
// exec // exec
"_execvp" => func!(crate::exec::_execvp), "_execvp" => func!(crate::exec::execvp),
// exit // exit
"__exit" => func!(crate::exit::__exit), "__exit" => func!(crate::exit::exit),
// Env // Env
"___assert_fail" => func!(crate::env::___assert_fail), "___assert_fail" => func!(crate::env::___assert_fail),