Skip to content

Commit 6ed8750

Browse files
committed
Merge WASIX-related changes into wasix-0.2.155
2 parents 7df63bd + f79b245 commit 6ed8750

File tree

3 files changed

+1067
-3
lines changed

3 files changed

+1067
-3
lines changed

src/wasi.rs renamed to src/wasi/mod.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ pub type c_int = i32;
99
pub type c_uint = u32;
1010
pub type c_short = i16;
1111
pub type c_ushort = u16;
12-
pub type c_long = i32;
13-
pub type c_ulong = u32;
12+
cfg_if! {
13+
if #[cfg(target_arch = "wasm64")] {
14+
pub type c_long = i64;
15+
pub type c_ulong = u64;
16+
} else {
17+
pub type c_long = i32;
18+
pub type c_ulong = u32;
19+
}
20+
}
1421
pub type c_longlong = i64;
1522
pub type c_ulonglong = u64;
1623
pub type intmax_t = i64;
@@ -27,7 +34,6 @@ pub type time_t = c_longlong;
2734
pub type c_double = f64;
2835
pub type c_float = f32;
2936
pub type ino_t = u64;
30-
pub type sigset_t = c_uchar;
3137
pub type suseconds_t = c_longlong;
3238
pub type mode_t = u32;
3339
pub type dev_t = u64;
@@ -191,6 +197,9 @@ pub struct dirent {
191197
pub d_name: [c_char; 0],
192198
}
193199

200+
pub const INT_MIN: c_int = -2147483648;
201+
pub const INT_MAX: c_int = 2147483647;
202+
194203
pub const EXIT_SUCCESS: c_int = 0;
195204
pub const EXIT_FAILURE: c_int = 1;
196205
pub const STDIN_FILENO: c_int = 0;
@@ -206,6 +215,8 @@ pub const F_GETFD: c_int = 1;
206215
pub const F_SETFD: c_int = 2;
207216
pub const F_GETFL: c_int = 3;
208217
pub const F_SETFL: c_int = 4;
218+
pub const F_DUPFD: c_int = 5;
219+
pub const F_DUPFD_CLOEXEC: c_int = 6;
209220
pub const FD_CLOEXEC: c_int = 1;
210221
pub const FD_SETSIZE: size_t = 1024;
211222
pub const O_APPEND: c_int = 0x0001;
@@ -364,6 +375,7 @@ pub const EWOULDBLOCK: c_int = EAGAIN;
364375
pub const _SC_PAGESIZE: c_int = 30;
365376
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
366377
pub const _SC_IOV_MAX: c_int = 60;
378+
pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
367379
pub const _SC_SYMLOOP_MAX: c_int = 173;
368380

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

830842
pub fn __errno_location() -> *mut ::c_int;
831843
}
844+
845+
cfg_if! {
846+
if #[cfg(target_vendor = "wasmer")] {
847+
mod wasix;
848+
pub use self::wasix::*;
849+
} else {
850+
mod wasi;
851+
pub use self::wasi::*;
852+
}
853+
}

src/wasi/wasi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub type sigset_t = c_uchar;

0 commit comments

Comments
 (0)