@@ -9,8 +9,15 @@ pub type c_int = i32;
9
9
pub type c_uint = u32 ;
10
10
pub type c_short = i16 ;
11
11
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
+ }
14
21
pub type c_longlong = i64 ;
15
22
pub type c_ulonglong = u64 ;
16
23
pub type intmax_t = i64 ;
@@ -27,7 +34,6 @@ pub type time_t = c_longlong;
27
34
pub type c_double = f64 ;
28
35
pub type c_float = f32 ;
29
36
pub type ino_t = u64 ;
30
- pub type sigset_t = c_uchar ;
31
37
pub type suseconds_t = c_longlong ;
32
38
pub type mode_t = u32 ;
33
39
pub type dev_t = u64 ;
@@ -191,6 +197,9 @@ pub struct dirent {
191
197
pub d_name : [ c_char ; 0 ] ,
192
198
}
193
199
200
+ pub const INT_MIN : c_int = -2147483648 ;
201
+ pub const INT_MAX : c_int = 2147483647 ;
202
+
194
203
pub const EXIT_SUCCESS : c_int = 0 ;
195
204
pub const EXIT_FAILURE : c_int = 1 ;
196
205
pub const STDIN_FILENO : c_int = 0 ;
@@ -206,6 +215,8 @@ pub const F_GETFD: c_int = 1;
206
215
pub const F_SETFD : c_int = 2 ;
207
216
pub const F_GETFL : c_int = 3 ;
208
217
pub const F_SETFL : c_int = 4 ;
218
+ pub const F_DUPFD : c_int = 5 ;
219
+ pub const F_DUPFD_CLOEXEC : c_int = 6 ;
209
220
pub const FD_CLOEXEC : c_int = 1 ;
210
221
pub const FD_SETSIZE : size_t = 1024 ;
211
222
pub const O_APPEND : c_int = 0x0001 ;
@@ -364,6 +375,7 @@ pub const EWOULDBLOCK: c_int = EAGAIN;
364
375
pub const _SC_PAGESIZE: c_int = 30 ;
365
376
pub const _SC_PAGE_SIZE: :: c_int = _SC_PAGESIZE;
366
377
pub const _SC_IOV_MAX: c_int = 60 ;
378
+ pub const _SC_NPROCESSORS_ONLN: :: c_int = 84 ;
367
379
pub const _SC_SYMLOOP_MAX: c_int = 173 ;
368
380
369
381
pub static CLOCK_MONOTONIC : clockid_t = unsafe { clockid_t ( ptr_addr_of ! ( _CLOCK_MONOTONIC) ) } ;
@@ -829,3 +841,13 @@ extern "C" {
829
841
830
842
pub fn __errno_location ( ) -> * mut :: c_int ;
831
843
}
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
+ }
0 commit comments