mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-19 11:51:22 +00:00
Separate fpathconf from pathconf
This commit is contained in:
23
lib/emscripten/src/env/mod.rs
vendored
23
lib/emscripten/src/env/mod.rs
vendored
@ -10,6 +10,8 @@ pub use self::unix::*;
|
||||
#[cfg(windows)]
|
||||
pub use self::windows::*;
|
||||
|
||||
use libc::c_char;
|
||||
|
||||
use crate::{allocate_on_stack, EmscriptenData};
|
||||
use std::os::raw::c_int;
|
||||
use wasmer_runtime_core::vm::Ctx;
|
||||
@ -113,6 +115,27 @@ pub fn ___assert_fail(_ctx: &mut Ctx, _a: c_int, _b: c_int, _c: c_int, _d: c_int
|
||||
// TODO raise an error
|
||||
}
|
||||
|
||||
pub fn _pathconf(ctx: &mut Ctx, path_addr: c_int, name: c_int) -> c_int {
|
||||
debug!(
|
||||
"emscripten::_pathconf {} {} - UNIMPLEMENTED",
|
||||
path_addr, name
|
||||
);
|
||||
let _path = emscripten_memory_pointer!(ctx.memory(0), path_addr) as *const c_char;
|
||||
match name {
|
||||
0 => 32000,
|
||||
1 | 2 | 3 => 255,
|
||||
4 | 5 | 16 | 17 | 18 => 4096,
|
||||
6 | 7 | 20 => 1,
|
||||
8 => 0,
|
||||
9 | 10 | 11 | 12 | 14 | 15 | 19 => -1,
|
||||
13 => 64,
|
||||
_ => {
|
||||
// ___setErrNo(22);
|
||||
-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn _fpathconf(_ctx: &mut Ctx, _fildes: c_int, name: c_int) -> c_int {
|
||||
debug!("emscripten::_fpathconf {} {}", _fildes, name);
|
||||
match name {
|
||||
|
@ -545,7 +545,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
|
||||
"_sysconf" => func!(crate::env::_sysconf),
|
||||
"_getaddrinfo" => func!(crate::env::_getaddrinfo),
|
||||
"_times" => func!(crate::env::_times),
|
||||
"_pathconf" => func!(crate::env::_fpathconf),
|
||||
"_pathconf" => func!(crate::env::_pathconf),
|
||||
"_fpathconf" => func!(crate::env::_fpathconf),
|
||||
|
||||
// Syscalls
|
||||
|
Reference in New Issue
Block a user