1 //! WASI types as defined in wasm32. This file was originally generated
2 //! by running bindgen over wasi/core.h with a wasm32 target, and the content
3 //! still largely reflects that, however it's been heavily modified, to
4 //! be host-independent, to avoid exposing libc implementation details,
5 //! to clean up cases where the headers use complex preprocessor macros,
6 //! and to
7
8 #![allow(non_camel_case_types)]
9 #![allow(non_snake_case)]
10 #![allow(dead_code)]
11
12 // C types
13 pub type char = i8;
14 pub type schar = i8;
15 pub type uchar = u8;
16 pub type short = i16;
17 pub type ushort = u16;
18 pub type int = i32;
19 pub type uint = u32;
20 pub type long = i32;
21 pub type ulong = u32;
22 pub type longlong = i64;
23 pub type ulonglong = u64;
24
25 // libc stdint types
26 pub type int8_t = i8;
27 pub type uint8_t = u8;
28 pub type int16_t = i16;
29 pub type uint16_t = u16;
30 pub type int32_t = i32;
31 pub type uint32_t = u32;
32 pub type int64_t = i64;
33 pub type uint64_t = u64;
34 pub type intmax_t = i64;
35 pub type uintmax_t = u64;
36 pub type int_least8_t = i8;
37 pub type int_least16_t = i16;
38 pub type int_least32_t = i32;
39 pub type int_least64_t = i64;
40 pub type uint_least8_t = u8;
41 pub type uint_least16_t = u16;
42 pub type uint_least32_t = u32;
43 pub type uint_least64_t = u64;
44 pub type int_fast8_t = i8;
45 pub type int_fast16_t = i32;
46 pub type int_fast32_t = i32;
47 pub type int_fast64_t = i64;
48 pub type uint_fast8_t = u8;
49 pub type uint_fast16_t = u32;
50 pub type uint_fast32_t = u32;
51 pub type uint_fast64_t = u64;
52 pub type size_t = ulong;
53 pub type intptr_t = long;
54 pub type uintptr_t = ulong;
55 pub type wchar_t = i32;
56
57 // libc types
58 pub type dev_t = u64;
59 pub type uid_t = u32;
60 pub type gid_t = u32;
61 pub type ino_t = u64;
62 pub type ino64_t = u64;
63 pub type mode_t = u32;
64 pub type nlink_t = u64;
65 pub type off_t = i64;
66 pub type off64_t = i64;
67 pub type pid_t = i32;
68 pub type clock_t = i64;
69 pub type rlim_t = u64;
70 pub type rlim64_t = u64;
71 pub type id_t = u32;
72 pub type time_t = i64;
73 pub type useconds_t = u32;
74 pub type suseconds_t = i64;
75 pub type daddr_t = i32;
76 pub type key_t = i32;
77 pub type clockid_t = i32;
78 pub type timer_t = uintptr_t; // *mut ::std::os::raw::c_void
79 pub type blksize_t = i64;
80 pub type blkcnt_t = i64;
81 pub type blkcnt64_t = i64;
82 pub type fsblkcnt_t = u64;
83 pub type fsblkcnt64_t = u64;
84 pub type fsfilcnt_t = u64;
85 pub type fsfilcnt64_t = u64;
86 pub type fsword_t = i64;
87 pub type ssize_t = i32;
88 pub type loff_t = off64_t;
89 pub type caddr_t = uintptr_t; // *mut i8
90 pub type socklen_t = u32;
91 pub type sig_atomic_t = i32;
92 #[repr(C)]
93 #[derive(Debug, Copy, Clone)]
94 pub struct fsid_t {
95 pub __val: [i32; 2usize],
96 }
97 #[allow(non_snake_case)]
98 #[test]
bindgen_test_layout_fsid_t()99 fn bindgen_test_layout_fsid_t() {
100 assert_eq!(
101 ::std::mem::size_of::<fsid_t>(),
102 8usize,
103 concat!("Size of: ", stringify!(fsid_t))
104 );
105 assert_eq!(
106 ::std::mem::align_of::<fsid_t>(),
107 4usize,
108 concat!("Alignment of ", stringify!(fsid_t))
109 );
110 assert_eq!(
111 unsafe { &(*(::std::ptr::null::<fsid_t>())).__val as *const _ as usize },
112 0usize,
113 concat!(
114 "Offset of field: ",
115 stringify!(fsid_t),
116 "::",
117 stringify!(__val)
118 )
119 );
120 }
121
122 // WASI types
123 pub type __wasi_advice_t = u8;
124 pub type __wasi_clockid_t = u32;
125 pub type __wasi_device_t = u64;
126 pub type __wasi_dircookie_t = u64;
127 pub type __wasi_errno_t = u16;
128 pub type __wasi_eventrwflags_t = u16;
129 pub type __wasi_eventtype_t = u8;
130 pub type __wasi_exitcode_t = u32;
131 pub type __wasi_fd_t = u32;
132 pub type __wasi_fdflags_t = u16;
133 pub type __wasi_fdsflags_t = u16;
134 pub type __wasi_filedelta_t = i64;
135 pub type __wasi_filesize_t = u64;
136 pub type __wasi_filetype_t = u8;
137 pub type __wasi_preopentype_t = u8;
138 pub type __wasi_fstflags_t = u16;
139 pub type __wasi_inode_t = u64;
140 pub type __wasi_linkcount_t = u32;
141 pub type __wasi_lookupflags_t = u32;
142 pub type __wasi_oflags_t = u16;
143 pub type __wasi_riflags_t = u16;
144 pub type __wasi_rights_t = u64;
145 pub type __wasi_roflags_t = u16;
146 pub type __wasi_sdflags_t = u8;
147 pub type __wasi_siflags_t = u16;
148 pub type __wasi_signal_t = u8;
149 pub type __wasi_subclockflags_t = u16;
150 pub type __wasi_timestamp_t = u64;
151 pub type __wasi_userdata_t = u64;
152 pub type __wasi_whence_t = u8;
153 #[repr(C)]
154 #[derive(Debug, Copy, Clone)]
155 pub struct __wasi_dirent_t {
156 pub d_next: __wasi_dircookie_t,
157 pub d_ino: __wasi_inode_t,
158 pub d_namlen: u32,
159 pub d_type: __wasi_filetype_t,
160 pub __bindgen_padding_0: [u8; 3usize],
161 }
162 #[test]
bindgen_test_layout_wasi_dirent_t()163 fn bindgen_test_layout_wasi_dirent_t() {
164 assert_eq!(
165 ::std::mem::size_of::<__wasi_dirent_t>(),
166 24usize,
167 concat!("Size of: ", stringify!(__wasi_dirent_t))
168 );
169 assert_eq!(
170 unsafe { &(*(::std::ptr::null::<__wasi_dirent_t>())).d_next as *const _ as usize },
171 0usize,
172 concat!(
173 "Offset of field: ",
174 stringify!(__wasi_dirent_t),
175 "::",
176 stringify!(d_next)
177 )
178 );
179 assert_eq!(
180 unsafe { &(*(::std::ptr::null::<__wasi_dirent_t>())).d_ino as *const _ as usize },
181 8usize,
182 concat!(
183 "Offset of field: ",
184 stringify!(__wasi_dirent_t),
185 "::",
186 stringify!(d_ino)
187 )
188 );
189 assert_eq!(
190 unsafe { &(*(::std::ptr::null::<__wasi_dirent_t>())).d_namlen as *const _ as usize },
191 16usize,
192 concat!(
193 "Offset of field: ",
194 stringify!(__wasi_dirent_t),
195 "::",
196 stringify!(d_namlen)
197 )
198 );
199 assert_eq!(
200 unsafe { &(*(::std::ptr::null::<__wasi_dirent_t>())).d_type as *const _ as usize },
201 20usize,
202 concat!(
203 "Offset of field: ",
204 stringify!(__wasi_dirent_t),
205 "::",
206 stringify!(d_type)
207 )
208 );
209 }
210 #[repr(C)]
211 #[derive(Copy, Clone)]
212 pub struct __wasi_event_t {
213 pub userdata: __wasi_userdata_t,
214 pub error: __wasi_errno_t,
215 pub type_: __wasi_eventtype_t,
216 pub __bindgen_padding_0: u32,
217 pub __bindgen_anon_1: __wasi_event_t__bindgen_ty_1,
218 }
219 #[repr(C)]
220 #[derive(Copy, Clone)]
221 pub struct __wasi_prestat_t {
222 pub pr_type: __wasi_preopentype_t,
223 pub u: __wasi_prestat_t___wasi_prestat_u,
224 }
225 #[repr(C)]
226 #[derive(Copy, Clone)]
227 pub union __wasi_prestat_t___wasi_prestat_u {
228 pub dir: __wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t,
229 }
230 #[repr(C)]
231 #[derive(Debug, Copy, Clone)]
232 pub struct __wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t {
233 pub pr_name_len: size_t,
234 }
235 #[test]
bindgen_test_layout___wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t()236 fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t() {
237 assert_eq!(
238 ::std::mem::size_of::<__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t>(),
239 4usize,
240 concat!(
241 "Size of: ",
242 stringify!(__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t)
243 )
244 );
245 assert_eq!(
246 ::std::mem::align_of::<__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t>(),
247 4usize,
248 concat!(
249 "Alignment of ",
250 stringify!(__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t)
251 )
252 );
253 assert_eq!(
254 unsafe {
255 &(*(::std::ptr::null::<__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t>()))
256 .pr_name_len as *const _ as usize
257 },
258 0usize,
259 concat!(
260 "Offset of field: ",
261 stringify!(__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t),
262 "::",
263 stringify!(pr_name_len)
264 )
265 );
266 }
267 #[test]
bindgen_test_layout___wasi_prestat_t___wasi_prestat_u()268 fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u() {
269 assert_eq!(
270 ::std::mem::size_of::<__wasi_prestat_t___wasi_prestat_u>(),
271 4usize,
272 concat!("Size of: ", stringify!(__wasi_prestat_t___wasi_prestat_u))
273 );
274 assert_eq!(
275 ::std::mem::align_of::<__wasi_prestat_t___wasi_prestat_u>(),
276 4usize,
277 concat!(
278 "Alignment of ",
279 stringify!(__wasi_prestat_t___wasi_prestat_u)
280 )
281 );
282 assert_eq!(
283 unsafe {
284 &(*(::std::ptr::null::<__wasi_prestat_t___wasi_prestat_u>())).dir as *const _ as usize
285 },
286 0usize,
287 concat!(
288 "Offset of field: ",
289 stringify!(__wasi_prestat_t___wasi_prestat_u),
290 "::",
291 stringify!(dir)
292 )
293 );
294 }
295 #[test]
bindgen_test_layout___wasi_prestat_t()296 fn bindgen_test_layout___wasi_prestat_t() {
297 assert_eq!(
298 ::std::mem::size_of::<__wasi_prestat_t>(),
299 8usize,
300 concat!("Size of: ", stringify!(__wasi_prestat_t))
301 );
302 assert_eq!(
303 ::std::mem::align_of::<__wasi_prestat_t>(),
304 4usize,
305 concat!("Alignment of ", stringify!(__wasi_prestat_t))
306 );
307 assert_eq!(
308 unsafe { &(*(::std::ptr::null::<__wasi_prestat_t>())).pr_type as *const _ as usize },
309 0usize,
310 concat!(
311 "Offset of field: ",
312 stringify!(__wasi_prestat_t),
313 "::",
314 stringify!(pr_type)
315 )
316 );
317 assert_eq!(
318 unsafe { &(*(::std::ptr::null::<__wasi_prestat_t>())).u as *const _ as usize },
319 4usize,
320 concat!(
321 "Offset of field: ",
322 stringify!(__wasi_prestat_t),
323 "::",
324 stringify!(u)
325 )
326 );
327 }
328 #[allow(non_snake_case)]
329 #[repr(C)]
330 #[derive(Copy, Clone)]
331 pub union __wasi_event_t__bindgen_ty_1 {
332 pub fd_readwrite: __wasi_event_t__bindgen_ty_1__bindgen_ty_1,
333 _bindgen_union_align: [u64; 2usize],
334 }
335 #[repr(C)]
336 #[derive(Debug, Copy, Clone)]
337 pub struct __wasi_event_t__bindgen_ty_1__bindgen_ty_1 {
338 pub nbytes: __wasi_filesize_t,
339 pub flags: __wasi_eventrwflags_t,
340 pub __bindgen_padding_0: [u16; 3usize],
341 }
342 #[allow(non_snake_case)]
343 #[test]
bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_1()344 fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_1() {
345 assert_eq!(
346 ::std::mem::size_of::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>(),
347 16usize,
348 concat!(
349 "Size of: ",
350 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_1)
351 )
352 );
353 assert_eq!(
354 unsafe {
355 &(*(::std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).nbytes
356 as *const _ as usize
357 },
358 0usize,
359 concat!(
360 "Offset of field: ",
361 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_1),
362 "::",
363 stringify!(nbytes)
364 )
365 );
366 assert_eq!(
367 unsafe {
368 &(*(::std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).flags as *const _
369 as usize
370 },
371 8usize,
372 concat!(
373 "Offset of field: ",
374 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_1),
375 "::",
376 stringify!(flags)
377 )
378 );
379 }
380 #[repr(C)]
381 #[derive(Debug, Copy, Clone)]
382 pub struct __wasi_event_t__bindgen_ty_1__bindgen_ty_2 {
383 pub signal: __wasi_signal_t,
384 pub exitcode: __wasi_exitcode_t,
385 }
386 #[allow(non_snake_case)]
387 #[test]
bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_2()388 fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_2() {
389 assert_eq!(
390 ::std::mem::size_of::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>(),
391 8usize,
392 concat!(
393 "Size of: ",
394 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_2)
395 )
396 );
397 assert_eq!(
398 ::std::mem::align_of::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>(),
399 4usize,
400 concat!(
401 "Alignment of ",
402 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_2)
403 )
404 );
405 assert_eq!(
406 unsafe {
407 &(*(::std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).signal
408 as *const _ as usize
409 },
410 0usize,
411 concat!(
412 "Offset of field: ",
413 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_2),
414 "::",
415 stringify!(signal)
416 )
417 );
418 assert_eq!(
419 unsafe {
420 &(*(::std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).exitcode
421 as *const _ as usize
422 },
423 4usize,
424 concat!(
425 "Offset of field: ",
426 stringify!(__wasi_event_t__bindgen_ty_1__bindgen_ty_2),
427 "::",
428 stringify!(exitcode)
429 )
430 );
431 }
432 #[allow(non_snake_case)]
433 #[test]
bindgen_test_layout_wasi_event_t__bindgen_ty_1()434 fn bindgen_test_layout_wasi_event_t__bindgen_ty_1() {
435 assert_eq!(
436 ::std::mem::size_of::<__wasi_event_t__bindgen_ty_1>(),
437 16usize,
438 concat!("Size of: ", stringify!(__wasi_event_t__bindgen_ty_1))
439 );
440 assert_eq!(
441 unsafe {
442 &(*(::std::ptr::null::<__wasi_event_t__bindgen_ty_1>())).fd_readwrite as *const _
443 as usize
444 },
445 0usize,
446 concat!(
447 "Offset of field: ",
448 stringify!(__wasi_event_t__bindgen_ty_1),
449 "::",
450 stringify!(fd_readwrite)
451 )
452 );
453 }
454 #[test]
bindgen_test_layout_wasi_event_t()455 fn bindgen_test_layout_wasi_event_t() {
456 assert_eq!(
457 ::std::mem::size_of::<__wasi_event_t>(),
458 32usize,
459 concat!("Size of: ", stringify!(__wasi_event_t))
460 );
461 assert_eq!(
462 unsafe { &(*(::std::ptr::null::<__wasi_event_t>())).userdata as *const _ as usize },
463 0usize,
464 concat!(
465 "Offset of field: ",
466 stringify!(__wasi_event_t),
467 "::",
468 stringify!(userdata)
469 )
470 );
471 assert_eq!(
472 unsafe { &(*(::std::ptr::null::<__wasi_event_t>())).error as *const _ as usize },
473 8usize,
474 concat!(
475 "Offset of field: ",
476 stringify!(__wasi_event_t),
477 "::",
478 stringify!(error)
479 )
480 );
481 assert_eq!(
482 unsafe { &(*(::std::ptr::null::<__wasi_event_t>())).type_ as *const _ as usize },
483 10usize,
484 concat!(
485 "Offset of field: ",
486 stringify!(__wasi_event_t),
487 "::",
488 stringify!(type_)
489 )
490 );
491 }
492 #[repr(C)]
493 #[derive(Debug, Copy, Clone)]
494 pub struct __wasi_fdstat_t {
495 pub fs_filetype: __wasi_filetype_t,
496 pub fs_flags: __wasi_fdflags_t,
497 pub __bindgen_padding_0: u32,
498 pub fs_rights_base: __wasi_rights_t,
499 pub fs_rights_inheriting: __wasi_rights_t,
500 }
501 #[test]
bindgen_test_layout_wasi_fdstat_t()502 fn bindgen_test_layout_wasi_fdstat_t() {
503 assert_eq!(
504 ::std::mem::size_of::<__wasi_fdstat_t>(),
505 24usize,
506 concat!("Size of: ", stringify!(__wasi_fdstat_t))
507 );
508 assert_eq!(
509 unsafe { &(*(::std::ptr::null::<__wasi_fdstat_t>())).fs_filetype as *const _ as usize },
510 0usize,
511 concat!(
512 "Offset of field: ",
513 stringify!(__wasi_fdstat_t),
514 "::",
515 stringify!(fs_filetype)
516 )
517 );
518 assert_eq!(
519 unsafe { &(*(::std::ptr::null::<__wasi_fdstat_t>())).fs_flags as *const _ as usize },
520 2usize,
521 concat!(
522 "Offset of field: ",
523 stringify!(__wasi_fdstat_t),
524 "::",
525 stringify!(fs_flags)
526 )
527 );
528 assert_eq!(
529 unsafe { &(*(::std::ptr::null::<__wasi_fdstat_t>())).fs_rights_base as *const _ as usize },
530 8usize,
531 concat!(
532 "Offset of field: ",
533 stringify!(__wasi_fdstat_t),
534 "::",
535 stringify!(fs_rights_base)
536 )
537 );
538 assert_eq!(
539 unsafe {
540 &(*(::std::ptr::null::<__wasi_fdstat_t>())).fs_rights_inheriting as *const _ as usize
541 },
542 16usize,
543 concat!(
544 "Offset of field: ",
545 stringify!(__wasi_fdstat_t),
546 "::",
547 stringify!(fs_rights_inheriting)
548 )
549 );
550 }
551 #[repr(C)]
552 #[derive(Debug, Copy, Clone)]
553 pub struct __wasi_filestat_t {
554 pub st_dev: __wasi_device_t,
555 pub st_ino: __wasi_inode_t,
556 pub st_filetype: __wasi_filetype_t,
557 pub st_nlink: __wasi_linkcount_t,
558 pub st_size: __wasi_filesize_t,
559 pub st_atim: __wasi_timestamp_t,
560 pub st_mtim: __wasi_timestamp_t,
561 pub st_ctim: __wasi_timestamp_t,
562 }
563 #[test]
bindgen_test_layout_wasi_filestat_t()564 fn bindgen_test_layout_wasi_filestat_t() {
565 assert_eq!(
566 ::std::mem::size_of::<__wasi_filestat_t>(),
567 56usize,
568 concat!("Size of: ", stringify!(__wasi_filestat_t))
569 );
570 assert_eq!(
571 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_dev as *const _ as usize },
572 0usize,
573 concat!(
574 "Offset of field: ",
575 stringify!(__wasi_filestat_t),
576 "::",
577 stringify!(st_dev)
578 )
579 );
580 assert_eq!(
581 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ino as *const _ as usize },
582 8usize,
583 concat!(
584 "Offset of field: ",
585 stringify!(__wasi_filestat_t),
586 "::",
587 stringify!(st_ino)
588 )
589 );
590 assert_eq!(
591 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_filetype as *const _ as usize },
592 16usize,
593 concat!(
594 "Offset of field: ",
595 stringify!(__wasi_filestat_t),
596 "::",
597 stringify!(st_filetype)
598 )
599 );
600 assert_eq!(
601 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_nlink as *const _ as usize },
602 20usize,
603 concat!(
604 "Offset of field: ",
605 stringify!(__wasi_filestat_t),
606 "::",
607 stringify!(st_nlink)
608 )
609 );
610 assert_eq!(
611 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_size as *const _ as usize },
612 24usize,
613 concat!(
614 "Offset of field: ",
615 stringify!(__wasi_filestat_t),
616 "::",
617 stringify!(st_size)
618 )
619 );
620 assert_eq!(
621 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_atim as *const _ as usize },
622 32usize,
623 concat!(
624 "Offset of field: ",
625 stringify!(__wasi_filestat_t),
626 "::",
627 stringify!(st_atim)
628 )
629 );
630 assert_eq!(
631 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_mtim as *const _ as usize },
632 40usize,
633 concat!(
634 "Offset of field: ",
635 stringify!(__wasi_filestat_t),
636 "::",
637 stringify!(st_mtim)
638 )
639 );
640 assert_eq!(
641 unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ctim as *const _ as usize },
642 48usize,
643 concat!(
644 "Offset of field: ",
645 stringify!(__wasi_filestat_t),
646 "::",
647 stringify!(st_ctim)
648 )
649 );
650 }
651 #[repr(C)]
652 #[derive(Debug, Copy, Clone)]
653 pub struct __wasi_ciovec_t {
654 pub buf: uintptr_t, // *const ::std::os::raw::c_void
655 pub buf_len: size_t,
656 }
657 #[test]
bindgen_test_layout_wasi_ciovec_t()658 fn bindgen_test_layout_wasi_ciovec_t() {
659 assert_eq!(
660 ::std::mem::size_of::<__wasi_ciovec_t>(),
661 8usize,
662 concat!("Size of: ", stringify!(__wasi_ciovec_t))
663 );
664 assert_eq!(
665 ::std::mem::align_of::<__wasi_ciovec_t>(),
666 4usize,
667 concat!("Alignment of ", stringify!(__wasi_ciovec_t))
668 );
669 assert_eq!(
670 unsafe { &(*(::std::ptr::null::<__wasi_ciovec_t>())).buf as *const _ as usize },
671 0usize,
672 concat!(
673 "Offset of field: ",
674 stringify!(__wasi_ciovec_t),
675 "::",
676 stringify!(buf)
677 )
678 );
679 assert_eq!(
680 unsafe { &(*(::std::ptr::null::<__wasi_ciovec_t>())).buf_len as *const _ as usize },
681 4usize,
682 concat!(
683 "Offset of field: ",
684 stringify!(__wasi_ciovec_t),
685 "::",
686 stringify!(buf_len)
687 )
688 );
689 }
690 #[repr(C)]
691 #[derive(Debug, Copy, Clone)]
692 pub struct __wasi_iovec_t {
693 pub buf: uintptr_t, // *mut ::std::os::raw::c_void
694 pub buf_len: size_t,
695 }
696 #[test]
bindgen_test_layout_wasi_iovec_t()697 fn bindgen_test_layout_wasi_iovec_t() {
698 assert_eq!(
699 ::std::mem::size_of::<__wasi_iovec_t>(),
700 8usize,
701 concat!("Size of: ", stringify!(__wasi_iovec_t))
702 );
703 assert_eq!(
704 ::std::mem::align_of::<__wasi_iovec_t>(),
705 4usize,
706 concat!("Alignment of ", stringify!(__wasi_iovec_t))
707 );
708 assert_eq!(
709 unsafe { &(*(::std::ptr::null::<__wasi_iovec_t>())).buf as *const _ as usize },
710 0usize,
711 concat!(
712 "Offset of field: ",
713 stringify!(__wasi_iovec_t),
714 "::",
715 stringify!(buf)
716 )
717 );
718 assert_eq!(
719 unsafe { &(*(::std::ptr::null::<__wasi_iovec_t>())).buf_len as *const _ as usize },
720 4usize,
721 concat!(
722 "Offset of field: ",
723 stringify!(__wasi_iovec_t),
724 "::",
725 stringify!(buf_len)
726 )
727 );
728 }
729 #[repr(C)]
730 #[derive(Copy, Clone)]
731 pub struct __wasi_subscription_t {
732 pub userdata: __wasi_userdata_t,
733 pub type_: __wasi_eventtype_t,
734 pub __bindgen_padding_0: u32,
735 pub __bindgen_anon_1: __wasi_subscription_t__bindgen_ty_1,
736 }
737 #[repr(C)]
738 #[derive(Copy, Clone)]
739 pub union __wasi_subscription_t__bindgen_ty_1 {
740 pub clock: __wasi_subscription_t__bindgen_ty_1__bindgen_ty_1,
741 pub fd_readwrite: __wasi_subscription_t__bindgen_ty_1__bindgen_ty_3,
742 _bindgen_union_align: [u64; 5usize],
743 }
744 #[repr(C)]
745 #[derive(Debug, Copy, Clone)]
746 pub struct __wasi_subscription_t__bindgen_ty_1__bindgen_ty_1 {
747 pub identifier: __wasi_userdata_t,
748 pub clock_id: __wasi_clockid_t,
749 pub __bindgen_padding_0: u32,
750 pub timeout: __wasi_timestamp_t,
751 pub precision: __wasi_timestamp_t,
752 pub flags: __wasi_subclockflags_t,
753 pub __bindgen_padding_1: [u16; 3usize],
754 }
755 #[allow(non_snake_case)]
756 #[test]
bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_1()757 fn bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_1() {
758 assert_eq!(
759 ::std::mem::size_of::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>(),
760 40usize,
761 concat!(
762 "Size of: ",
763 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1)
764 )
765 );
766 assert_eq!(
767 unsafe {
768 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>())).identifier
769 as *const _ as usize
770 },
771 0usize,
772 concat!(
773 "Offset of field: ",
774 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1),
775 "::",
776 stringify!(identifier)
777 )
778 );
779 assert_eq!(
780 unsafe {
781 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>())).clock_id
782 as *const _ as usize
783 },
784 8usize,
785 concat!(
786 "Offset of field: ",
787 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1),
788 "::",
789 stringify!(clock_id)
790 )
791 );
792 assert_eq!(
793 unsafe {
794 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>())).timeout
795 as *const _ as usize
796 },
797 16usize,
798 concat!(
799 "Offset of field: ",
800 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1),
801 "::",
802 stringify!(timeout)
803 )
804 );
805 assert_eq!(
806 unsafe {
807 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>())).precision
808 as *const _ as usize
809 },
810 24usize,
811 concat!(
812 "Offset of field: ",
813 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1),
814 "::",
815 stringify!(precision)
816 )
817 );
818 assert_eq!(
819 unsafe {
820 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1>())).flags
821 as *const _ as usize
822 },
823 32usize,
824 concat!(
825 "Offset of field: ",
826 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_1),
827 "::",
828 stringify!(flags)
829 )
830 );
831 }
832 #[repr(C)]
833 #[derive(Debug, Copy, Clone)]
834 pub struct __wasi_subscription_t__bindgen_ty_1__bindgen_ty_3 {
835 pub fd: __wasi_fd_t,
836 }
837 #[allow(non_snake_case)]
838 #[test]
bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_3()839 fn bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_3() {
840 assert_eq!(
841 ::std::mem::size_of::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3>(),
842 4usize,
843 concat!(
844 "Size of: ",
845 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3)
846 )
847 );
848 assert_eq!(
849 ::std::mem::align_of::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3>(),
850 4usize,
851 concat!(
852 "Alignment of ",
853 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3)
854 )
855 );
856 assert_eq!(
857 unsafe {
858 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3>())).fd
859 as *const _ as usize
860 },
861 0usize,
862 concat!(
863 "Offset of field: ",
864 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_3),
865 "::",
866 stringify!(fd)
867 )
868 );
869 }
870 #[repr(C)]
871 #[derive(Debug, Copy, Clone)]
872 pub struct __wasi_subscription_t__bindgen_ty_1__bindgen_ty_5 {
873 pub fd: __wasi_fd_t,
874 }
875 #[allow(non_snake_case)]
876 #[test]
bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_5()877 fn bindgen_test_layout_wasi_subscription_t__bindgen_ty_1__bindgen_ty_5() {
878 assert_eq!(
879 ::std::mem::size_of::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5>(),
880 4usize,
881 concat!(
882 "Size of: ",
883 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5)
884 )
885 );
886 assert_eq!(
887 ::std::mem::align_of::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5>(),
888 4usize,
889 concat!(
890 "Alignment of ",
891 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5)
892 )
893 );
894 assert_eq!(
895 unsafe {
896 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5>())).fd
897 as *const _ as usize
898 },
899 0usize,
900 concat!(
901 "Offset of field: ",
902 stringify!(__wasi_subscription_t__bindgen_ty_1__bindgen_ty_5),
903 "::",
904 stringify!(fd)
905 )
906 );
907 }
908 #[allow(non_snake_case)]
909 #[test]
bindgen_test_layout_wasi_subscription_t__bindgen_ty_1()910 fn bindgen_test_layout_wasi_subscription_t__bindgen_ty_1() {
911 assert_eq!(
912 ::std::mem::size_of::<__wasi_subscription_t__bindgen_ty_1>(),
913 40usize,
914 concat!("Size of: ", stringify!(__wasi_subscription_t__bindgen_ty_1))
915 );
916 assert_eq!(
917 unsafe {
918 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1>())).clock as *const _
919 as usize
920 },
921 0usize,
922 concat!(
923 "Offset of field: ",
924 stringify!(__wasi_subscription_t__bindgen_ty_1),
925 "::",
926 stringify!(clock)
927 )
928 );
929 assert_eq!(
930 unsafe {
931 &(*(::std::ptr::null::<__wasi_subscription_t__bindgen_ty_1>())).fd_readwrite as *const _
932 as usize
933 },
934 0usize,
935 concat!(
936 "Offset of field: ",
937 stringify!(__wasi_subscription_t__bindgen_ty_1),
938 "::",
939 stringify!(fd_readwrite)
940 )
941 );
942 }
943 #[allow(non_snake_case)]
944 #[test]
bindgen_test_layout_wasi_subscription_t()945 fn bindgen_test_layout_wasi_subscription_t() {
946 assert_eq!(
947 ::std::mem::size_of::<__wasi_subscription_t>(),
948 56usize,
949 concat!("Size of: ", stringify!(__wasi_subscription_t))
950 );
951 assert_eq!(
952 unsafe { &(*(::std::ptr::null::<__wasi_subscription_t>())).userdata as *const _ as usize },
953 0usize,
954 concat!(
955 "Offset of field: ",
956 stringify!(__wasi_subscription_t),
957 "::",
958 stringify!(userdata)
959 )
960 );
961 assert_eq!(
962 unsafe { &(*(::std::ptr::null::<__wasi_subscription_t>())).type_ as *const _ as usize },
963 8usize,
964 concat!(
965 "Offset of field: ",
966 stringify!(__wasi_subscription_t),
967 "::",
968 stringify!(type_)
969 )
970 );
971 }
972
strerror(errno: __wasi_errno_t) -> &'static str973 pub fn strerror(errno: __wasi_errno_t) -> &'static str {
974 match errno {
975 __WASI_ESUCCESS => "__WASI_ESUCCESS",
976 __WASI_E2BIG => "__WASI_E2BIG",
977 __WASI_EACCES => "__WASI_EACCES",
978 __WASI_EADDRINUSE => "__WASI_EADDRINUSE",
979 __WASI_EADDRNOTAVAIL => "__WASI_EADDRNOTAVAIL",
980 __WASI_EAFNOSUPPORT => "__WASI_EAFNOSUPPORT",
981 __WASI_EAGAIN => "__WASI_EAGAIN",
982 __WASI_EALREADY => "__WASI_EALREADY",
983 __WASI_EBADF => "__WASI_EBADF",
984 __WASI_EBADMSG => "__WASI_EBADMSG",
985 __WASI_EBUSY => "__WASI_EBUSY",
986 __WASI_ECANCELED => "__WASI_ECANCELED",
987 __WASI_ECHILD => "__WASI_ECHILD",
988 __WASI_ECONNABORTED => "__WASI_ECONNABORTED",
989 __WASI_ECONNREFUSED => "__WASI_ECONNREFUSED",
990 __WASI_ECONNRESET => "__WASI_ECONNRESET",
991 __WASI_EDEADLK => "__WASI_EDEADLK",
992 __WASI_EDESTADDRREQ => "__WASI_EDESTADDRREQ",
993 __WASI_EDOM => "__WASI_EDOM",
994 __WASI_EDQUOT => "__WASI_EDQUOT",
995 __WASI_EEXIST => "__WASI_EEXIST",
996 __WASI_EFAULT => "__WASI_EFAULT",
997 __WASI_EFBIG => "__WASI_EFBIG",
998 __WASI_EHOSTUNREACH => "__WASI_EHOSTUNREACH",
999 __WASI_EIDRM => "__WASI_EIDRM",
1000 __WASI_EILSEQ => "__WASI_EILSEQ",
1001 __WASI_EINPROGRESS => "__WASI_EINPROGRESS",
1002 __WASI_EINTR => "__WASI_EINTR",
1003 __WASI_EINVAL => "__WASI_EINVAL",
1004 __WASI_EIO => "__WASI_EIO",
1005 __WASI_EISCONN => "__WASI_EISCONN",
1006 __WASI_EISDIR => "__WASI_EISDIR",
1007 __WASI_ELOOP => "__WASI_ELOOP",
1008 __WASI_EMFILE => "__WASI_EMFILE",
1009 __WASI_EMLINK => "__WASI_EMLINK",
1010 __WASI_EMSGSIZE => "__WASI_EMSGSIZE",
1011 __WASI_EMULTIHOP => "__WASI_EMULTIHOP",
1012 __WASI_ENAMETOOLONG => "__WASI_ENAMETOOLONG",
1013 __WASI_ENETDOWN => "__WASI_ENETDOWN",
1014 __WASI_ENETRESET => "__WASI_ENETRESET",
1015 __WASI_ENETUNREACH => "__WASI_ENETUNREACH",
1016 __WASI_ENFILE => "__WASI_ENFILE",
1017 __WASI_ENOBUFS => "__WASI_ENOBUFS",
1018 __WASI_ENODEV => "__WASI_ENODEV",
1019 __WASI_ENOENT => "__WASI_ENOENT",
1020 __WASI_ENOEXEC => "__WASI_ENOEXEC",
1021 __WASI_ENOLCK => "__WASI_ENOLCK",
1022 __WASI_ENOLINK => "__WASI_ENOLINK",
1023 __WASI_ENOMEM => "__WASI_ENOMEM",
1024 __WASI_ENOMSG => "__WASI_ENOMSG",
1025 __WASI_ENOPROTOOPT => "__WASI_ENOPROTOOPT",
1026 __WASI_ENOSPC => "__WASI_ENOSPC",
1027 __WASI_ENOSYS => "__WASI_ENOSYS",
1028 __WASI_ENOTCONN => "__WASI_ENOTCONN",
1029 __WASI_ENOTDIR => "__WASI_ENOTDIR",
1030 __WASI_ENOTEMPTY => "__WASI_ENOTEMPTY",
1031 __WASI_ENOTRECOVERABLE => "__WASI_ENOTRECOVERABLE",
1032 __WASI_ENOTSOCK => "__WASI_ENOTSOCK",
1033 __WASI_ENOTSUP => "__WASI_ENOTSUP",
1034 __WASI_ENOTTY => "__WASI_ENOTTY",
1035 __WASI_ENXIO => "__WASI_ENXIO",
1036 __WASI_EOVERFLOW => "__WASI_EOVERFLOW",
1037 __WASI_EOWNERDEAD => "__WASI_EOWNERDEAD",
1038 __WASI_EPERM => "__WASI_EPERM",
1039 __WASI_EPIPE => "__WASI_EPIPE",
1040 __WASI_EPROTO => "__WASI_EPROTO",
1041 __WASI_EPROTONOSUPPORT => "__WASI_EPROTONOSUPPORT",
1042 __WASI_EPROTOTYPE => "__WASI_EPROTOTYPE",
1043 __WASI_ERANGE => "__WASI_ERANGE",
1044 __WASI_EROFS => "__WASI_EROFS",
1045 __WASI_ESPIPE => "__WASI_ESPIPE",
1046 __WASI_ESRCH => "__WASI_ESRCH",
1047 __WASI_ESTALE => "__WASI_ESTALE",
1048 __WASI_ETIMEDOUT => "__WASI_ETIMEDOUT",
1049 __WASI_ETXTBSY => "__WASI_ETXTBSY",
1050 __WASI_EXDEV => "__WASI_EXDEV",
1051 __WASI_ENOTCAPABLE => "__WASI_ENOTCAPABLE",
1052 other => panic!("Undefined errno value {:?}", other),
1053 }
1054 }
1055
whence_to_str(whence: __wasi_whence_t) -> &'static str1056 pub fn whence_to_str(whence: __wasi_whence_t) -> &'static str {
1057 match whence {
1058 __WASI_WHENCE_CUR => "__WASI_WHENCE_CUR",
1059 __WASI_WHENCE_END => "__WASI_WHENCE_END",
1060 __WASI_WHENCE_SET => "__WASI_WHENCE_SET",
1061 other => panic!("Undefined whence value {:?}", other),
1062 }
1063 }
1064
1065 // libc constants
1066 pub const INT8_MIN: i32 = -128;
1067 pub const INT16_MIN: i32 = -32768;
1068 pub const INT32_MIN: i32 = -2147483648;
1069 pub const INT8_MAX: u32 = 127;
1070 pub const INT16_MAX: u32 = 32767;
1071 pub const INT32_MAX: u32 = 2147483647;
1072 pub const UINT8_MAX: u32 = 255;
1073 pub const UINT16_MAX: u32 = 65535;
1074 pub const UINT32_MAX: u32 = 4294967295;
1075 pub const INT_LEAST8_MIN: i32 = -128;
1076 pub const INT_LEAST16_MIN: i32 = -32768;
1077 pub const INT_LEAST32_MIN: i32 = -2147483648;
1078 pub const INT_LEAST8_MAX: u32 = 127;
1079 pub const INT_LEAST16_MAX: u32 = 32767;
1080 pub const INT_LEAST32_MAX: u32 = 2147483647;
1081 pub const UINT_LEAST8_MAX: u32 = 255;
1082 pub const UINT_LEAST16_MAX: u32 = 65535;
1083 pub const UINT_LEAST32_MAX: u32 = 4294967295;
1084 pub const INT_FAST8_MIN: i32 = -128;
1085 pub const INT_FAST16_MIN: i32 = -2147483648;
1086 pub const INT_FAST32_MIN: i32 = -2147483648;
1087 pub const INT_FAST8_MAX: u32 = 127;
1088 pub const INT_FAST16_MAX: u32 = 2147483647;
1089 pub const INT_FAST32_MAX: u32 = 2147483647;
1090 pub const UINT_FAST8_MAX: u32 = 255;
1091 pub const UINT_FAST16_MAX: u32 = 4294967295;
1092 pub const UINT_FAST32_MAX: u32 = 4294967295;
1093 pub const INTPTR_MIN: i32 = -2147483648;
1094 pub const INTPTR_MAX: u32 = 2147483647;
1095 pub const UINTPTR_MAX: u32 = 4294967295;
1096 pub const PTRDIFF_MIN: i32 = -2147483648;
1097 pub const PTRDIFF_MAX: u32 = 2147483647;
1098 pub const SIG_ATOMIC_MIN: i32 = -2147483648;
1099 pub const SIG_ATOMIC_MAX: u32 = 2147483647;
1100 pub const SIZE_MAX: u32 = 4294967295;
1101 pub const WINT_MIN: i32 = -2147483648;
1102 pub const WINT_MAX: i32 = 2147483647;
1103
1104 // WASI constants
1105 pub const __WASI_ADVICE_NORMAL: __wasi_advice_t = 0;
1106 pub const __WASI_ADVICE_SEQUENTIAL: __wasi_advice_t = 1;
1107 pub const __WASI_ADVICE_RANDOM: __wasi_advice_t = 2;
1108 pub const __WASI_ADVICE_WILLNEED: __wasi_advice_t = 3;
1109 pub const __WASI_ADVICE_DONTNEED: __wasi_advice_t = 4;
1110 pub const __WASI_ADVICE_NOREUSE: __wasi_advice_t = 5;
1111 pub const __WASI_CLOCK_REALTIME: __wasi_clockid_t = 0;
1112 pub const __WASI_CLOCK_MONOTONIC: __wasi_clockid_t = 1;
1113 pub const __WASI_CLOCK_PROCESS_CPUTIME_ID: __wasi_clockid_t = 2;
1114 pub const __WASI_CLOCK_THREAD_CPUTIME_ID: __wasi_clockid_t = 3;
1115 pub const __WASI_DIRCOOKIE_START: __wasi_dircookie_t = 0;
1116 pub const __WASI_ESUCCESS: __wasi_errno_t = 0;
1117 pub const __WASI_E2BIG: __wasi_errno_t = 1;
1118 pub const __WASI_EACCES: __wasi_errno_t = 2;
1119 pub const __WASI_EADDRINUSE: __wasi_errno_t = 3;
1120 pub const __WASI_EADDRNOTAVAIL: __wasi_errno_t = 4;
1121 pub const __WASI_EAFNOSUPPORT: __wasi_errno_t = 5;
1122 pub const __WASI_EAGAIN: __wasi_errno_t = 6;
1123 pub const __WASI_EALREADY: __wasi_errno_t = 7;
1124 pub const __WASI_EBADF: __wasi_errno_t = 8;
1125 pub const __WASI_EBADMSG: __wasi_errno_t = 9;
1126 pub const __WASI_EBUSY: __wasi_errno_t = 10;
1127 pub const __WASI_ECANCELED: __wasi_errno_t = 11;
1128 pub const __WASI_ECHILD: __wasi_errno_t = 12;
1129 pub const __WASI_ECONNABORTED: __wasi_errno_t = 13;
1130 pub const __WASI_ECONNREFUSED: __wasi_errno_t = 14;
1131 pub const __WASI_ECONNRESET: __wasi_errno_t = 15;
1132 pub const __WASI_EDEADLK: __wasi_errno_t = 16;
1133 pub const __WASI_EDESTADDRREQ: __wasi_errno_t = 17;
1134 pub const __WASI_EDOM: __wasi_errno_t = 18;
1135 pub const __WASI_EDQUOT: __wasi_errno_t = 19;
1136 pub const __WASI_EEXIST: __wasi_errno_t = 20;
1137 pub const __WASI_EFAULT: __wasi_errno_t = 21;
1138 pub const __WASI_EFBIG: __wasi_errno_t = 22;
1139 pub const __WASI_EHOSTUNREACH: __wasi_errno_t = 23;
1140 pub const __WASI_EIDRM: __wasi_errno_t = 24;
1141 pub const __WASI_EILSEQ: __wasi_errno_t = 25;
1142 pub const __WASI_EINPROGRESS: __wasi_errno_t = 26;
1143 pub const __WASI_EINTR: __wasi_errno_t = 27;
1144 pub const __WASI_EINVAL: __wasi_errno_t = 28;
1145 pub const __WASI_EIO: __wasi_errno_t = 29;
1146 pub const __WASI_EISCONN: __wasi_errno_t = 30;
1147 pub const __WASI_EISDIR: __wasi_errno_t = 31;
1148 pub const __WASI_ELOOP: __wasi_errno_t = 32;
1149 pub const __WASI_EMFILE: __wasi_errno_t = 33;
1150 pub const __WASI_EMLINK: __wasi_errno_t = 34;
1151 pub const __WASI_EMSGSIZE: __wasi_errno_t = 35;
1152 pub const __WASI_EMULTIHOP: __wasi_errno_t = 36;
1153 pub const __WASI_ENAMETOOLONG: __wasi_errno_t = 37;
1154 pub const __WASI_ENETDOWN: __wasi_errno_t = 38;
1155 pub const __WASI_ENETRESET: __wasi_errno_t = 39;
1156 pub const __WASI_ENETUNREACH: __wasi_errno_t = 40;
1157 pub const __WASI_ENFILE: __wasi_errno_t = 41;
1158 pub const __WASI_ENOBUFS: __wasi_errno_t = 42;
1159 pub const __WASI_ENODEV: __wasi_errno_t = 43;
1160 pub const __WASI_ENOENT: __wasi_errno_t = 44;
1161 pub const __WASI_ENOEXEC: __wasi_errno_t = 45;
1162 pub const __WASI_ENOLCK: __wasi_errno_t = 46;
1163 pub const __WASI_ENOLINK: __wasi_errno_t = 47;
1164 pub const __WASI_ENOMEM: __wasi_errno_t = 48;
1165 pub const __WASI_ENOMSG: __wasi_errno_t = 49;
1166 pub const __WASI_ENOPROTOOPT: __wasi_errno_t = 50;
1167 pub const __WASI_ENOSPC: __wasi_errno_t = 51;
1168 pub const __WASI_ENOSYS: __wasi_errno_t = 52;
1169 pub const __WASI_ENOTCONN: __wasi_errno_t = 53;
1170 pub const __WASI_ENOTDIR: __wasi_errno_t = 54;
1171 pub const __WASI_ENOTEMPTY: __wasi_errno_t = 55;
1172 pub const __WASI_ENOTRECOVERABLE: __wasi_errno_t = 56;
1173 pub const __WASI_ENOTSOCK: __wasi_errno_t = 57;
1174 pub const __WASI_ENOTSUP: __wasi_errno_t = 58;
1175 pub const __WASI_ENOTTY: __wasi_errno_t = 59;
1176 pub const __WASI_ENXIO: __wasi_errno_t = 60;
1177 pub const __WASI_EOVERFLOW: __wasi_errno_t = 61;
1178 pub const __WASI_EOWNERDEAD: __wasi_errno_t = 62;
1179 pub const __WASI_EPERM: __wasi_errno_t = 63;
1180 pub const __WASI_EPIPE: __wasi_errno_t = 64;
1181 pub const __WASI_EPROTO: __wasi_errno_t = 65;
1182 pub const __WASI_EPROTONOSUPPORT: __wasi_errno_t = 66;
1183 pub const __WASI_EPROTOTYPE: __wasi_errno_t = 67;
1184 pub const __WASI_ERANGE: __wasi_errno_t = 68;
1185 pub const __WASI_EROFS: __wasi_errno_t = 69;
1186 pub const __WASI_ESPIPE: __wasi_errno_t = 70;
1187 pub const __WASI_ESRCH: __wasi_errno_t = 71;
1188 pub const __WASI_ESTALE: __wasi_errno_t = 72;
1189 pub const __WASI_ETIMEDOUT: __wasi_errno_t = 73;
1190 pub const __WASI_ETXTBSY: __wasi_errno_t = 74;
1191 pub const __WASI_EXDEV: __wasi_errno_t = 75;
1192 pub const __WASI_ENOTCAPABLE: __wasi_errno_t = 76;
1193 pub const __WASI_EVENT_FD_READWRITE_HANGUP: __wasi_eventrwflags_t = 1;
1194 pub const __WASI_EVENTTYPE_CLOCK: __wasi_eventtype_t = 0;
1195 pub const __WASI_EVENTTYPE_FD_READ: __wasi_eventtype_t = 1;
1196 pub const __WASI_EVENTTYPE_FD_WRITE: __wasi_eventtype_t = 2;
1197 pub const __WASI_FDFLAG_APPEND: __wasi_fdflags_t = 1;
1198 pub const __WASI_FDFLAG_DSYNC: __wasi_fdflags_t = 2;
1199 pub const __WASI_FDFLAG_NONBLOCK: __wasi_fdflags_t = 4;
1200 pub const __WASI_FDFLAG_RSYNC: __wasi_fdflags_t = 8;
1201 pub const __WASI_FDFLAG_SYNC: __wasi_fdflags_t = 16;
1202 pub const __WASI_PREOPENTYPE_DIR: __wasi_preopentype_t = 0;
1203 pub const __WASI_FILETYPE_UNKNOWN: __wasi_filetype_t = 0;
1204 pub const __WASI_FILETYPE_BLOCK_DEVICE: __wasi_filetype_t = 1;
1205 pub const __WASI_FILETYPE_CHARACTER_DEVICE: __wasi_filetype_t = 2;
1206 pub const __WASI_FILETYPE_DIRECTORY: __wasi_filetype_t = 3;
1207 pub const __WASI_FILETYPE_REGULAR_FILE: __wasi_filetype_t = 4;
1208 pub const __WASI_FILETYPE_SOCKET_DGRAM: __wasi_filetype_t = 5;
1209 pub const __WASI_FILETYPE_SOCKET_STREAM: __wasi_filetype_t = 6;
1210 pub const __WASI_FILETYPE_SYMBOLIC_LINK: __wasi_filetype_t = 7;
1211 pub const __WASI_FILESTAT_SET_ATIM: __wasi_fstflags_t = 1;
1212 pub const __WASI_FILESTAT_SET_ATIM_NOW: __wasi_fstflags_t = 2;
1213 pub const __WASI_FILESTAT_SET_MTIM: __wasi_fstflags_t = 4;
1214 pub const __WASI_FILESTAT_SET_MTIM_NOW: __wasi_fstflags_t = 8;
1215 pub const __WASI_LOOKUP_SYMLINK_FOLLOW: __wasi_lookupflags_t = 1;
1216 pub const __WASI_O_CREAT: __wasi_oflags_t = 1;
1217 pub const __WASI_O_DIRECTORY: __wasi_oflags_t = 2;
1218 pub const __WASI_O_EXCL: __wasi_oflags_t = 4;
1219 pub const __WASI_O_TRUNC: __wasi_oflags_t = 8;
1220 pub const __WASI_SOCK_RECV_PEEK: __wasi_riflags_t = 1;
1221 pub const __WASI_SOCK_RECV_WAITALL: __wasi_riflags_t = 2;
1222 pub const __WASI_RIGHT_FD_DATASYNC: __wasi_rights_t = 1;
1223 pub const __WASI_RIGHT_FD_READ: __wasi_rights_t = 2;
1224 pub const __WASI_RIGHT_FD_SEEK: __wasi_rights_t = 4;
1225 pub const __WASI_RIGHT_FD_FDSTAT_SET_FLAGS: __wasi_rights_t = 8;
1226 pub const __WASI_RIGHT_FD_SYNC: __wasi_rights_t = 16;
1227 pub const __WASI_RIGHT_FD_TELL: __wasi_rights_t = 32;
1228 pub const __WASI_RIGHT_FD_WRITE: __wasi_rights_t = 64;
1229 pub const __WASI_RIGHT_FD_ADVISE: __wasi_rights_t = 128;
1230 pub const __WASI_RIGHT_FD_ALLOCATE: __wasi_rights_t = 256;
1231 pub const __WASI_RIGHT_PATH_CREATE_DIRECTORY: __wasi_rights_t = 512;
1232 pub const __WASI_RIGHT_PATH_CREATE_FILE: __wasi_rights_t = 1024;
1233 pub const __WASI_RIGHT_PATH_LINK_SOURCE: __wasi_rights_t = 2048;
1234 pub const __WASI_RIGHT_PATH_LINK_TARGET: __wasi_rights_t = 4096;
1235 pub const __WASI_RIGHT_PATH_OPEN: __wasi_rights_t = 8192;
1236 pub const __WASI_RIGHT_FD_READDIR: __wasi_rights_t = 16384;
1237 pub const __WASI_RIGHT_PATH_READLINK: __wasi_rights_t = 32768;
1238 pub const __WASI_RIGHT_PATH_RENAME_SOURCE: __wasi_rights_t = 65536;
1239 pub const __WASI_RIGHT_PATH_RENAME_TARGET: __wasi_rights_t = 131072;
1240 pub const __WASI_RIGHT_PATH_FILESTAT_GET: __wasi_rights_t = 262144;
1241 pub const __WASI_RIGHT_PATH_FILESTAT_SET_SIZE: __wasi_rights_t = 524288;
1242 pub const __WASI_RIGHT_PATH_FILESTAT_SET_TIMES: __wasi_rights_t = 1048576;
1243 pub const __WASI_RIGHT_FD_FILESTAT_GET: __wasi_rights_t = 2097152;
1244 pub const __WASI_RIGHT_FD_FILESTAT_SET_SIZE: __wasi_rights_t = 4194304;
1245 pub const __WASI_RIGHT_FD_FILESTAT_SET_TIMES: __wasi_rights_t = 8388608;
1246 pub const __WASI_RIGHT_PATH_SYMLINK: __wasi_rights_t = 16777216;
1247 pub const __WASI_RIGHT_PATH_REMOVE_DIRECTORY: __wasi_rights_t = 33554432;
1248 pub const __WASI_RIGHT_PATH_UNLINK_FILE: __wasi_rights_t = 67108864;
1249 pub const __WASI_RIGHT_POLL_FD_READWRITE: __wasi_rights_t = 134217728;
1250 pub const __WASI_RIGHT_SOCK_SHUTDOWN: __wasi_rights_t = 268435456;
1251 pub const __WASI_SOCK_RECV_DATA_TRUNCATED: __wasi_roflags_t = 1;
1252 pub const __WASI_SHUT_RD: __wasi_sdflags_t = 1;
1253 pub const __WASI_SHUT_WR: __wasi_sdflags_t = 2;
1254 pub const __WASI_SIGHUP: __wasi_signal_t = 1;
1255 pub const __WASI_SIGINT: __wasi_signal_t = 2;
1256 pub const __WASI_SIGQUIT: __wasi_signal_t = 3;
1257 pub const __WASI_SIGILL: __wasi_signal_t = 4;
1258 pub const __WASI_SIGTRAP: __wasi_signal_t = 5;
1259 pub const __WASI_SIGABRT: __wasi_signal_t = 6;
1260 pub const __WASI_SIGBUS: __wasi_signal_t = 7;
1261 pub const __WASI_SIGFPE: __wasi_signal_t = 8;
1262 pub const __WASI_SIGKILL: __wasi_signal_t = 9;
1263 pub const __WASI_SIGUSR1: __wasi_signal_t = 10;
1264 pub const __WASI_SIGSEGV: __wasi_signal_t = 11;
1265 pub const __WASI_SIGUSR2: __wasi_signal_t = 12;
1266 pub const __WASI_SIGPIPE: __wasi_signal_t = 13;
1267 pub const __WASI_SIGALRM: __wasi_signal_t = 14;
1268 pub const __WASI_SIGTERM: __wasi_signal_t = 15;
1269 pub const __WASI_SIGCHLD: __wasi_signal_t = 16;
1270 pub const __WASI_SIGCONT: __wasi_signal_t = 17;
1271 pub const __WASI_SIGSTOP: __wasi_signal_t = 18;
1272 pub const __WASI_SIGTSTP: __wasi_signal_t = 19;
1273 pub const __WASI_SIGTTIN: __wasi_signal_t = 20;
1274 pub const __WASI_SIGTTOU: __wasi_signal_t = 21;
1275 pub const __WASI_SIGURG: __wasi_signal_t = 22;
1276 pub const __WASI_SIGXCPU: __wasi_signal_t = 23;
1277 pub const __WASI_SIGXFSZ: __wasi_signal_t = 24;
1278 pub const __WASI_SIGVTALRM: __wasi_signal_t = 25;
1279 pub const __WASI_SIGPROF: __wasi_signal_t = 26;
1280 pub const __WASI_SIGWINCH: __wasi_signal_t = 27;
1281 pub const __WASI_SIGPOLL: __wasi_signal_t = 28;
1282 pub const __WASI_SIGPWR: __wasi_signal_t = 29;
1283 pub const __WASI_SIGSYS: __wasi_signal_t = 30;
1284 pub const __WASI_SUBSCRIPTION_CLOCK_ABSTIME: __wasi_subclockflags_t = 1;
1285 pub const __WASI_WHENCE_CUR: __wasi_whence_t = 0;
1286 pub const __WASI_WHENCE_END: __wasi_whence_t = 1;
1287 pub const __WASI_WHENCE_SET: __wasi_whence_t = 2;
1288
errno_from_nix(errno: nix::errno::Errno) -> __wasi_errno_t1289 pub fn errno_from_nix(errno: nix::errno::Errno) -> __wasi_errno_t {
1290 match errno {
1291 nix::errno::Errno::EPERM => __WASI_EPERM,
1292 nix::errno::Errno::ENOENT => __WASI_ENOENT,
1293 nix::errno::Errno::ESRCH => __WASI_ESRCH,
1294 nix::errno::Errno::EINTR => __WASI_EINTR,
1295 nix::errno::Errno::EIO => __WASI_EIO,
1296 nix::errno::Errno::ENXIO => __WASI_ENXIO,
1297 nix::errno::Errno::E2BIG => __WASI_E2BIG,
1298 nix::errno::Errno::ENOEXEC => __WASI_ENOEXEC,
1299 nix::errno::Errno::EBADF => __WASI_EBADF,
1300 nix::errno::Errno::ECHILD => __WASI_ECHILD,
1301 nix::errno::Errno::EAGAIN => __WASI_EAGAIN,
1302 nix::errno::Errno::ENOMEM => __WASI_ENOMEM,
1303 nix::errno::Errno::EACCES => __WASI_EACCES,
1304 nix::errno::Errno::EFAULT => __WASI_EFAULT,
1305 nix::errno::Errno::EBUSY => __WASI_EBUSY,
1306 nix::errno::Errno::EEXIST => __WASI_EEXIST,
1307 nix::errno::Errno::EXDEV => __WASI_EXDEV,
1308 nix::errno::Errno::ENODEV => __WASI_ENODEV,
1309 nix::errno::Errno::ENOTDIR => __WASI_ENOTDIR,
1310 nix::errno::Errno::EISDIR => __WASI_EISDIR,
1311 nix::errno::Errno::EINVAL => __WASI_EINVAL,
1312 nix::errno::Errno::ENFILE => __WASI_ENFILE,
1313 nix::errno::Errno::EMFILE => __WASI_EMFILE,
1314 nix::errno::Errno::ENOTTY => __WASI_ENOTTY,
1315 nix::errno::Errno::ETXTBSY => __WASI_ETXTBSY,
1316 nix::errno::Errno::EFBIG => __WASI_EFBIG,
1317 nix::errno::Errno::ENOSPC => __WASI_ENOSPC,
1318 nix::errno::Errno::ESPIPE => __WASI_ESPIPE,
1319 nix::errno::Errno::EROFS => __WASI_EROFS,
1320 nix::errno::Errno::EMLINK => __WASI_EMLINK,
1321 nix::errno::Errno::EPIPE => __WASI_EPIPE,
1322 nix::errno::Errno::EDOM => __WASI_EDOM,
1323 nix::errno::Errno::ERANGE => __WASI_ERANGE,
1324 nix::errno::Errno::EDEADLK => __WASI_EDEADLK,
1325 nix::errno::Errno::ENAMETOOLONG => __WASI_ENAMETOOLONG,
1326 nix::errno::Errno::ENOLCK => __WASI_ENOLCK,
1327 nix::errno::Errno::ENOSYS => __WASI_ENOSYS,
1328 nix::errno::Errno::ENOTEMPTY => __WASI_ENOTEMPTY,
1329 nix::errno::Errno::ELOOP => __WASI_ELOOP,
1330 nix::errno::Errno::ENOMSG => __WASI_ENOMSG,
1331 nix::errno::Errno::EIDRM => __WASI_EIDRM,
1332 nix::errno::Errno::ENOLINK => __WASI_ENOLINK,
1333 nix::errno::Errno::EPROTO => __WASI_EPROTO,
1334 nix::errno::Errno::EMULTIHOP => __WASI_EMULTIHOP,
1335 nix::errno::Errno::EBADMSG => __WASI_EBADMSG,
1336 nix::errno::Errno::EOVERFLOW => __WASI_EOVERFLOW,
1337 nix::errno::Errno::EILSEQ => __WASI_EILSEQ,
1338 nix::errno::Errno::ENOTSOCK => __WASI_ENOTSOCK,
1339 nix::errno::Errno::EDESTADDRREQ => __WASI_EDESTADDRREQ,
1340 nix::errno::Errno::EMSGSIZE => __WASI_EMSGSIZE,
1341 nix::errno::Errno::EPROTOTYPE => __WASI_EPROTOTYPE,
1342 nix::errno::Errno::ENOPROTOOPT => __WASI_ENOPROTOOPT,
1343 nix::errno::Errno::EPROTONOSUPPORT => __WASI_EPROTONOSUPPORT,
1344 nix::errno::Errno::EAFNOSUPPORT => __WASI_EAFNOSUPPORT,
1345 nix::errno::Errno::EADDRINUSE => __WASI_EADDRINUSE,
1346 nix::errno::Errno::EADDRNOTAVAIL => __WASI_EADDRNOTAVAIL,
1347 nix::errno::Errno::ENETDOWN => __WASI_ENETDOWN,
1348 nix::errno::Errno::ENETUNREACH => __WASI_ENETUNREACH,
1349 nix::errno::Errno::ENETRESET => __WASI_ENETRESET,
1350 nix::errno::Errno::ECONNABORTED => __WASI_ECONNABORTED,
1351 nix::errno::Errno::ECONNRESET => __WASI_ECONNRESET,
1352 nix::errno::Errno::ENOBUFS => __WASI_ENOBUFS,
1353 nix::errno::Errno::EISCONN => __WASI_EISCONN,
1354 nix::errno::Errno::ENOTCONN => __WASI_ENOTCONN,
1355 nix::errno::Errno::ETIMEDOUT => __WASI_ETIMEDOUT,
1356 nix::errno::Errno::ECONNREFUSED => __WASI_ECONNREFUSED,
1357 nix::errno::Errno::EHOSTUNREACH => __WASI_EHOSTUNREACH,
1358 nix::errno::Errno::EALREADY => __WASI_EALREADY,
1359 nix::errno::Errno::EINPROGRESS => __WASI_EINPROGRESS,
1360 nix::errno::Errno::ESTALE => __WASI_ESTALE,
1361 nix::errno::Errno::EDQUOT => __WASI_EDQUOT,
1362 nix::errno::Errno::ECANCELED => __WASI_ECANCELED,
1363 nix::errno::Errno::EOWNERDEAD => __WASI_EOWNERDEAD,
1364 nix::errno::Errno::ENOTRECOVERABLE => __WASI_ENOTRECOVERABLE,
1365 _ => __WASI_ENOSYS,
1366 }
1367 }
1368