Debian Codegraph @

debian/missing-sources/libc/src/wasi/mod.rs

raw
1 //! [wasi-libc](https://github.com/WebAssembly/wasi-libc) definitions.
2 //!
3 //! `wasi-libc` project provides multiple libraries including emulated features, but we list only
4 //! basic features with `libc.a` here.
5
6 use core::iter::Iterator;
7
8 use crate::prelude::*;
9
10 pub type intmax_t = i64;
11 pub type uintmax_t = u64;
12 pub type size_t = usize;
13 pub type ssize_t = isize;
14 pub type ptrdiff_t = isize;
15 pub type intptr_t = isize;
16 pub type uintptr_t = usize;
17 pub type off_t = i64;
18 pub type pid_t = i32;
19 pub type clock_t = c_longlong;
20 pub type time_t = c_longlong;
21 pub type ino_t = u64;
22 pub type sigset_t = c_uchar;
23 pub type suseconds_t = c_longlong;
24 pub type mode_t = u32;
25 pub type dev_t = u64;
26 pub type uid_t = u32;
27 pub type gid_t = u32;
28 pub type nlink_t = u64;
29 pub type blksize_t = c_long;
30 pub type blkcnt_t = i64;
31 pub type nfds_t = c_ulong;
32 pub type wchar_t = i32;
33 pub type nl_item = c_int;
34 pub type __wasi_rights_t = u64;
35 pub type locale_t = *mut __locale_struct;
36 pub type pthread_t = *mut c_void;
37 pub type pthread_once_t = c_int;
38 pub type pthread_key_t = c_uint;
39 pub type pthread_spinlock_t = c_int;
40
41 s_no_extra_traits! {
42 #[repr(align(16))]
43 pub struct max_align_t {
44 priv_: [f64; 4],
45 }
46 }
47
48 #[allow(missing_copy_implementations)]
49 #[derive(Debug)]
50 pub enum FILE {}
51 #[allow(missing_copy_implementations)]
52 #[derive(Debug)]
53 pub enum DIR {}
54 #[allow(missing_copy_implementations)]
55 #[derive(Debug)]
56 pub enum __locale_struct {}
57
58 s_paren! {
59 // in wasi-libc clockid_t is const struct __clockid* (where __clockid is an opaque struct),
60 // but that's an implementation detail that we don't want to have to deal with
61 #[repr(transparent)]
62 #[allow(dead_code)]
63 pub struct clockid_t(*const u8);
64 }
65
66 unsafe impl Send for clockid_t {}
67 unsafe impl Sync for clockid_t {}
68
69 s! {
70 #[repr(align(8))]
71 pub struct fpos_t {
72 data: [u8; 16],
73 }
74
75 pub struct tm {
76 pub tm_sec: c_int,
77 pub tm_min: c_int,
78 pub tm_hour: c_int,
79 pub tm_mday: c_int,
80 pub tm_mon: c_int,
81 pub tm_year: c_int,
82 pub tm_wday: c_int,
83 pub tm_yday: c_int,
84 pub tm_isdst: c_int,
85 pub __tm_gmtoff: c_int,
86 pub __tm_zone: *const c_char,
87 pub __tm_nsec: c_int,
88 }
89
90 pub struct timeval {
91 pub tv_sec: time_t,
92 pub tv_usec: suseconds_t,
93 }
94
95 pub struct timespec {
96 pub tv_sec: time_t,
97 pub tv_nsec: c_long,
98 }
99
100 pub struct tms {
101 pub tms_utime: clock_t,
102 pub tms_stime: clock_t,
103 pub tms_cutime: clock_t,
104 pub tms_cstime: clock_t,
105 }
106
107 pub struct itimerspec {
108 pub it_interval: timespec,
109 pub it_value: timespec,
110 }
111
112 pub struct iovec {
113 pub iov_base: *mut c_void,
114 pub iov_len: size_t,
115 }
116
117 pub struct lconv {
118 pub decimal_point: *mut c_char,
119 pub thousands_sep: *mut c_char,
120 pub grouping: *mut c_char,
121 pub int_curr_symbol: *mut c_char,
122 pub currency_symbol: *mut c_char,
123 pub mon_decimal_point: *mut c_char,
124 pub mon_thousands_sep: *mut c_char,
125 pub mon_grouping: *mut c_char,
126 pub positive_sign: *mut c_char,
127 pub negative_sign: *mut c_char,
128 pub int_frac_digits: c_char,
129 pub frac_digits: c_char,
130 pub p_cs_precedes: c_char,
131 pub p_sep_by_space: c_char,
132 pub n_cs_precedes: c_char,
133 pub n_sep_by_space: c_char,
134 pub p_sign_posn: c_char,
135 pub n_sign_posn: c_char,
136 pub int_p_cs_precedes: c_char,
137 pub int_p_sep_by_space: c_char,
138 pub int_n_cs_precedes: c_char,
139 pub int_n_sep_by_space: c_char,
140 pub int_p_sign_posn: c_char,
141 pub int_n_sign_posn: c_char,
142 }
143
144 pub struct pollfd {
145 pub fd: c_int,
146 pub events: c_short,
147 pub revents: c_short,
148 }
149
150 pub struct rusage {
151 pub ru_utime: timeval,
152 pub ru_stime: timeval,
153 }
154
155 pub struct stat {
156 pub st_dev: dev_t,
157 pub st_ino: ino_t,
158 pub st_nlink: nlink_t,
159 pub st_mode: mode_t,
160 pub st_uid: uid_t,
161 pub st_gid: gid_t,
162 __pad0: Padding<c_uint>,
163 pub st_rdev: dev_t,
164 pub st_size: off_t,
165 pub st_blksize: blksize_t,
166 pub st_blocks: blkcnt_t,
167 pub st_atim: timespec,
168 pub st_mtim: timespec,
169 pub st_ctim: timespec,
170 __reserved: Padding<[c_longlong; 3]>,
171 }
172
173 pub struct fd_set {
174 __nfds: usize,
175 __fds: [c_int; FD_SETSIZE as usize],
176 }
177
178 pub struct pthread_attr_t {
179 size: [c_long; 9],
180 }
181
182 pub struct pthread_mutexattr_t {
183 __attr: c_uint,
184 }
185
186 pub struct pthread_condattr_t {
187 __attr: c_uint,
188 }
189
190 pub struct pthread_barrierattr_t {
191 __attr: c_uint,
192 }
193
194 pub struct pthread_rwlockattr_t {
195 __attr: [c_uint; 2],
196 }
197
198 pub struct pthread_cond_t {
199 size: [*mut c_void; 12],
200 }
201
202 pub struct pthread_mutex_t {
203 size: [*mut c_void; 6],
204 }
205
206 pub struct pthread_rwlock_t {
207 size: [*mut c_void; 8],
208 }
209
210 pub struct pthread_barrier_t {
211 size: [*mut c_void; 5],
212 }
213 }
214
215 // Declare dirent outside of s! so that it doesn't implement Copy, Eq, Hash,
216 // etc., since it contains a flexible array member with a dynamic size.
217 #[repr(C)]
218 #[allow(missing_copy_implementations)]
219 #[derive(Debug)]
220 pub struct dirent {
221 pub d_ino: ino_t,
222 pub d_type: c_uchar,
223 /// d_name is declared in WASI libc as a flexible array member, which
224 /// can't be directly expressed in Rust. As an imperfect workaround,
225 /// declare it as a zero-length array instead.
226 pub d_name: [c_char; 0],
227 }
228
229 pub const EXIT_SUCCESS: c_int = 0;
230 pub const EXIT_FAILURE: c_int = 1;
231 pub const STDIN_FILENO: c_int = 0;
232 pub const STDOUT_FILENO: c_int = 1;
233 pub const STDERR_FILENO: c_int = 2;
234 pub const SEEK_SET: c_int = 0;
235 pub const SEEK_CUR: c_int = 1;
236 pub const SEEK_END: c_int = 2;
237 pub const _IOFBF: c_int = 0;
238 pub const _IONBF: c_int = 2;
239 pub const _IOLBF: c_int = 1;
240 pub const F_GETFD: c_int = 1;
241 pub const F_SETFD: c_int = 2;
242 pub const F_GETFL: c_int = 3;
243 pub const F_SETFL: c_int = 4;
244 pub const FD_CLOEXEC: c_int = 1;
245 pub const FD_SETSIZE: size_t = 1024;
246 pub const O_APPEND: c_int = 0x0001;
247 pub const O_DSYNC: c_int = 0x0002;
248 pub const O_NONBLOCK: c_int = 0x0004;
249 pub const O_RSYNC: c_int = 0x0008;
250 pub const O_SYNC: c_int = 0x0010;
251 pub const O_CREAT: c_int = 0x0001 << 12;
252 pub const O_DIRECTORY: c_int = 0x0002 << 12;
253 pub const O_EXCL: c_int = 0x0004 << 12;
254 pub const O_TRUNC: c_int = 0x0008 << 12;
255 pub const O_NOFOLLOW: c_int = 0x01000000;
256 pub const O_EXEC: c_int = 0x02000000;
257 pub const O_RDONLY: c_int = 0x04000000;
258 pub const O_SEARCH: c_int = 0x08000000;
259 pub const O_WRONLY: c_int = 0x10000000;
260 pub const O_CLOEXEC: c_int = 0x0;
261 pub const O_RDWR: c_int = O_WRONLY | O_RDONLY;
262 pub const O_ACCMODE: c_int = O_EXEC | O_RDWR | O_SEARCH;
263 pub const O_NOCTTY: c_int = 0x0;
264 pub const POSIX_FADV_DONTNEED: c_int = 4;
265 pub const POSIX_FADV_NOREUSE: c_int = 5;
266 pub const POSIX_FADV_NORMAL: c_int = 0;
267 pub const POSIX_FADV_RANDOM: c_int = 2;
268 pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
269 pub const POSIX_FADV_WILLNEED: c_int = 3;
270 pub const AT_FDCWD: c_int = -2;
271 pub const AT_EACCESS: c_int = 0x0;
272 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1;
273 pub const AT_SYMLINK_FOLLOW: c_int = 0x2;
274 pub const AT_REMOVEDIR: c_int = 0x4;
275 pub const UTIME_OMIT: c_long = 0xfffffffe;
276 pub const UTIME_NOW: c_long = 0xffffffff;
277 pub const S_IFIFO: mode_t = 0o1_0000;
278 pub const S_IFCHR: mode_t = 0o2_0000;
279 pub const S_IFBLK: mode_t = 0o6_0000;
280 pub const S_IFDIR: mode_t = 0o4_0000;
281 pub const S_IFREG: mode_t = 0o10_0000;
282 pub const S_IFLNK: mode_t = 0o12_0000;
283 pub const S_IFSOCK: mode_t = 0o14_0000;
284 pub const S_IFMT: mode_t = 0o17_0000;
285 pub const S_IRWXO: mode_t = 0o0007;
286 pub const S_IXOTH: mode_t = 0o0001;
287 pub const S_IWOTH: mode_t = 0o0002;
288 pub const S_IROTH: mode_t = 0o0004;
289 pub const S_IRWXG: mode_t = 0o0070;
290 pub const S_IXGRP: mode_t = 0o0010;
291 pub const S_IWGRP: mode_t = 0o0020;
292 pub const S_IRGRP: mode_t = 0o0040;
293 pub const S_IRWXU: mode_t = 0o0700;
294 pub const S_IXUSR: mode_t = 0o0100;
295 pub const S_IWUSR: mode_t = 0o0200;
296 pub const S_IRUSR: mode_t = 0o0400;
297 pub const S_ISVTX: mode_t = 0o1000;
298 pub const S_ISGID: mode_t = 0o2000;
299 pub const S_ISUID: mode_t = 0o4000;
300 pub const DT_UNKNOWN: u8 = 0;
301 pub const DT_BLK: u8 = 1;
302 pub const DT_CHR: u8 = 2;
303 pub const DT_DIR: u8 = 3;
304 pub const DT_REG: u8 = 4;
305 pub const DT_FIFO: u8 = 6;
306 pub const DT_LNK: u8 = 7;
307 pub const DT_SOCK: u8 = 20;
308 pub const FIONREAD: c_int = 1;
309 pub const FIONBIO: c_int = 2;
310 pub const F_OK: c_int = 0;
311 pub const R_OK: c_int = 4;
312 pub const W_OK: c_int = 2;
313 pub const X_OK: c_int = 1;
314 pub const POLLIN: c_short = 0x1;
315 pub const POLLOUT: c_short = 0x2;
316 pub const POLLERR: c_short = 0x1000;
317 pub const POLLHUP: c_short = 0x2000;
318 pub const POLLNVAL: c_short = 0x4000;
319 pub const POLLRDNORM: c_short = 0x1;
320 pub const POLLWRNORM: c_short = 0x2;
321
322 pub const E2BIG: c_int = 1;
323 pub const EACCES: c_int = 2;
324 pub const EADDRINUSE: c_int = 3;
325 pub const EADDRNOTAVAIL: c_int = 4;
326 pub const EAFNOSUPPORT: c_int = 5;
327 pub const EAGAIN: c_int = 6;
328 pub const EALREADY: c_int = 7;
329 pub const EBADF: c_int = 8;
330 pub const EBADMSG: c_int = 9;
331 pub const EBUSY: c_int = 10;
332 pub const ECANCELED: c_int = 11;
333 pub const ECHILD: c_int = 12;
334 pub const ECONNABORTED: c_int = 13;
335 pub const ECONNREFUSED: c_int = 14;
336 pub const ECONNRESET: c_int = 15;
337 pub const EDEADLK: c_int = 16;
338 pub const EDESTADDRREQ: c_int = 17;
339 pub const EDOM: c_int = 18;
340 pub const EDQUOT: c_int = 19;
341 pub const EEXIST: c_int = 20;
342 pub const EFAULT: c_int = 21;
343 pub const EFBIG: c_int = 22;
344 pub const EHOSTUNREACH: c_int = 23;
345 pub const EIDRM: c_int = 24;
346 pub const EILSEQ: c_int = 25;
347 pub const EINPROGRESS: c_int = 26;
348 pub const EINTR: c_int = 27;
349 pub const EINVAL: c_int = 28;
350 pub const EIO: c_int = 29;
351 pub const EISCONN: c_int = 30;
352 pub const EISDIR: c_int = 31;
353 pub const ELOOP: c_int = 32;
354 pub const EMFILE: c_int = 33;
355 pub const EMLINK: c_int = 34;
356 pub const EMSGSIZE: c_int = 35;
357 pub const EMULTIHOP: c_int = 36;
358 pub const ENAMETOOLONG: c_int = 37;
359 pub const ENETDOWN: c_int = 38;
360 pub const ENETRESET: c_int = 39;
361 pub const ENETUNREACH: c_int = 40;
362 pub const ENFILE: c_int = 41;
363 pub const ENOBUFS: c_int = 42;
364 pub const ENODEV: c_int = 43;
365 pub const ENOENT: c_int = 44;
366 pub const ENOEXEC: c_int = 45;
367 pub const ENOLCK: c_int = 46;
368 pub const ENOLINK: c_int = 47;
369 pub const ENOMEM: c_int = 48;
370 pub const ENOMSG: c_int = 49;
371 pub const ENOPROTOOPT: c_int = 50;
372 pub const ENOSPC: c_int = 51;
373 pub const ENOSYS: c_int = 52;
374 pub const ENOTCONN: c_int = 53;
375 pub const ENOTDIR: c_int = 54;
376 pub const ENOTEMPTY: c_int = 55;
377 pub const ENOTRECOVERABLE: c_int = 56;
378 pub const ENOTSOCK: c_int = 57;
379 pub const ENOTSUP: c_int = 58;
380 pub const ENOTTY: c_int = 59;
381 pub const ENXIO: c_int = 60;
382 pub const EOVERFLOW: c_int = 61;
383 pub const EOWNERDEAD: c_int = 62;
384 pub const EPERM: c_int = 63;
385 pub const EPIPE: c_int = 64;
386 pub const EPROTO: c_int = 65;
387 pub const EPROTONOSUPPORT: c_int = 66;
388 pub const EPROTOTYPE: c_int = 67;
389 pub const ERANGE: c_int = 68;
390 pub const EROFS: c_int = 69;
391 pub const ESPIPE: c_int = 70;
392 pub const ESRCH: c_int = 71;
393 pub const ESTALE: c_int = 72;
394 pub const ETIMEDOUT: c_int = 73;
395 pub const ETXTBSY: c_int = 74;
396 pub const EXDEV: c_int = 75;
397 pub const ENOTCAPABLE: c_int = 76;
398 pub const EOPNOTSUPP: c_int = ENOTSUP;
399 pub const EWOULDBLOCK: c_int = EAGAIN;
400
401 pub const _SC_PAGESIZE: c_int = 30;
402 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
403 pub const _SC_IOV_MAX: c_int = 60;
404 pub const _SC_SYMLOOP_MAX: c_int = 173;
405
406 // FIXME(msrv): `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
407 #[allow(unused_unsafe)]
408 pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
409 #[allow(unused_unsafe)]
410 pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
411
412 pub const ABDAY_1: crate::nl_item = 0x20000;
413 pub const ABDAY_2: crate::nl_item = 0x20001;
414 pub const ABDAY_3: crate::nl_item = 0x20002;
415 pub const ABDAY_4: crate::nl_item = 0x20003;
416 pub const ABDAY_5: crate::nl_item = 0x20004;
417 pub const ABDAY_6: crate::nl_item = 0x20005;
418 pub const ABDAY_7: crate::nl_item = 0x20006;
419
420 pub const DAY_1: crate::nl_item = 0x20007;
421 pub const DAY_2: crate::nl_item = 0x20008;
422 pub const DAY_3: crate::nl_item = 0x20009;
423 pub const DAY_4: crate::nl_item = 0x2000A;
424 pub const DAY_5: crate::nl_item = 0x2000B;
425 pub const DAY_6: crate::nl_item = 0x2000C;
426 pub const DAY_7: crate::nl_item = 0x2000D;
427
428 pub const ABMON_1: crate::nl_item = 0x2000E;
429 pub const ABMON_2: crate::nl_item = 0x2000F;
430 pub const ABMON_3: crate::nl_item = 0x20010;
431 pub const ABMON_4: crate::nl_item = 0x20011;
432 pub const ABMON_5: crate::nl_item = 0x20012;
433 pub const ABMON_6: crate::nl_item = 0x20013;
434 pub const ABMON_7: crate::nl_item = 0x20014;
435 pub const ABMON_8: crate::nl_item = 0x20015;
436 pub const ABMON_9: crate::nl_item = 0x20016;
437 pub const ABMON_10: crate::nl_item = 0x20017;
438 pub const ABMON_11: crate::nl_item = 0x20018;
439 pub const ABMON_12: crate::nl_item = 0x20019;
440
441 pub const MON_1: crate::nl_item = 0x2001A;
442 pub const MON_2: crate::nl_item = 0x2001B;
443 pub const MON_3: crate::nl_item = 0x2001C;
444 pub const MON_4: crate::nl_item = 0x2001D;
445 pub const MON_5: crate::nl_item = 0x2001E;
446 pub const MON_6: crate::nl_item = 0x2001F;
447 pub const MON_7: crate::nl_item = 0x20020;
448 pub const MON_8: crate::nl_item = 0x20021;
449 pub const MON_9: crate::nl_item = 0x20022;
450 pub const MON_10: crate::nl_item = 0x20023;
451 pub const MON_11: crate::nl_item = 0x20024;
452 pub const MON_12: crate::nl_item = 0x20025;
453
454 pub const AM_STR: crate::nl_item = 0x20026;
455 pub const PM_STR: crate::nl_item = 0x20027;
456
457 pub const D_T_FMT: crate::nl_item = 0x20028;
458 pub const D_FMT: crate::nl_item = 0x20029;
459 pub const T_FMT: crate::nl_item = 0x2002A;
460 pub const T_FMT_AMPM: crate::nl_item = 0x2002B;
461
462 pub const ERA: crate::nl_item = 0x2002C;
463 pub const ERA_D_FMT: crate::nl_item = 0x2002E;
464 pub const ALT_DIGITS: crate::nl_item = 0x2002F;
465 pub const ERA_D_T_FMT: crate::nl_item = 0x20030;
466 pub const ERA_T_FMT: crate::nl_item = 0x20031;
467
468 pub const CODESET: crate::nl_item = 14;
469 pub const CRNCYSTR: crate::nl_item = 0x4000F;
470 pub const RADIXCHAR: crate::nl_item = 0x10000;
471 pub const THOUSEP: crate::nl_item = 0x10001;
472 pub const YESEXPR: crate::nl_item = 0x50000;
473 pub const NOEXPR: crate::nl_item = 0x50001;
474 pub const YESSTR: crate::nl_item = 0x50002;
475 pub const NOSTR: crate::nl_item = 0x50003;
476
477 pub const PTHREAD_STACK_MIN: usize = 2048;
478 pub const TIMER_ABSTIME: c_int = 1;
479
480 f! {
481 pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
482 let set = &*set;
483 let n = set.__nfds;
484 return set.__fds[..n].iter().any(|p| *p == fd);
485 }
486
487 pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
488 let set = &mut *set;
489 let n = set.__nfds;
490 if !set.__fds[..n].iter().any(|p| *p == fd) {
491 set.__nfds = n + 1;
492 set.__fds[n] = fd;
493 }
494 }
495
496 pub fn FD_ZERO(set: *mut fd_set) -> () {
497 (*set).__nfds = 0;
498 return;
499 }
500 }
501
502 #[cfg_attr(
503 feature = "rustc-dep-of-std",
504 link(
505 name = "c",
506 kind = "static",
507 modifiers = "-bundle",
508 cfg(target_feature = "crt-static")
509 )
510 )]
511 #[cfg_attr(
512 feature = "rustc-dep-of-std",
513 link(name = "c", cfg(not(target_feature = "crt-static")))
514 )]
515 extern "C" {
516 pub fn _Exit(code: c_int) -> !;
517 pub fn _exit(code: c_int) -> !;
518 pub fn abort() -> !;
519 pub fn aligned_alloc(a: size_t, b: size_t) -> *mut c_void;
520 pub fn calloc(amt: size_t, amt2: size_t) -> *mut c_void;
521 pub fn exit(code: c_int) -> !;
522 pub fn free(ptr: *mut c_void);
523 pub fn getenv(s: *const c_char) -> *mut c_char;
524 pub fn malloc(amt: size_t) -> *mut c_void;
525 pub fn malloc_usable_size(ptr: *mut c_void) -> size_t;
526 pub fn sbrk(increment: intptr_t) -> *mut c_void;
527 pub fn rand() -> c_int;
528 pub fn read(fd: c_int, ptr: *mut c_void, size: size_t) -> ssize_t;
529 pub fn realloc(ptr: *mut c_void, amt: size_t) -> *mut c_void;
530 pub fn setenv(k: *const c_char, v: *const c_char, a: c_int) -> c_int;
531 pub fn unsetenv(k: *const c_char) -> c_int;
532 pub fn clearenv() -> c_int;
533 pub fn write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t;
534 pub static mut environ: *mut *mut c_char;
535 pub fn fopen(a: *const c_char, b: *const c_char) -> *mut FILE;
536 pub fn freopen(a: *const c_char, b: *const c_char, f: *mut FILE) -> *mut FILE;
537 pub fn fclose(f: *mut FILE) -> c_int;
538 pub fn remove(a: *const c_char) -> c_int;
539 pub fn rename(a: *const c_char, b: *const c_char) -> c_int;
540 pub fn feof(f: *mut FILE) -> c_int;
541 pub fn ferror(f: *mut FILE) -> c_int;
542 pub fn fflush(f: *mut FILE) -> c_int;
543 pub fn clearerr(f: *mut FILE);
544 pub fn fseek(f: *mut FILE, b: c_long, c: c_int) -> c_int;
545 pub fn ftell(f: *mut FILE) -> c_long;
546 pub fn rewind(f: *mut FILE);
547 pub fn fgetpos(f: *mut FILE, pos: *mut fpos_t) -> c_int;
548 pub fn fsetpos(f: *mut FILE, pos: *const fpos_t) -> c_int;
549 pub fn fread(buf: *mut c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t;
550 pub fn fwrite(buf: *const c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t;
551 pub fn fgetc(f: *mut FILE) -> c_int;
552 pub fn getc(f: *mut FILE) -> c_int;
553 pub fn getchar() -> c_int;
554 pub fn ungetc(a: c_int, f: *mut FILE) -> c_int;
555 pub fn fputc(a: c_int, f: *mut FILE) -> c_int;
556 pub fn putc(a: c_int, f: *mut FILE) -> c_int;
557 pub fn putchar(a: c_int) -> c_int;
558 pub fn fputs(a: *const c_char, f: *mut FILE) -> c_int;
559 pub fn puts(a: *const c_char) -> c_int;
560 pub fn perror(a: *const c_char);
561 pub fn srand(a: c_uint);
562 pub fn atexit(a: extern "C" fn()) -> c_int;
563 pub fn at_quick_exit(a: extern "C" fn()) -> c_int;
564 pub fn quick_exit(a: c_int) -> !;
565 pub fn posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int;
566 pub fn rand_r(a: *mut c_uint) -> c_int;
567 pub fn random() -> c_long;
568 pub fn srandom(a: c_uint);
569 pub fn putenv(a: *mut c_char) -> c_int;
570 pub fn clock() -> clock_t;
571 pub fn time(a: *mut time_t) -> time_t;
572 pub fn difftime(a: time_t, b: time_t) -> c_double;
573 pub fn mktime(a: *mut tm) -> time_t;
574 pub fn strftime(a: *mut c_char, b: size_t, c: *const c_char, d: *const tm) -> size_t;
575 pub fn gmtime(a: *const time_t) -> *mut tm;
576 pub fn gmtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
577 pub fn localtime(a: *const time_t) -> *mut tm;
578 pub fn localtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
579 pub fn asctime_r(a: *const tm, b: *mut c_char) -> *mut c_char;
580 pub fn ctime_r(a: *const time_t, b: *mut c_char) -> *mut c_char;
581
582 static _CLOCK_MONOTONIC: u8;
583 static _CLOCK_REALTIME: u8;
584 pub fn nanosleep(a: *const timespec, b: *mut timespec) -> c_int;
585 pub fn clock_getres(a: clockid_t, b: *mut timespec) -> c_int;
586 pub fn clock_gettime(a: clockid_t, b: *mut timespec) -> c_int;
587 pub fn clock_nanosleep(a: clockid_t, a2: c_int, b: *const timespec, c: *mut timespec) -> c_int;
588
589 pub fn isalnum(c: c_int) -> c_int;
590 pub fn isalpha(c: c_int) -> c_int;
591 pub fn iscntrl(c: c_int) -> c_int;
592 pub fn isdigit(c: c_int) -> c_int;
593 pub fn isgraph(c: c_int) -> c_int;
594 pub fn islower(c: c_int) -> c_int;
595 pub fn isprint(c: c_int) -> c_int;
596 pub fn ispunct(c: c_int) -> c_int;
597 pub fn isspace(c: c_int) -> c_int;
598 pub fn isupper(c: c_int) -> c_int;
599 pub fn isxdigit(c: c_int) -> c_int;
600 pub fn isblank(c: c_int) -> c_int;
601 pub fn tolower(c: c_int) -> c_int;
602 pub fn toupper(c: c_int) -> c_int;
603 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
604 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
605 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
606 pub fn atof(s: *const c_char) -> c_double;
607 pub fn atoi(s: *const c_char) -> c_int;
608 pub fn atol(s: *const c_char) -> c_long;
609 pub fn atoll(s: *const c_char) -> c_longlong;
610 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
611 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
612 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
613 pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
614 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
615 pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
616
617 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
618 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
619 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
620 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
621 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
622 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
623 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
624 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
625 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
626 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
627 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
628 pub fn strdup(cs: *const c_char) -> *mut c_char;
629 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
630 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
631 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
632 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
633 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
634 pub fn strlen(cs: *const c_char) -> size_t;
635 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
636 pub fn strerror(n: c_int) -> *mut c_char;
637 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
638 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
639
640 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
641 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
642 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
643 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
644 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
645
646 pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
647 pub fn printf(format: *const c_char, ...) -> c_int;
648 pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int;
649 pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
650 pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
651 pub fn scanf(format: *const c_char, ...) -> c_int;
652 pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int;
653 pub fn getchar_unlocked() -> c_int;
654 pub fn putchar_unlocked(c: c_int) -> c_int;
655
656 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
657 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
658 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
659 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
660 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE;
661 pub fn fileno(stream: *mut crate::FILE) -> c_int;
662 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
663 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
664 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
665 pub fn opendir(dirname: *const c_char) -> *mut crate::DIR;
666 pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
667 pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent;
668 pub fn closedir(dirp: *mut crate::DIR) -> c_int;
669 pub fn rewinddir(dirp: *mut crate::DIR);
670 pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
671 pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
672 pub fn telldir(dirp: *mut crate::DIR) -> c_long;
673
674 pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
675 pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
676 pub fn linkat(
677 olddirfd: c_int,
678 oldpath: *const c_char,
679 newdirfd: c_int,
680 newpath: *const c_char,
681 flags: c_int,
682 ) -> c_int;
683 pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
684 pub fn readlinkat(
685 dirfd: c_int,
686 pathname: *const c_char,
687 buf: *mut c_char,
688 bufsiz: size_t,
689 ) -> ssize_t;
690 pub fn renameat(
691 olddirfd: c_int,
692 oldpath: *const c_char,
693 newdirfd: c_int,
694 newpath: *const c_char,
695 ) -> c_int;
696 pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int;
697 pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int;
698
699 pub fn access(path: *const c_char, amode: c_int) -> c_int;
700 pub fn close(fd: c_int) -> c_int;
701 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
702 pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int;
703 pub fn isatty(fd: c_int) -> c_int;
704 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
705 pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
706 pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
707 pub fn rmdir(path: *const c_char) -> c_int;
708 pub fn sleep(secs: c_uint) -> c_uint;
709 pub fn unlink(c: *const c_char) -> c_int;
710 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t;
711 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t;
712
713 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
714
715 pub fn fsync(fd: c_int) -> c_int;
716 pub fn fdatasync(fd: c_int) -> c_int;
717
718 pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int;
719
720 pub fn truncate(path: *const c_char, length: off_t) -> c_int;
721 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
722
723 pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
724
725 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
726 pub fn times(buf: *mut crate::tms) -> crate::clock_t;
727
728 pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
729
730 pub fn usleep(secs: c_uint) -> c_int;
731 pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t;
732 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t, flags: c_int) -> ssize_t;
733 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
734 pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
735 pub fn localeconv() -> *mut lconv;
736
737 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> ssize_t;
738
739 pub fn timegm(tm: *mut crate::tm) -> time_t;
740
741 pub fn sysconf(name: c_int) -> c_long;
742
743 pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
744
745 pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int;
746 pub fn ftello(stream: *mut crate::FILE) -> off_t;
747 pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
748
749 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
750 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
751
752 pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
753 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
754 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
755 pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
756 pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
757 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
758 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
759 pub fn utimensat(
760 dirfd: c_int,
761 path: *const c_char,
762 times: *const crate::timespec,
763 flag: c_int,
764 ) -> c_int;
765 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
766 pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
767 pub fn abs(i: c_int) -> c_int;
768 pub fn labs(i: c_long) -> c_long;
769 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
770 pub fn freelocale(loc: crate::locale_t);
771 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
772 pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
773 pub fn sched_yield() -> c_int;
774 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
775 pub fn chdir(dir: *const c_char) -> c_int;
776
777 pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
778 pub fn nl_langinfo_l(item: crate::nl_item, loc: crate::locale_t) -> *mut c_char;
779
780 pub fn select(
781 nfds: c_int,
782 readfds: *mut fd_set,
783 writefds: *mut fd_set,
784 errorfds: *mut fd_set,
785 timeout: *const timeval,
786 ) -> c_int;
787
788 #[cfg(target_env = "p1")]
789 pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int;
790 pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int;
791 pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int;
792 pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
793 pub fn __wasilibc_find_relpath(
794 path: *const c_char,
795 abs_prefix: *mut *const c_char,
796 relative_path: *mut *mut c_char,
797 relative_path_len: usize,
798 ) -> c_int;
799 pub fn __wasilibc_tell(fd: c_int) -> off_t;
800 pub fn __wasilibc_nocwd___wasilibc_unlinkat(dirfd: c_int, path: *const c_char) -> c_int;
801 pub fn __wasilibc_nocwd___wasilibc_rmdirat(dirfd: c_int, path: *const c_char) -> c_int;
802 pub fn __wasilibc_nocwd_linkat(
803 olddirfd: c_int,
804 oldpath: *const c_char,
805 newdirfd: c_int,
806 newpath: *const c_char,
807 flags: c_int,
808 ) -> c_int;
809 pub fn __wasilibc_nocwd_symlinkat(
810 target: *const c_char,
811 dirfd: c_int,
812 path: *const c_char,
813 ) -> c_int;
814 pub fn __wasilibc_nocwd_readlinkat(
815 dirfd: c_int,
816 path: *const c_char,
817 buf: *mut c_char,
818 bufsize: usize,
819 ) -> isize;
820 pub fn __wasilibc_nocwd_faccessat(
821 dirfd: c_int,
822 path: *const c_char,
823 mode: c_int,
824 flags: c_int,
825 ) -> c_int;
826 pub fn __wasilibc_nocwd_renameat(
827 olddirfd: c_int,
828 oldpath: *const c_char,
829 newdirfd: c_int,
830 newpath: *const c_char,
831 ) -> c_int;
832 pub fn __wasilibc_nocwd_openat_nomode(dirfd: c_int, path: *const c_char, flags: c_int)
833 -> c_int;
834 pub fn __wasilibc_nocwd_fstatat(
835 dirfd: c_int,
836 path: *const c_char,
837 buf: *mut stat,
838 flags: c_int,
839 ) -> c_int;
840 pub fn __wasilibc_nocwd_mkdirat_nomode(dirfd: c_int, path: *const c_char) -> c_int;
841 pub fn __wasilibc_nocwd_utimensat(
842 dirfd: c_int,
843 path: *const c_char,
844 times: *const crate::timespec,
845 flags: c_int,
846 ) -> c_int;
847 pub fn __wasilibc_nocwd_opendirat(dirfd: c_int, path: *const c_char) -> *mut crate::DIR;
848 pub fn __wasilibc_access(pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
849 pub fn __wasilibc_stat(pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
850 pub fn __wasilibc_utimens(
851 pathname: *const c_char,
852 times: *const crate::timespec,
853 flags: c_int,
854 ) -> c_int;
855 pub fn __wasilibc_link(oldpath: *const c_char, newpath: *const c_char, flags: c_int) -> c_int;
856 pub fn __wasilibc_link_oldat(
857 olddirfd: c_int,
858 oldpath: *const c_char,
859 newpath: *const c_char,
860 flags: c_int,
861 ) -> c_int;
862 pub fn __wasilibc_link_newat(
863 oldpath: *const c_char,
864 newdirfd: c_int,
865 newpath: *const c_char,
866 flags: c_int,
867 ) -> c_int;
868 pub fn __wasilibc_rename_oldat(
869 olddirfd: c_int,
870 oldpath: *const c_char,
871 newpath: *const c_char,
872 ) -> c_int;
873 pub fn __wasilibc_rename_newat(
874 oldpath: *const c_char,
875 newdirfd: c_int,
876 newpath: *const c_char,
877 ) -> c_int;
878
879 pub fn arc4random() -> u32;
880 pub fn arc4random_buf(a: *mut c_void, b: size_t);
881 pub fn arc4random_uniform(a: u32) -> u32;
882
883 pub fn __errno_location() -> *mut c_int;
884
885 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
886 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
887 pub fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char;
888
889 pub fn pthread_self() -> pthread_t;
890 pub fn pthread_create(
891 native: *mut pthread_t,
892 attr: *const pthread_attr_t,
893 f: extern "C" fn(*mut c_void) -> *mut c_void,
894 value: *mut c_void,
895 ) -> c_int;
896 pub fn pthread_equal(t1: pthread_t, t2: pthread_t) -> c_int;
897 pub fn pthread_join(native: pthread_t, value: *mut *mut c_void) -> c_int;
898 pub fn pthread_attr_init(attr: *mut pthread_attr_t) -> c_int;
899 pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int;
900 pub fn pthread_attr_getstacksize(attr: *const pthread_attr_t, stacksize: *mut size_t) -> c_int;
901 pub fn pthread_attr_setstacksize(attr: *mut pthread_attr_t, stack_size: size_t) -> c_int;
902 pub fn pthread_attr_setdetachstate(attr: *mut pthread_attr_t, state: c_int) -> c_int;
903 pub fn pthread_detach(thread: pthread_t) -> c_int;
904
905 pub fn pthread_key_create(
906 key: *mut pthread_key_t,
907 dtor: Option<unsafe extern "C" fn(*mut c_void)>,
908 ) -> c_int;
909 pub fn pthread_key_delete(key: pthread_key_t) -> c_int;
910 pub fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
911 pub fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int;
912 pub fn pthread_mutex_init(
913 lock: *mut pthread_mutex_t,
914 attr: *const pthread_mutexattr_t,
915 ) -> c_int;
916 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int;
917 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int;
918 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int;
919 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int;
920
921 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
922 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
923 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int;
924
925 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int;
926 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int;
927 pub fn pthread_cond_timedwait(
928 cond: *mut pthread_cond_t,
929 lock: *mut pthread_mutex_t,
930 abstime: *const timespec,
931 ) -> c_int;
932 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int;
933 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int;
934 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
935 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> c_int;
936 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> c_int;
937
938 pub fn pthread_rwlock_init(
939 lock: *mut pthread_rwlock_t,
940 attr: *const pthread_rwlockattr_t,
941 ) -> c_int;
942 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> c_int;
943 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> c_int;
944 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> c_int;
945 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> c_int;
946 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> c_int;
947 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> c_int;
948 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> c_int;
949 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> c_int;
950 }
951
952 cfg_if! {
953 if #[cfg(not(target_env = "p1"))] {
954 mod p2;
955 pub use self::p2::*;
956 }
957 }