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