Skip to content

Commit

Permalink
Merge WASIX-related changes into wasix-0.2.155
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 committed Aug 5, 2024
2 parents 7df63bd + f79b245 commit 6ed8750
Show file tree
Hide file tree
Showing 3 changed files with 1,067 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/wasi.rs → src/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ pub type c_int = i32;
pub type c_uint = u32;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_long = i32;
pub type c_ulong = u32;
cfg_if! {
if #[cfg(target_arch = "wasm64")] {
pub type c_long = i64;
pub type c_ulong = u64;
} else {
pub type c_long = i32;
pub type c_ulong = u32;
}
}
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
Expand All @@ -27,7 +34,6 @@ pub type time_t = c_longlong;
pub type c_double = f64;
pub type c_float = f32;
pub type ino_t = u64;
pub type sigset_t = c_uchar;
pub type suseconds_t = c_longlong;
pub type mode_t = u32;
pub type dev_t = u64;
Expand Down Expand Up @@ -191,6 +197,9 @@ pub struct dirent {
pub d_name: [c_char; 0],
}

pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;

pub const EXIT_SUCCESS: c_int = 0;
pub const EXIT_FAILURE: c_int = 1;
pub const STDIN_FILENO: c_int = 0;
Expand All @@ -206,6 +215,8 @@ pub const F_GETFD: c_int = 1;
pub const F_SETFD: c_int = 2;
pub const F_GETFL: c_int = 3;
pub const F_SETFL: c_int = 4;
pub const F_DUPFD: c_int = 5;
pub const F_DUPFD_CLOEXEC: c_int = 6;
pub const FD_CLOEXEC: c_int = 1;
pub const FD_SETSIZE: size_t = 1024;
pub const O_APPEND: c_int = 0x0001;
Expand Down Expand Up @@ -364,6 +375,7 @@ pub const EWOULDBLOCK: c_int = EAGAIN;
pub const _SC_PAGESIZE: c_int = 30;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_IOV_MAX: c_int = 60;
pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
pub const _SC_SYMLOOP_MAX: c_int = 173;

pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
Expand Down Expand Up @@ -829,3 +841,13 @@ extern "C" {

pub fn __errno_location() -> *mut ::c_int;
}

cfg_if! {
if #[cfg(target_vendor = "wasmer")] {
mod wasix;
pub use self::wasix::*;
} else {
mod wasi;
pub use self::wasi::*;
}
}
1 change: 1 addition & 0 deletions src/wasi/wasi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub type sigset_t = c_uchar;
Loading

0 comments on commit 6ed8750

Please sign in to comment.