| 1 |
use crate::prelude::*; |
| 2 |
|
| 3 |
// This module contains bindings to the native Haiku API. The Haiku API |
| 4 |
// originates from BeOS, and it was the original way to perform low level |
| 5 |
// system and IO operations. The POSIX API was in that era was like a |
| 6 |
// compatibility layer. In current Haiku development, both the POSIX API and |
| 7 |
// the Haiku API are considered to be co-equal status. However, they are not |
| 8 |
// integrated like they are on other UNIX platforms, which means that for many |
| 9 |
// low level concepts there are two versions, like processes (POSIX) and |
| 10 |
// teams (Haiku), or pthreads and native threads. |
| 11 |
// |
| 12 |
// Both the POSIX API and the Haiku API live in libroot.so, the library that is |
| 13 |
// linked to any binary by default. Additionally, Haiku supports several |
| 14 |
// non-POSIX APIs from BSD and GNU, which live in libbsd.so and libgnu.so. These |
| 15 |
// modules are also supported. |
| 16 |
// |
| 17 |
// The module is comprised of the following files: |
| 18 |
// - `mod.rs` (this file) implements the C11 and POSIX API found in |
| 19 |
// `headers/posix` |
| 20 |
// - `b32.rs`, `b64.rs` and `x86_64.rs` contain platform-specific definitions |
| 21 |
// of the C11 and POSIX APIs |
| 22 |
// - `native.rs` defines the native Haiku API that is implemented in |
| 23 |
// `libroot.so` and that are found in `headers/os`. |
| 24 |
// - `bsd.rs` defines the BSD customizations available on Haiku found in |
| 25 |
// `headers/compatibility/bsd` |
| 26 |
|
| 27 |
pub type rlim_t = crate::uintptr_t; |
| 28 |
pub type sa_family_t = u8; |
| 29 |
pub type pthread_key_t = c_int; |
| 30 |
pub type nfds_t = c_ulong; |
| 31 |
pub type tcflag_t = c_uint; |
| 32 |
pub type speed_t = c_uchar; |
| 33 |
pub type clock_t = i32; |
| 34 |
pub type clockid_t = i32; |
| 35 |
pub type suseconds_t = i32; |
| 36 |
pub type wchar_t = i32; |
| 37 |
pub type off_t = i64; |
| 38 |
pub type ino_t = i64; |
| 39 |
pub type blkcnt_t = i64; |
| 40 |
pub type blksize_t = i32; |
| 41 |
pub type dev_t = i32; |
| 42 |
pub type mode_t = u32; |
| 43 |
pub type nlink_t = i32; |
| 44 |
pub type useconds_t = u32; |
| 45 |
pub type socklen_t = u32; |
| 46 |
pub type pthread_t = crate::uintptr_t; |
| 47 |
pub type pthread_condattr_t = crate::uintptr_t; |
| 48 |
pub type pthread_mutexattr_t = crate::uintptr_t; |
| 49 |
pub type pthread_rwlockattr_t = crate::uintptr_t; |
| 50 |
pub type sigset_t = u64; |
| 51 |
pub type fsblkcnt_t = i64; |
| 52 |
pub type fsfilcnt_t = i64; |
| 53 |
pub type pthread_attr_t = *mut c_void; |
| 54 |
pub type nl_item = c_int; |
| 55 |
pub type id_t = i32; |
| 56 |
pub type idtype_t = c_int; |
| 57 |
pub type fd_mask = u32; |
| 58 |
pub type regoff_t = c_int; |
| 59 |
pub type key_t = i32; |
| 60 |
pub type msgqnum_t = u32; |
| 61 |
pub type msglen_t = u32; |
| 62 |
|
| 63 |
pub type Elf32_Addr = u32; |
| 64 |
pub type Elf32_Half = u16; |
| 65 |
pub type Elf32_Off = u32; |
| 66 |
pub type Elf32_Sword = i32; |
| 67 |
pub type Elf32_Word = u32; |
| 68 |
|
| 69 |
pub type Elf64_Addr = u64; |
| 70 |
pub type Elf64_Half = u16; |
| 71 |
pub type Elf64_Off = u64; |
| 72 |
pub type Elf64_Sword = i32; |
| 73 |
pub type Elf64_Sxword = i64; |
| 74 |
pub type Elf64_Word = u32; |
| 75 |
pub type Elf64_Xword = u64; |
| 76 |
|
| 77 |
pub type ENTRY = entry; |
| 78 |
pub type ACTION = c_int; |
| 79 |
|
| 80 |
pub type posix_spawnattr_t = *mut c_void; |
| 81 |
pub type posix_spawn_file_actions_t = *mut c_void; |
| 82 |
|
| 83 |
extern_ty! { |
| 84 |
pub type timezone; |
| 85 |
} |
| 86 |
|
| 87 |
impl siginfo_t { |
| 88 |
pub unsafe fn si_addr(&self) -> *mut c_void { |
| 89 |
self.si_addr |
| 90 |
} |
| 91 |
|
| 92 |
pub unsafe fn si_pid(&self) -> crate::pid_t { |
| 93 |
self.si_pid |
| 94 |
} |
| 95 |
|
| 96 |
pub unsafe fn si_uid(&self) -> crate::uid_t { |
| 97 |
self.si_uid |
| 98 |
} |
| 99 |
|
| 100 |
pub unsafe fn si_status(&self) -> c_int { |
| 101 |
self.si_status |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
s! { |
| 106 |
pub struct in_addr { |
| 107 |
pub s_addr: crate::in_addr_t, |
| 108 |
} |
| 109 |
|
| 110 |
pub struct ip_mreq { |
| 111 |
pub imr_multiaddr: in_addr, |
| 112 |
pub imr_interface: in_addr, |
| 113 |
} |
| 114 |
|
| 115 |
pub struct sockaddr { |
| 116 |
pub sa_len: u8, |
| 117 |
pub sa_family: sa_family_t, |
| 118 |
pub sa_data: [u8; 30], |
| 119 |
} |
| 120 |
|
| 121 |
pub struct sockaddr_in { |
| 122 |
pub sin_len: u8, |
| 123 |
pub sin_family: sa_family_t, |
| 124 |
pub sin_port: crate::in_port_t, |
| 125 |
pub sin_addr: crate::in_addr, |
| 126 |
pub sin_zero: [i8; 24], |
| 127 |
} |
| 128 |
|
| 129 |
pub struct sockaddr_in6 { |
| 130 |
pub sin6_len: u8, |
| 131 |
pub sin6_family: u8, |
| 132 |
pub sin6_port: u16, |
| 133 |
pub sin6_flowinfo: u32, |
| 134 |
pub sin6_addr: crate::in6_addr, |
| 135 |
pub sin6_scope_id: u32, |
| 136 |
} |
| 137 |
|
| 138 |
pub struct addrinfo { |
| 139 |
pub ai_flags: c_int, |
| 140 |
pub ai_family: c_int, |
| 141 |
pub ai_socktype: c_int, |
| 142 |
pub ai_protocol: c_int, |
| 143 |
pub ai_addrlen: socklen_t, |
| 144 |
pub ai_canonname: *mut c_char, |
| 145 |
pub ai_addr: *mut crate::sockaddr, |
| 146 |
pub ai_next: *mut addrinfo, |
| 147 |
} |
| 148 |
|
| 149 |
pub struct ifaddrs { |
| 150 |
pub ifa_next: *mut ifaddrs, |
| 151 |
pub ifa_name: *const c_char, |
| 152 |
pub ifa_flags: c_uint, |
| 153 |
pub ifa_addr: *mut crate::sockaddr, |
| 154 |
pub ifa_netmask: *mut crate::sockaddr, |
| 155 |
pub ifa_dstaddr: *mut crate::sockaddr, |
| 156 |
pub ifa_data: *mut c_void, |
| 157 |
} |
| 158 |
|
| 159 |
pub struct fd_set { |
| 160 |
// size for 1024 bits, and a fd_mask with size u32 |
| 161 |
fds_bits: [fd_mask; 32], |
| 162 |
} |
| 163 |
|
| 164 |
pub struct tm { |
| 165 |
pub tm_sec: c_int, |
| 166 |
pub tm_min: c_int, |
| 167 |
pub tm_hour: c_int, |
| 168 |
pub tm_mday: c_int, |
| 169 |
pub tm_mon: c_int, |
| 170 |
pub tm_year: c_int, |
| 171 |
pub tm_wday: c_int, |
| 172 |
pub tm_yday: c_int, |
| 173 |
pub tm_isdst: c_int, |
| 174 |
pub tm_gmtoff: c_int, |
| 175 |
pub tm_zone: *mut c_char, |
| 176 |
} |
| 177 |
|
| 178 |
pub struct utsname { |
| 179 |
pub sysname: [c_char; 32], |
| 180 |
pub nodename: [c_char; 32], |
| 181 |
pub release: [c_char; 32], |
| 182 |
pub version: [c_char; 32], |
| 183 |
pub machine: [c_char; 32], |
| 184 |
} |
| 185 |
|
| 186 |
pub struct lconv { |
| 187 |
pub decimal_point: *mut c_char, |
| 188 |
pub thousands_sep: *mut c_char, |
| 189 |
pub grouping: *mut c_char, |
| 190 |
pub int_curr_symbol: *mut c_char, |
| 191 |
pub currency_symbol: *mut c_char, |
| 192 |
pub mon_decimal_point: *mut c_char, |
| 193 |
pub mon_thousands_sep: *mut c_char, |
| 194 |
pub mon_grouping: *mut c_char, |
| 195 |
pub positive_sign: *mut c_char, |
| 196 |
pub negative_sign: *mut c_char, |
| 197 |
pub int_frac_digits: c_char, |
| 198 |
pub frac_digits: c_char, |
| 199 |
pub p_cs_precedes: c_char, |
| 200 |
pub p_sep_by_space: c_char, |
| 201 |
pub n_cs_precedes: c_char, |
| 202 |
pub n_sep_by_space: c_char, |
| 203 |
pub p_sign_posn: c_char, |
| 204 |
pub n_sign_posn: c_char, |
| 205 |
pub int_p_cs_precedes: c_char, |
| 206 |
pub int_p_sep_by_space: c_char, |
| 207 |
pub int_n_cs_precedes: c_char, |
| 208 |
pub int_n_sep_by_space: c_char, |
| 209 |
pub int_p_sign_posn: c_char, |
| 210 |
pub int_n_sign_posn: c_char, |
| 211 |
} |
| 212 |
|
| 213 |
pub struct msghdr { |
| 214 |
pub msg_name: *mut c_void, |
| 215 |
pub msg_namelen: socklen_t, |
| 216 |
pub msg_iov: *mut crate::iovec, |
| 217 |
pub msg_iovlen: c_int, |
| 218 |
pub msg_control: *mut c_void, |
| 219 |
pub msg_controllen: socklen_t, |
| 220 |
pub msg_flags: c_int, |
| 221 |
} |
| 222 |
|
| 223 |
pub struct cmsghdr { |
| 224 |
pub cmsg_len: crate::socklen_t, |
| 225 |
pub cmsg_level: c_int, |
| 226 |
pub cmsg_type: c_int, |
| 227 |
} |
| 228 |
|
| 229 |
pub struct Dl_info { |
| 230 |
pub dli_fname: *const c_char, |
| 231 |
pub dli_fbase: *mut c_void, |
| 232 |
pub dli_sname: *const c_char, |
| 233 |
pub dli_saddr: *mut c_void, |
| 234 |
} |
| 235 |
|
| 236 |
pub struct termios { |
| 237 |
pub c_iflag: crate::tcflag_t, |
| 238 |
pub c_oflag: crate::tcflag_t, |
| 239 |
pub c_cflag: crate::tcflag_t, |
| 240 |
pub c_lflag: crate::tcflag_t, |
| 241 |
pub c_line: c_char, |
| 242 |
pub c_ispeed: crate::speed_t, |
| 243 |
pub c_ospeed: crate::speed_t, |
| 244 |
pub c_cc: [crate::cc_t; crate::NCCS], |
| 245 |
} |
| 246 |
|
| 247 |
pub struct flock { |
| 248 |
pub l_type: c_short, |
| 249 |
pub l_whence: c_short, |
| 250 |
pub l_start: off_t, |
| 251 |
pub l_len: off_t, |
| 252 |
pub l_pid: crate::pid_t, |
| 253 |
} |
| 254 |
|
| 255 |
pub struct stat { |
| 256 |
pub st_dev: dev_t, |
| 257 |
pub st_ino: ino_t, |
| 258 |
pub st_mode: mode_t, |
| 259 |
pub st_nlink: nlink_t, |
| 260 |
pub st_uid: crate::uid_t, |
| 261 |
pub st_gid: crate::gid_t, |
| 262 |
pub st_size: off_t, |
| 263 |
pub st_rdev: dev_t, |
| 264 |
pub st_blksize: blksize_t, |
| 265 |
pub st_atime: time_t, |
| 266 |
pub st_atime_nsec: c_long, |
| 267 |
pub st_mtime: time_t, |
| 268 |
pub st_mtime_nsec: c_long, |
| 269 |
pub st_ctime: time_t, |
| 270 |
pub st_ctime_nsec: c_long, |
| 271 |
pub st_crtime: time_t, |
| 272 |
pub st_crtime_nsec: c_long, |
| 273 |
pub st_type: u32, |
| 274 |
pub st_blocks: blkcnt_t, |
| 275 |
} |
| 276 |
|
| 277 |
pub struct glob_t { |
| 278 |
pub gl_pathc: size_t, |
| 279 |
__unused1: Padding<size_t>, |
| 280 |
pub gl_offs: size_t, |
| 281 |
__unused2: Padding<size_t>, |
| 282 |
pub gl_pathv: *mut *mut c_char, |
| 283 |
|
| 284 |
__unused3: Padding<*mut c_void>, |
| 285 |
__unused4: Padding<*mut c_void>, |
| 286 |
__unused5: Padding<*mut c_void>, |
| 287 |
__unused6: Padding<*mut c_void>, |
| 288 |
__unused7: Padding<*mut c_void>, |
| 289 |
__unused8: Padding<*mut c_void>, |
| 290 |
} |
| 291 |
|
| 292 |
pub struct pthread_mutex_t { |
| 293 |
flags: u32, |
| 294 |
lock: i32, |
| 295 |
unused: Padding<i32>, |
| 296 |
owner: i32, |
| 297 |
owner_count: i32, |
| 298 |
} |
| 299 |
|
| 300 |
pub struct pthread_cond_t { |
| 301 |
flags: u32, |
| 302 |
unused: Padding<i32>, |
| 303 |
mutex: *mut c_void, |
| 304 |
waiter_count: i32, |
| 305 |
lock: i32, |
| 306 |
} |
| 307 |
|
| 308 |
pub struct pthread_rwlock_t { |
| 309 |
flags: u32, |
| 310 |
owner: i32, |
| 311 |
lock_sem: i32, // this is actually a union |
| 312 |
lock_count: i32, |
| 313 |
reader_count: i32, |
| 314 |
writer_count: i32, |
| 315 |
waiters: [*mut c_void; 2], |
| 316 |
} |
| 317 |
|
| 318 |
pub struct pthread_spinlock_t { |
| 319 |
lock: u32, |
| 320 |
} |
| 321 |
|
| 322 |
pub struct passwd { |
| 323 |
pub pw_name: *mut c_char, |
| 324 |
pub pw_passwd: *mut c_char, |
| 325 |
pub pw_uid: crate::uid_t, |
| 326 |
pub pw_gid: crate::gid_t, |
| 327 |
pub pw_dir: *mut c_char, |
| 328 |
pub pw_shell: *mut c_char, |
| 329 |
pub pw_gecos: *mut c_char, |
| 330 |
} |
| 331 |
|
| 332 |
pub struct statvfs { |
| 333 |
pub f_bsize: c_ulong, |
| 334 |
pub f_frsize: c_ulong, |
| 335 |
pub f_blocks: crate::fsblkcnt_t, |
| 336 |
pub f_bfree: crate::fsblkcnt_t, |
| 337 |
pub f_bavail: crate::fsblkcnt_t, |
| 338 |
pub f_files: crate::fsfilcnt_t, |
| 339 |
pub f_ffree: crate::fsfilcnt_t, |
| 340 |
pub f_favail: crate::fsfilcnt_t, |
| 341 |
pub f_fsid: c_ulong, |
| 342 |
pub f_flag: c_ulong, |
| 343 |
pub f_namemax: c_ulong, |
| 344 |
} |
| 345 |
|
| 346 |
pub struct stack_t { |
| 347 |
pub ss_sp: *mut c_void, |
| 348 |
pub ss_size: size_t, |
| 349 |
pub ss_flags: c_int, |
| 350 |
} |
| 351 |
|
| 352 |
pub struct siginfo_t { |
| 353 |
pub si_signo: c_int, |
| 354 |
pub si_code: c_int, |
| 355 |
pub si_errno: c_int, |
| 356 |
pub si_pid: crate::pid_t, |
| 357 |
pub si_uid: crate::uid_t, |
| 358 |
pub si_addr: *mut c_void, |
| 359 |
pub si_status: c_int, |
| 360 |
pub si_band: c_long, |
| 361 |
pub sigval: *mut c_void, |
| 362 |
} |
| 363 |
|
| 364 |
pub struct sigaction { |
| 365 |
pub sa_sigaction: crate::sighandler_t, //actually a union with sa_handler |
| 366 |
pub sa_mask: crate::sigset_t, |
| 367 |
pub sa_flags: c_int, |
| 368 |
sa_userdata: *mut c_void, |
| 369 |
} |
| 370 |
|
| 371 |
pub struct sem_t { |
| 372 |
pub type_: i32, |
| 373 |
pub named_sem_id: i32, // actually a union with unnamed_sem (i32) |
| 374 |
padding: Padding<[i32; 2]>, |
| 375 |
} |
| 376 |
|
| 377 |
pub struct ucred { |
| 378 |
pub pid: crate::pid_t, |
| 379 |
pub uid: crate::uid_t, |
| 380 |
pub gid: crate::gid_t, |
| 381 |
} |
| 382 |
|
| 383 |
pub struct sockaddr_dl { |
| 384 |
pub sdl_len: u8, |
| 385 |
pub sdl_family: u8, |
| 386 |
pub sdl_e_type: u16, |
| 387 |
pub sdl_index: u32, |
| 388 |
pub sdl_type: u8, |
| 389 |
pub sdl_nlen: u8, |
| 390 |
pub sdl_alen: u8, |
| 391 |
pub sdl_slen: u8, |
| 392 |
pub sdl_data: [u8; 46], |
| 393 |
} |
| 394 |
|
| 395 |
pub struct spwd { |
| 396 |
pub sp_namp: *mut c_char, |
| 397 |
pub sp_pwdp: *mut c_char, |
| 398 |
pub sp_lstchg: c_int, |
| 399 |
pub sp_min: c_int, |
| 400 |
pub sp_max: c_int, |
| 401 |
pub sp_warn: c_int, |
| 402 |
pub sp_inact: c_int, |
| 403 |
pub sp_expire: c_int, |
| 404 |
pub sp_flag: c_int, |
| 405 |
} |
| 406 |
|
| 407 |
pub struct regex_t { |
| 408 |
__buffer: *mut c_void, |
| 409 |
__allocated: size_t, |
| 410 |
__used: size_t, |
| 411 |
__syntax: c_ulong, |
| 412 |
__fastmap: *mut c_char, |
| 413 |
__translate: *mut c_char, |
| 414 |
__re_nsub: size_t, |
| 415 |
__bitfield: u8, |
| 416 |
} |
| 417 |
|
| 418 |
pub struct regmatch_t { |
| 419 |
pub rm_so: regoff_t, |
| 420 |
pub rm_eo: regoff_t, |
| 421 |
} |
| 422 |
|
| 423 |
pub struct msqid_ds { |
| 424 |
pub msg_perm: crate::ipc_perm, |
| 425 |
pub msg_qnum: crate::msgqnum_t, |
| 426 |
pub msg_qbytes: crate::msglen_t, |
| 427 |
pub msg_lspid: crate::pid_t, |
| 428 |
pub msg_lrpid: crate::pid_t, |
| 429 |
pub msg_stime: crate::time_t, |
| 430 |
pub msg_rtime: crate::time_t, |
| 431 |
pub msg_ctime: crate::time_t, |
| 432 |
} |
| 433 |
|
| 434 |
pub struct ipc_perm { |
| 435 |
pub key: crate::key_t, |
| 436 |
pub uid: crate::uid_t, |
| 437 |
pub gid: crate::gid_t, |
| 438 |
pub cuid: crate::uid_t, |
| 439 |
pub cgid: crate::gid_t, |
| 440 |
pub mode: mode_t, |
| 441 |
} |
| 442 |
|
| 443 |
pub struct sembuf { |
| 444 |
pub sem_num: c_ushort, |
| 445 |
pub sem_op: c_short, |
| 446 |
pub sem_flg: c_short, |
| 447 |
} |
| 448 |
|
| 449 |
pub struct entry { |
| 450 |
pub key: *mut c_char, |
| 451 |
pub data: *mut c_void, |
| 452 |
} |
| 453 |
|
| 454 |
pub struct option { |
| 455 |
pub name: *const c_char, |
| 456 |
pub has_arg: c_int, |
| 457 |
pub flag: *mut c_int, |
| 458 |
pub val: c_int, |
| 459 |
} |
| 460 |
|
| 461 |
pub struct sockaddr_un { |
| 462 |
pub sun_len: u8, |
| 463 |
pub sun_family: sa_family_t, |
| 464 |
pub sun_path: [c_char; 126], |
| 465 |
} |
| 466 |
pub struct sockaddr_storage { |
| 467 |
pub ss_len: u8, |
| 468 |
pub ss_family: sa_family_t, |
| 469 |
__ss_pad1: Padding<[u8; 6]>, |
| 470 |
__ss_pad2: Padding<u64>, |
| 471 |
__ss_pad3: Padding<[u8; 112]>, |
| 472 |
} |
| 473 |
pub struct dirent { |
| 474 |
pub d_dev: dev_t, |
| 475 |
pub d_pdev: dev_t, |
| 476 |
pub d_ino: ino_t, |
| 477 |
pub d_pino: i64, |
| 478 |
pub d_reclen: c_ushort, |
| 479 |
pub d_name: [c_char; 1024], // Max length is _POSIX_PATH_MAX |
| 480 |
} |
| 481 |
|
| 482 |
pub struct sigevent { |
| 483 |
pub sigev_notify: c_int, |
| 484 |
pub sigev_signo: c_int, |
| 485 |
pub sigev_value: crate::sigval, |
| 486 |
__unused1: Padding<*mut c_void>, // actually a function pointer |
| 487 |
pub sigev_notify_attributes: *mut crate::pthread_attr_t, |
| 488 |
} |
| 489 |
|
| 490 |
pub struct utmpx { |
| 491 |
pub ut_type: c_short, |
| 492 |
pub ut_tv: crate::timeval, |
| 493 |
pub ut_id: [c_char; 8], |
| 494 |
pub ut_pid: crate::pid_t, |
| 495 |
pub ut_user: [c_char; 32], |
| 496 |
pub ut_line: [c_char; 16], |
| 497 |
pub ut_host: [c_char; 128], |
| 498 |
__ut_reserved: Padding<[c_char; 64]>, |
| 499 |
} |
| 500 |
} |
| 501 |
|
| 502 |
pub const EXIT_FAILURE: c_int = 1; |
| 503 |
pub const EXIT_SUCCESS: c_int = 0; |
| 504 |
pub const RAND_MAX: c_int = 2147483647; |
| 505 |
pub const EOF: c_int = -1; |
| 506 |
pub const SEEK_SET: c_int = 0; |
| 507 |
pub const SEEK_CUR: c_int = 1; |
| 508 |
pub const SEEK_END: c_int = 2; |
| 509 |
pub const L_SET: c_int = SEEK_SET; |
| 510 |
pub const L_INCR: c_int = SEEK_CUR; |
| 511 |
pub const L_XTND: c_int = SEEK_END; |
| 512 |
pub const _IOFBF: c_int = 0; |
| 513 |
pub const _IONBF: c_int = 2; |
| 514 |
pub const _IOLBF: c_int = 1; |
| 515 |
|
| 516 |
pub const F_DUPFD: c_int = 0x0001; |
| 517 |
pub const F_GETFD: c_int = 0x0002; |
| 518 |
pub const F_SETFD: c_int = 0x0004; |
| 519 |
pub const F_GETFL: c_int = 0x0008; |
| 520 |
pub const F_SETFL: c_int = 0x0010; |
| 521 |
pub const F_GETLK: c_int = 0x0020; |
| 522 |
pub const F_SETLK: c_int = 0x0080; |
| 523 |
pub const F_SETLKW: c_int = 0x0100; |
| 524 |
pub const F_DUPFD_CLOEXEC: c_int = 0x0200; |
| 525 |
|
| 526 |
pub const F_RDLCK: c_int = 0x0040; |
| 527 |
pub const F_UNLCK: c_int = 0x0200; |
| 528 |
pub const F_WRLCK: c_int = 0x0400; |
| 529 |
|
| 530 |
pub const AT_FDCWD: c_int = -100; |
| 531 |
pub const AT_SYMLINK_NOFOLLOW: c_int = 0x01; |
| 532 |
pub const AT_SYMLINK_FOLLOW: c_int = 0x02; |
| 533 |
pub const AT_REMOVEDIR: c_int = 0x04; |
| 534 |
pub const AT_EACCESS: c_int = 0x08; |
| 535 |
|
| 536 |
pub const POLLIN: c_short = 0x0001; |
| 537 |
pub const POLLOUT: c_short = 0x0002; |
| 538 |
pub const POLLRDNORM: c_short = POLLIN; |
| 539 |
pub const POLLWRNORM: c_short = POLLOUT; |
| 540 |
pub const POLLRDBAND: c_short = 0x0008; |
| 541 |
pub const POLLWRBAND: c_short = 0x0010; |
| 542 |
pub const POLLPRI: c_short = 0x0020; |
| 543 |
pub const POLLERR: c_short = 0x0004; |
| 544 |
pub const POLLHUP: c_short = 0x0080; |
| 545 |
pub const POLLNVAL: c_short = 0x1000; |
| 546 |
|
| 547 |
pub const PTHREAD_CREATE_JOINABLE: c_int = 0; |
| 548 |
pub const PTHREAD_CREATE_DETACHED: c_int = 1; |
| 549 |
|
| 550 |
pub const CLOCK_REALTIME: c_int = -1; |
| 551 |
pub const CLOCK_MONOTONIC: c_int = 0; |
| 552 |
pub const CLOCK_PROCESS_CPUTIME_ID: c_int = -2; |
| 553 |
pub const CLOCK_THREAD_CPUTIME_ID: c_int = -3; |
| 554 |
|
| 555 |
pub const RLIMIT_CORE: c_int = 0; |
| 556 |
pub const RLIMIT_CPU: c_int = 1; |
| 557 |
pub const RLIMIT_DATA: c_int = 2; |
| 558 |
pub const RLIMIT_FSIZE: c_int = 3; |
| 559 |
pub const RLIMIT_NOFILE: c_int = 4; |
| 560 |
pub const RLIMIT_STACK: c_int = 5; |
| 561 |
pub const RLIMIT_AS: c_int = 6; |
| 562 |
pub const RLIM_INFINITY: crate::rlim_t = 0xffffffff; |
| 563 |
// Haiku specific |
| 564 |
pub const RLIMIT_NOVMON: c_int = 7; |
| 565 |
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 566 |
pub const RLIM_NLIMITS: c_int = 8; |
| 567 |
|
| 568 |
pub const RUSAGE_SELF: c_int = 0; |
| 569 |
|
| 570 |
pub const RTLD_LAZY: c_int = 0; |
| 571 |
|
| 572 |
pub const NCCS: usize = 11; |
| 573 |
|
| 574 |
pub const O_RDONLY: c_int = 0x0000; |
| 575 |
pub const O_WRONLY: c_int = 0x0001; |
| 576 |
pub const O_RDWR: c_int = 0x0002; |
| 577 |
pub const O_ACCMODE: c_int = 0x0003; |
| 578 |
|
| 579 |
pub const O_EXCL: c_int = 0x0100; |
| 580 |
pub const O_CREAT: c_int = 0x0200; |
| 581 |
pub const O_TRUNC: c_int = 0x0400; |
| 582 |
pub const O_NOCTTY: c_int = 0x1000; |
| 583 |
pub const O_NOTRAVERSE: c_int = 0x2000; |
| 584 |
|
| 585 |
pub const O_CLOEXEC: c_int = 0x00000040; |
| 586 |
pub const O_NONBLOCK: c_int = 0x00000080; |
| 587 |
pub const O_APPEND: c_int = 0x00000800; |
| 588 |
pub const O_SYNC: c_int = 0x00010000; |
| 589 |
pub const O_RSYNC: c_int = 0x00020000; |
| 590 |
pub const O_DSYNC: c_int = 0x00040000; |
| 591 |
pub const O_NOFOLLOW: c_int = 0x00080000; |
| 592 |
pub const O_NOCACHE: c_int = 0x00100000; |
| 593 |
pub const O_DIRECTORY: c_int = 0x00200000; |
| 594 |
|
| 595 |
pub const S_IFIFO: mode_t = 0o1_0000; |
| 596 |
pub const S_IFCHR: mode_t = 0o2_0000; |
| 597 |
pub const S_IFBLK: mode_t = 0o6_0000; |
| 598 |
pub const S_IFDIR: mode_t = 0o4_0000; |
| 599 |
pub const S_IFREG: mode_t = 0o10_0000; |
| 600 |
pub const S_IFLNK: mode_t = 0o12_0000; |
| 601 |
pub const S_IFSOCK: mode_t = 0o14_0000; |
| 602 |
pub const S_IFMT: mode_t = 0o17_0000; |
| 603 |
|
| 604 |
pub const S_IRWXU: mode_t = 0o0700; |
| 605 |
pub const S_IRUSR: mode_t = 0o0400; |
| 606 |
pub const S_IWUSR: mode_t = 0o0200; |
| 607 |
pub const S_IXUSR: mode_t = 0o0100; |
| 608 |
pub const S_IRWXG: mode_t = 0o0070; |
| 609 |
pub const S_IRGRP: mode_t = 0o0040; |
| 610 |
pub const S_IWGRP: mode_t = 0o0020; |
| 611 |
pub const S_IXGRP: mode_t = 0o0010; |
| 612 |
pub const S_IRWXO: mode_t = 0o0007; |
| 613 |
pub const S_IROTH: mode_t = 0o0004; |
| 614 |
pub const S_IWOTH: mode_t = 0o0002; |
| 615 |
pub const S_IXOTH: mode_t = 0o0001; |
| 616 |
|
| 617 |
pub const F_OK: c_int = 0; |
| 618 |
pub const R_OK: c_int = 4; |
| 619 |
pub const W_OK: c_int = 2; |
| 620 |
pub const X_OK: c_int = 1; |
| 621 |
|
| 622 |
pub const SIGHUP: c_int = 1; |
| 623 |
pub const SIGINT: c_int = 2; |
| 624 |
pub const SIGQUIT: c_int = 3; |
| 625 |
pub const SIGILL: c_int = 4; |
| 626 |
pub const SIGCHLD: c_int = 5; |
| 627 |
pub const SIGABRT: c_int = 6; |
| 628 |
pub const SIGPIPE: c_int = 7; |
| 629 |
pub const SIGFPE: c_int = 8; |
| 630 |
pub const SIGKILL: c_int = 9; |
| 631 |
pub const SIGSTOP: c_int = 10; |
| 632 |
pub const SIGSEGV: c_int = 11; |
| 633 |
pub const SIGCONT: c_int = 12; |
| 634 |
pub const SIGTSTP: c_int = 13; |
| 635 |
pub const SIGALRM: c_int = 14; |
| 636 |
pub const SIGTERM: c_int = 15; |
| 637 |
pub const SIGTTIN: c_int = 16; |
| 638 |
pub const SIGTTOU: c_int = 17; |
| 639 |
pub const SIGUSR1: c_int = 18; |
| 640 |
pub const SIGUSR2: c_int = 19; |
| 641 |
pub const SIGWINCH: c_int = 20; |
| 642 |
pub const SIGKILLTHR: c_int = 21; |
| 643 |
pub const SIGTRAP: c_int = 22; |
| 644 |
pub const SIGPOLL: c_int = 23; |
| 645 |
pub const SIGPROF: c_int = 24; |
| 646 |
pub const SIGSYS: c_int = 25; |
| 647 |
pub const SIGURG: c_int = 26; |
| 648 |
pub const SIGVTALRM: c_int = 27; |
| 649 |
pub const SIGXCPU: c_int = 28; |
| 650 |
pub const SIGXFSZ: c_int = 29; |
| 651 |
pub const SIGBUS: c_int = 30; |
| 652 |
|
| 653 |
pub const SIG_BLOCK: c_int = 1; |
| 654 |
pub const SIG_UNBLOCK: c_int = 2; |
| 655 |
pub const SIG_SETMASK: c_int = 3; |
| 656 |
|
| 657 |
pub const SIGEV_NONE: c_int = 0; |
| 658 |
pub const SIGEV_SIGNAL: c_int = 1; |
| 659 |
pub const SIGEV_THREAD: c_int = 2; |
| 660 |
|
| 661 |
pub const EAI_AGAIN: c_int = 2; |
| 662 |
pub const EAI_BADFLAGS: c_int = 3; |
| 663 |
pub const EAI_FAIL: c_int = 4; |
| 664 |
pub const EAI_FAMILY: c_int = 5; |
| 665 |
pub const EAI_MEMORY: c_int = 6; |
| 666 |
pub const EAI_NODATA: c_int = 7; |
| 667 |
pub const EAI_NONAME: c_int = 8; |
| 668 |
pub const EAI_SERVICE: c_int = 9; |
| 669 |
pub const EAI_SOCKTYPE: c_int = 10; |
| 670 |
pub const EAI_SYSTEM: c_int = 11; |
| 671 |
pub const EAI_OVERFLOW: c_int = 14; |
| 672 |
|
| 673 |
pub const PROT_NONE: c_int = 0; |
| 674 |
pub const PROT_READ: c_int = 1; |
| 675 |
pub const PROT_WRITE: c_int = 2; |
| 676 |
pub const PROT_EXEC: c_int = 4; |
| 677 |
|
| 678 |
pub const LC_ALL: c_int = 0; |
| 679 |
pub const LC_COLLATE: c_int = 1; |
| 680 |
pub const LC_CTYPE: c_int = 2; |
| 681 |
pub const LC_MONETARY: c_int = 3; |
| 682 |
pub const LC_NUMERIC: c_int = 4; |
| 683 |
pub const LC_TIME: c_int = 5; |
| 684 |
pub const LC_MESSAGES: c_int = 6; |
| 685 |
|
| 686 |
// FIXME(haiku): Haiku does not have MAP_FILE, but library/std/os.rs requires it |
| 687 |
pub const MAP_FILE: c_int = 0x00; |
| 688 |
pub const MAP_SHARED: c_int = 0x01; |
| 689 |
pub const MAP_PRIVATE: c_int = 0x02; |
| 690 |
pub const MAP_FIXED: c_int = 0x04; |
| 691 |
pub const MAP_ANONYMOUS: c_int = 0x08; |
| 692 |
pub const MAP_NORESERVE: c_int = 0x10; |
| 693 |
pub const MAP_ANON: c_int = MAP_ANONYMOUS; |
| 694 |
|
| 695 |
pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; |
| 696 |
|
| 697 |
pub const MS_ASYNC: c_int = 0x01; |
| 698 |
pub const MS_INVALIDATE: c_int = 0x04; |
| 699 |
pub const MS_SYNC: c_int = 0x02; |
| 700 |
|
| 701 |
pub const E2BIG: c_int = -2147454975; |
| 702 |
pub const ECHILD: c_int = -2147454974; |
| 703 |
pub const EDEADLK: c_int = -2147454973; |
| 704 |
pub const EFBIG: c_int = -2147454972; |
| 705 |
pub const EMLINK: c_int = -2147454971; |
| 706 |
pub const ENFILE: c_int = -2147454970; |
| 707 |
pub const ENODEV: c_int = -2147454969; |
| 708 |
pub const ENOLCK: c_int = -2147454968; |
| 709 |
pub const ENOSYS: c_int = -2147454967; |
| 710 |
pub const ENOTTY: c_int = -2147454966; |
| 711 |
pub const ENXIO: c_int = -2147454965; |
| 712 |
pub const ESPIPE: c_int = -2147454964; |
| 713 |
pub const ESRCH: c_int = -2147454963; |
| 714 |
pub const EFPOS: c_int = -2147454962; |
| 715 |
pub const ESIGPARM: c_int = -2147454961; |
| 716 |
pub const EDOM: c_int = -2147454960; |
| 717 |
pub const ERANGE: c_int = -2147454959; |
| 718 |
pub const EPROTOTYPE: c_int = -2147454958; |
| 719 |
pub const EPROTONOSUPPORT: c_int = -2147454957; |
| 720 |
pub const EPFNOSUPPORT: c_int = -2147454956; |
| 721 |
pub const EAFNOSUPPORT: c_int = -2147454955; |
| 722 |
pub const EADDRINUSE: c_int = -2147454954; |
| 723 |
pub const EADDRNOTAVAIL: c_int = -2147454953; |
| 724 |
pub const ENETDOWN: c_int = -2147454952; |
| 725 |
pub const ENETUNREACH: c_int = -2147454951; |
| 726 |
pub const ENETRESET: c_int = -2147454950; |
| 727 |
pub const ECONNABORTED: c_int = -2147454949; |
| 728 |
pub const ECONNRESET: c_int = -2147454948; |
| 729 |
pub const EISCONN: c_int = -2147454947; |
| 730 |
pub const ENOTCONN: c_int = -2147454946; |
| 731 |
pub const ESHUTDOWN: c_int = -2147454945; |
| 732 |
pub const ECONNREFUSED: c_int = -2147454944; |
| 733 |
pub const EHOSTUNREACH: c_int = -2147454943; |
| 734 |
pub const ENOPROTOOPT: c_int = -2147454942; |
| 735 |
pub const ENOBUFS: c_int = -2147454941; |
| 736 |
pub const EINPROGRESS: c_int = -2147454940; |
| 737 |
pub const EALREADY: c_int = -2147454939; |
| 738 |
pub const EILSEQ: c_int = -2147454938; |
| 739 |
pub const ENOMSG: c_int = -2147454937; |
| 740 |
pub const ESTALE: c_int = -2147454936; |
| 741 |
pub const EOVERFLOW: c_int = -2147454935; |
| 742 |
pub const EMSGSIZE: c_int = -2147454934; |
| 743 |
pub const EOPNOTSUPP: c_int = -2147454933; |
| 744 |
pub const ENOTSOCK: c_int = -2147454932; |
| 745 |
pub const EHOSTDOWN: c_int = -2147454931; |
| 746 |
pub const EBADMSG: c_int = -2147454930; |
| 747 |
pub const ECANCELED: c_int = -2147454929; |
| 748 |
pub const EDESTADDRREQ: c_int = -2147454928; |
| 749 |
pub const EDQUOT: c_int = -2147454927; |
| 750 |
pub const EIDRM: c_int = -2147454926; |
| 751 |
pub const EMULTIHOP: c_int = -2147454925; |
| 752 |
pub const ENODATA: c_int = -2147454924; |
| 753 |
pub const ENOLINK: c_int = -2147454923; |
| 754 |
pub const ENOSR: c_int = -2147454922; |
| 755 |
pub const ENOSTR: c_int = -2147454921; |
| 756 |
pub const ENOTSUP: c_int = -2147454920; |
| 757 |
pub const EPROTO: c_int = -2147454919; |
| 758 |
pub const ETIME: c_int = -2147454918; |
| 759 |
pub const ETXTBSY: c_int = -2147454917; |
| 760 |
pub const ENOATTR: c_int = -2147454916; |
| 761 |
|
| 762 |
// INT_MIN |
| 763 |
pub const ENOMEM: c_int = -2147483648; |
| 764 |
|
| 765 |
// POSIX errors that can be mapped to BeOS error codes |
| 766 |
pub const EACCES: c_int = -2147483646; |
| 767 |
pub const EINTR: c_int = -2147483638; |
| 768 |
pub const EIO: c_int = -2147483647; |
| 769 |
pub const EBUSY: c_int = -2147483634; |
| 770 |
pub const EFAULT: c_int = -2147478783; |
| 771 |
pub const ETIMEDOUT: c_int = -2147483639; |
| 772 |
pub const EAGAIN: c_int = -2147483637; |
| 773 |
pub const EWOULDBLOCK: c_int = -2147483637; |
| 774 |
pub const EBADF: c_int = -2147459072; |
| 775 |
pub const EEXIST: c_int = -2147459070; |
| 776 |
pub const EINVAL: c_int = -2147483643; |
| 777 |
pub const ENAMETOOLONG: c_int = -2147459068; |
| 778 |
pub const ENOENT: c_int = -2147459069; |
| 779 |
pub const EPERM: c_int = -2147483633; |
| 780 |
pub const ENOTDIR: c_int = -2147459067; |
| 781 |
pub const EISDIR: c_int = -2147459063; |
| 782 |
pub const ENOTEMPTY: c_int = -2147459066; |
| 783 |
pub const ENOSPC: c_int = -2147459065; |
| 784 |
pub const EROFS: c_int = -2147459064; |
| 785 |
pub const EMFILE: c_int = -2147459062; |
| 786 |
pub const EXDEV: c_int = -2147459061; |
| 787 |
pub const ELOOP: c_int = -2147459060; |
| 788 |
pub const ENOEXEC: c_int = -2147478782; |
| 789 |
pub const EPIPE: c_int = -2147459059; |
| 790 |
|
| 791 |
pub const IPPROTO_RAW: c_int = 255; |
| 792 |
|
| 793 |
// These are prefixed with POSIX_ on Haiku |
| 794 |
pub const MADV_NORMAL: c_int = 1; |
| 795 |
pub const MADV_SEQUENTIAL: c_int = 2; |
| 796 |
pub const MADV_RANDOM: c_int = 3; |
| 797 |
pub const MADV_WILLNEED: c_int = 4; |
| 798 |
pub const MADV_DONTNEED: c_int = 5; |
| 799 |
pub const MADV_FREE: c_int = 6; |
| 800 |
|
| 801 |
// https://github.com/haiku/haiku/blob/HEAD/headers/posix/net/if.h#L80 |
| 802 |
pub const IFF_UP: c_int = 0x0001; |
| 803 |
pub const IFF_BROADCAST: c_int = 0x0002; // valid broadcast address |
| 804 |
pub const IFF_LOOPBACK: c_int = 0x0008; |
| 805 |
pub const IFF_POINTOPOINT: c_int = 0x0010; // point-to-point link |
| 806 |
pub const IFF_NOARP: c_int = 0x0040; // no address resolution |
| 807 |
pub const IFF_AUTOUP: c_int = 0x0080; // auto dial |
| 808 |
pub const IFF_PROMISC: c_int = 0x0100; // receive all packets |
| 809 |
pub const IFF_ALLMULTI: c_int = 0x0200; // receive all multicast packets |
| 810 |
pub const IFF_SIMPLEX: c_int = 0x0800; // doesn't receive own transmissions |
| 811 |
pub const IFF_LINK: c_int = 0x1000; // has link |
| 812 |
pub const IFF_AUTO_CONFIGURED: c_int = 0x2000; |
| 813 |
pub const IFF_CONFIGURING: c_int = 0x4000; |
| 814 |
pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast |
| 815 |
|
| 816 |
pub const AF_UNSPEC: c_int = 0; |
| 817 |
pub const AF_INET: c_int = 1; |
| 818 |
pub const AF_APPLETALK: c_int = 2; |
| 819 |
pub const AF_ROUTE: c_int = 3; |
| 820 |
pub const AF_LINK: c_int = 4; |
| 821 |
pub const AF_INET6: c_int = 5; |
| 822 |
pub const AF_DLI: c_int = 6; |
| 823 |
pub const AF_IPX: c_int = 7; |
| 824 |
pub const AF_NOTIFY: c_int = 8; |
| 825 |
pub const AF_LOCAL: c_int = 9; |
| 826 |
pub const AF_UNIX: c_int = AF_LOCAL; |
| 827 |
pub const AF_BLUETOOTH: c_int = 10; |
| 828 |
|
| 829 |
pub const PF_UNSPEC: c_int = AF_UNSPEC; |
| 830 |
pub const PF_INET: c_int = AF_INET; |
| 831 |
pub const PF_ROUTE: c_int = AF_ROUTE; |
| 832 |
pub const PF_LINK: c_int = AF_LINK; |
| 833 |
pub const PF_INET6: c_int = AF_INET6; |
| 834 |
pub const PF_LOCAL: c_int = AF_LOCAL; |
| 835 |
pub const PF_UNIX: c_int = AF_UNIX; |
| 836 |
pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH; |
| 837 |
|
| 838 |
pub const IP_OPTIONS: c_int = 1; |
| 839 |
pub const IP_HDRINCL: c_int = 2; |
| 840 |
pub const IP_TOS: c_int = 3; |
| 841 |
pub const IP_TTL: c_int = 4; |
| 842 |
pub const IP_RECVOPTS: c_int = 5; |
| 843 |
pub const IP_RECVRETOPTS: c_int = 6; |
| 844 |
pub const IP_RECVDSTADDR: c_int = 7; |
| 845 |
pub const IP_RETOPTS: c_int = 8; |
| 846 |
pub const IP_MULTICAST_IF: c_int = 9; |
| 847 |
pub const IP_MULTICAST_TTL: c_int = 10; |
| 848 |
pub const IP_MULTICAST_LOOP: c_int = 11; |
| 849 |
pub const IP_ADD_MEMBERSHIP: c_int = 12; |
| 850 |
pub const IP_DROP_MEMBERSHIP: c_int = 13; |
| 851 |
pub const IP_BLOCK_SOURCE: c_int = 14; |
| 852 |
pub const IP_UNBLOCK_SOURCE: c_int = 15; |
| 853 |
pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 16; |
| 854 |
pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 17; |
| 855 |
|
| 856 |
pub const TCP_NODELAY: c_int = 0x01; |
| 857 |
pub const TCP_MAXSEG: c_int = 0x02; |
| 858 |
pub const TCP_NOPUSH: c_int = 0x04; |
| 859 |
pub const TCP_NOOPT: c_int = 0x08; |
| 860 |
|
| 861 |
pub const IF_NAMESIZE: size_t = 32; |
| 862 |
pub const IFNAMSIZ: size_t = IF_NAMESIZE; |
| 863 |
|
| 864 |
pub const IPV6_MULTICAST_IF: c_int = 24; |
| 865 |
pub const IPV6_MULTICAST_HOPS: c_int = 25; |
| 866 |
pub const IPV6_MULTICAST_LOOP: c_int = 26; |
| 867 |
pub const IPV6_UNICAST_HOPS: c_int = 27; |
| 868 |
pub const IPV6_JOIN_GROUP: c_int = 28; |
| 869 |
pub const IPV6_LEAVE_GROUP: c_int = 29; |
| 870 |
pub const IPV6_V6ONLY: c_int = 30; |
| 871 |
pub const IPV6_PKTINFO: c_int = 31; |
| 872 |
pub const IPV6_RECVPKTINFO: c_int = 32; |
| 873 |
pub const IPV6_HOPLIMIT: c_int = 33; |
| 874 |
pub const IPV6_RECVHOPLIMIT: c_int = 34; |
| 875 |
pub const IPV6_HOPOPTS: c_int = 35; |
| 876 |
pub const IPV6_DSTOPTS: c_int = 36; |
| 877 |
pub const IPV6_RTHDR: c_int = 37; |
| 878 |
|
| 879 |
pub const MSG_OOB: c_int = 0x0001; |
| 880 |
pub const MSG_PEEK: c_int = 0x0002; |
| 881 |
pub const MSG_DONTROUTE: c_int = 0x0004; |
| 882 |
pub const MSG_EOR: c_int = 0x0008; |
| 883 |
pub const MSG_TRUNC: c_int = 0x0010; |
| 884 |
pub const MSG_CTRUNC: c_int = 0x0020; |
| 885 |
pub const MSG_WAITALL: c_int = 0x0040; |
| 886 |
pub const MSG_DONTWAIT: c_int = 0x0080; |
| 887 |
pub const MSG_BCAST: c_int = 0x0100; |
| 888 |
pub const MSG_MCAST: c_int = 0x0200; |
| 889 |
pub const MSG_EOF: c_int = 0x0400; |
| 890 |
pub const MSG_NOSIGNAL: c_int = 0x0800; |
| 891 |
|
| 892 |
pub const SHUT_RD: c_int = 0; |
| 893 |
pub const SHUT_WR: c_int = 1; |
| 894 |
pub const SHUT_RDWR: c_int = 2; |
| 895 |
|
| 896 |
pub const LOCK_SH: c_int = 0x01; |
| 897 |
pub const LOCK_EX: c_int = 0x02; |
| 898 |
pub const LOCK_NB: c_int = 0x04; |
| 899 |
pub const LOCK_UN: c_int = 0x08; |
| 900 |
|
| 901 |
pub const MINSIGSTKSZ: size_t = 8192; |
| 902 |
pub const SIGSTKSZ: size_t = 16384; |
| 903 |
|
| 904 |
pub const IOV_MAX: c_int = 1024; |
| 905 |
|
| 906 |
/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 907 |
/// for details. |
| 908 |
pub const PATH_MAX: c_int = 1024; |
| 909 |
|
| 910 |
pub const SA_NOCLDSTOP: c_int = 0x01; |
| 911 |
pub const SA_NOCLDWAIT: c_int = 0x02; |
| 912 |
pub const SA_RESETHAND: c_int = 0x04; |
| 913 |
pub const SA_NODEFER: c_int = 0x08; |
| 914 |
pub const SA_RESTART: c_int = 0x10; |
| 915 |
pub const SA_ONSTACK: c_int = 0x20; |
| 916 |
pub const SA_SIGINFO: c_int = 0x40; |
| 917 |
pub const SA_NOMASK: c_int = SA_NODEFER; |
| 918 |
pub const SA_STACK: c_int = SA_ONSTACK; |
| 919 |
pub const SA_ONESHOT: c_int = SA_RESETHAND; |
| 920 |
|
| 921 |
pub const SS_ONSTACK: c_int = 0x1; |
| 922 |
pub const SS_DISABLE: c_int = 0x2; |
| 923 |
|
| 924 |
// DIFF(main): changed to `c_int` in 500365e1 |
| 925 |
pub const FD_SETSIZE: usize = 1024; |
| 926 |
|
| 927 |
pub const RTLD_LOCAL: c_int = 0x0; |
| 928 |
pub const RTLD_NOW: c_int = 0x1; |
| 929 |
pub const RTLD_GLOBAL: c_int = 0x2; |
| 930 |
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); |
| 931 |
|
| 932 |
pub const BUFSIZ: c_uint = 8192; |
| 933 |
pub const FILENAME_MAX: c_uint = 256; |
| 934 |
pub const FOPEN_MAX: c_uint = 128; |
| 935 |
pub const L_tmpnam: c_uint = 512; |
| 936 |
pub const TMP_MAX: c_uint = 32768; |
| 937 |
|
| 938 |
pub const _PC_CHOWN_RESTRICTED: c_int = 1; |
| 939 |
pub const _PC_MAX_CANON: c_int = 2; |
| 940 |
pub const _PC_MAX_INPUT: c_int = 3; |
| 941 |
pub const _PC_NAME_MAX: c_int = 4; |
| 942 |
pub const _PC_NO_TRUNC: c_int = 5; |
| 943 |
pub const _PC_PATH_MAX: c_int = 6; |
| 944 |
pub const _PC_PIPE_BUF: c_int = 7; |
| 945 |
pub const _PC_VDISABLE: c_int = 8; |
| 946 |
pub const _PC_LINK_MAX: c_int = 25; |
| 947 |
pub const _PC_SYNC_IO: c_int = 26; |
| 948 |
pub const _PC_ASYNC_IO: c_int = 27; |
| 949 |
pub const _PC_PRIO_IO: c_int = 28; |
| 950 |
pub const _PC_SOCK_MAXBUF: c_int = 29; |
| 951 |
pub const _PC_FILESIZEBITS: c_int = 30; |
| 952 |
pub const _PC_REC_INCR_XFER_SIZE: c_int = 31; |
| 953 |
pub const _PC_REC_MAX_XFER_SIZE: c_int = 32; |
| 954 |
pub const _PC_REC_MIN_XFER_SIZE: c_int = 33; |
| 955 |
pub const _PC_REC_XFER_ALIGN: c_int = 34; |
| 956 |
pub const _PC_ALLOC_SIZE_MIN: c_int = 35; |
| 957 |
pub const _PC_SYMLINK_MAX: c_int = 36; |
| 958 |
pub const _PC_2_SYMLINKS: c_int = 37; |
| 959 |
pub const _PC_XATTR_EXISTS: c_int = 38; |
| 960 |
pub const _PC_XATTR_ENABLED: c_int = 39; |
| 961 |
|
| 962 |
pub const FIONBIO: c_ulong = 0xbe000000; |
| 963 |
pub const FIONREAD: c_ulong = 0xbe000001; |
| 964 |
pub const FIOSEEKDATA: c_ulong = 0xbe000002; |
| 965 |
pub const FIOSEEKHOLE: c_ulong = 0xbe000003; |
| 966 |
|
| 967 |
pub const _SC_ARG_MAX: c_int = 15; |
| 968 |
pub const _SC_CHILD_MAX: c_int = 16; |
| 969 |
pub const _SC_CLK_TCK: c_int = 17; |
| 970 |
pub const _SC_JOB_CONTROL: c_int = 18; |
| 971 |
pub const _SC_NGROUPS_MAX: c_int = 19; |
| 972 |
pub const _SC_OPEN_MAX: c_int = 20; |
| 973 |
pub const _SC_SAVED_IDS: c_int = 21; |
| 974 |
pub const _SC_STREAM_MAX: c_int = 22; |
| 975 |
pub const _SC_TZNAME_MAX: c_int = 23; |
| 976 |
pub const _SC_VERSION: c_int = 24; |
| 977 |
pub const _SC_GETGR_R_SIZE_MAX: c_int = 25; |
| 978 |
pub const _SC_GETPW_R_SIZE_MAX: c_int = 26; |
| 979 |
pub const _SC_PAGESIZE: c_int = 27; |
| 980 |
pub const _SC_PAGE_SIZE: c_int = 27; |
| 981 |
pub const _SC_SEM_NSEMS_MAX: c_int = 28; |
| 982 |
pub const _SC_SEM_VALUE_MAX: c_int = 29; |
| 983 |
pub const _SC_SEMAPHORES: c_int = 30; |
| 984 |
pub const _SC_THREADS: c_int = 31; |
| 985 |
pub const _SC_IOV_MAX: c_int = 32; |
| 986 |
pub const _SC_UIO_MAXIOV: c_int = 32; |
| 987 |
pub const _SC_NPROCESSORS_CONF: c_int = 34; |
| 988 |
pub const _SC_NPROCESSORS_ONLN: c_int = 35; |
| 989 |
pub const _SC_ATEXIT_MAX: c_int = 37; |
| 990 |
pub const _SC_PASS_MAX: c_int = 39; |
| 991 |
pub const _SC_PHYS_PAGES: c_int = 40; |
| 992 |
pub const _SC_AVPHYS_PAGES: c_int = 41; |
| 993 |
pub const _SC_PIPE: c_int = 42; |
| 994 |
pub const _SC_SELECT: c_int = 43; |
| 995 |
pub const _SC_POLL: c_int = 44; |
| 996 |
pub const _SC_MAPPED_FILES: c_int = 45; |
| 997 |
pub const _SC_THREAD_PROCESS_SHARED: c_int = 46; |
| 998 |
pub const _SC_THREAD_STACK_MIN: c_int = 47; |
| 999 |
pub const _SC_THREAD_ATTR_STACKADDR: c_int = 48; |
| 1000 |
pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 49; |
| 1001 |
pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 50; |
| 1002 |
pub const _SC_REALTIME_SIGNALS: c_int = 51; |
| 1003 |
pub const _SC_MEMORY_PROTECTION: c_int = 52; |
| 1004 |
pub const _SC_SIGQUEUE_MAX: c_int = 53; |
| 1005 |
pub const _SC_RTSIG_MAX: c_int = 54; |
| 1006 |
pub const _SC_MONOTONIC_CLOCK: c_int = 55; |
| 1007 |
pub const _SC_DELAYTIMER_MAX: c_int = 56; |
| 1008 |
pub const _SC_TIMER_MAX: c_int = 57; |
| 1009 |
pub const _SC_TIMERS: c_int = 58; |
| 1010 |
pub const _SC_CPUTIME: c_int = 59; |
| 1011 |
pub const _SC_THREAD_CPUTIME: c_int = 60; |
| 1012 |
pub const _SC_HOST_NAME_MAX: c_int = 61; |
| 1013 |
pub const _SC_REGEXP: c_int = 62; |
| 1014 |
pub const _SC_SYMLOOP_MAX: c_int = 63; |
| 1015 |
pub const _SC_SHELL: c_int = 64; |
| 1016 |
pub const _SC_TTY_NAME_MAX: c_int = 65; |
| 1017 |
pub const _SC_ADVISORY_INFO: c_int = 66; |
| 1018 |
pub const _SC_BARRIERS: c_int = 67; |
| 1019 |
pub const _SC_CLOCK_SELECTION: c_int = 68; |
| 1020 |
pub const _SC_FSYNC: c_int = 69; |
| 1021 |
pub const _SC_IPV6: c_int = 70; |
| 1022 |
pub const _SC_MEMLOCK: c_int = 71; |
| 1023 |
pub const _SC_MEMLOCK_RANGE: c_int = 72; |
| 1024 |
pub const _SC_MESSAGE_PASSING: c_int = 73; |
| 1025 |
pub const _SC_PRIORITIZED_IO: c_int = 74; |
| 1026 |
pub const _SC_PRIORITY_SCHEDULING: c_int = 75; |
| 1027 |
pub const _SC_READER_WRITER_LOCKS: c_int = 76; |
| 1028 |
pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 77; |
| 1029 |
pub const _SC_SPAWN: c_int = 78; |
| 1030 |
pub const _SC_SPIN_LOCKS: c_int = 79; |
| 1031 |
pub const _SC_SPORADIC_SERVER: c_int = 80; |
| 1032 |
pub const _SC_SYNCHRONIZED_IO: c_int = 81; |
| 1033 |
pub const _SC_THREAD_PRIO_INHERIT: c_int = 82; |
| 1034 |
pub const _SC_THREAD_PRIO_PROTECT: c_int = 83; |
| 1035 |
pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 84; |
| 1036 |
pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 85; |
| 1037 |
pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 86; |
| 1038 |
pub const _SC_THREAD_SPORADIC_SERVER: c_int = 87; |
| 1039 |
pub const _SC_TIMEOUTS: c_int = 88; |
| 1040 |
pub const _SC_TRACE: c_int = 89; |
| 1041 |
pub const _SC_TRACE_EVENT_FILTER: c_int = 90; |
| 1042 |
pub const _SC_TRACE_INHERIT: c_int = 91; |
| 1043 |
pub const _SC_TRACE_LOG: c_int = 92; |
| 1044 |
pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 93; |
| 1045 |
pub const _SC_V6_ILP32_OFF32: c_int = 94; |
| 1046 |
pub const _SC_V6_ILP32_OFFBIG: c_int = 95; |
| 1047 |
pub const _SC_V6_LP64_OFF64: c_int = 96; |
| 1048 |
pub const _SC_V6_LPBIG_OFFBIG: c_int = 97; |
| 1049 |
pub const _SC_V7_ILP32_OFF32: c_int = 98; |
| 1050 |
pub const _SC_V7_ILP32_OFFBIG: c_int = 99; |
| 1051 |
pub const _SC_V7_LP64_OFF64: c_int = 100; |
| 1052 |
pub const _SC_V7_LPBIG_OFFBIG: c_int = 101; |
| 1053 |
pub const _SC_2_C_BIND: c_int = 102; |
| 1054 |
pub const _SC_2_C_DEV: c_int = 103; |
| 1055 |
pub const _SC_2_CHAR_TERM: c_int = 104; |
| 1056 |
pub const _SC_2_FORT_DEV: c_int = 105; |
| 1057 |
pub const _SC_2_FORT_RUN: c_int = 106; |
| 1058 |
pub const _SC_2_LOCALEDEF: c_int = 107; |
| 1059 |
pub const _SC_2_PBS: c_int = 108; |
| 1060 |
pub const _SC_2_PBS_ACCOUNTING: c_int = 109; |
| 1061 |
pub const _SC_2_PBS_CHECKPOINT: c_int = 110; |
| 1062 |
pub const _SC_2_PBS_LOCATE: c_int = 111; |
| 1063 |
pub const _SC_2_PBS_MESSAGE: c_int = 112; |
| 1064 |
pub const _SC_2_PBS_TRACK: c_int = 113; |
| 1065 |
pub const _SC_2_SW_DEV: c_int = 114; |
| 1066 |
pub const _SC_2_UPE: c_int = 115; |
| 1067 |
pub const _SC_2_VERSION: c_int = 116; |
| 1068 |
pub const _SC_XOPEN_CRYPT: c_int = 117; |
| 1069 |
pub const _SC_XOPEN_ENH_I18N: c_int = 118; |
| 1070 |
pub const _SC_XOPEN_REALTIME: c_int = 119; |
| 1071 |
pub const _SC_XOPEN_REALTIME_THREADS: c_int = 120; |
| 1072 |
pub const _SC_XOPEN_SHM: c_int = 121; |
| 1073 |
pub const _SC_XOPEN_STREAMS: c_int = 122; |
| 1074 |
pub const _SC_XOPEN_UNIX: c_int = 123; |
| 1075 |
pub const _SC_XOPEN_UUCP: c_int = 124; |
| 1076 |
pub const _SC_XOPEN_VERSION: c_int = 125; |
| 1077 |
pub const _SC_BC_BASE_MAX: c_int = 129; |
| 1078 |
pub const _SC_BC_DIM_MAX: c_int = 130; |
| 1079 |
pub const _SC_BC_SCALE_MAX: c_int = 131; |
| 1080 |
pub const _SC_BC_STRING_MAX: c_int = 132; |
| 1081 |
pub const _SC_COLL_WEIGHTS_MAX: c_int = 133; |
| 1082 |
pub const _SC_EXPR_NEST_MAX: c_int = 134; |
| 1083 |
pub const _SC_LINE_MAX: c_int = 135; |
| 1084 |
pub const _SC_LOGIN_NAME_MAX: c_int = 136; |
| 1085 |
pub const _SC_MQ_OPEN_MAX: c_int = 137; |
| 1086 |
pub const _SC_MQ_PRIO_MAX: c_int = 138; |
| 1087 |
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 139; |
| 1088 |
pub const _SC_THREAD_KEYS_MAX: c_int = 140; |
| 1089 |
pub const _SC_THREAD_THREADS_MAX: c_int = 141; |
| 1090 |
pub const _SC_RE_DUP_MAX: c_int = 142; |
| 1091 |
|
| 1092 |
pub const PTHREAD_STACK_MIN: size_t = 8192; |
| 1093 |
|
| 1094 |
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
| 1095 |
flags: 0, |
| 1096 |
lock: 0, |
| 1097 |
unused: Padding::new(0), |
| 1098 |
owner: -1, |
| 1099 |
owner_count: 0, |
| 1100 |
}; |
| 1101 |
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { |
| 1102 |
flags: 0, |
| 1103 |
unused: Padding::new(0), |
| 1104 |
mutex: ptr::null_mut(), |
| 1105 |
waiter_count: 0, |
| 1106 |
lock: 0, |
| 1107 |
}; |
| 1108 |
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { |
| 1109 |
flags: 0, |
| 1110 |
owner: -1, |
| 1111 |
lock_sem: 0, |
| 1112 |
lock_count: 0, |
| 1113 |
reader_count: 0, |
| 1114 |
writer_count: 0, |
| 1115 |
waiters: [ptr::null_mut(); 2], |
| 1116 |
}; |
| 1117 |
|
| 1118 |
pub const PTHREAD_MUTEX_DEFAULT: c_int = 0; |
| 1119 |
pub const PTHREAD_MUTEX_NORMAL: c_int = 1; |
| 1120 |
pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; |
| 1121 |
pub const PTHREAD_MUTEX_RECURSIVE: c_int = 3; |
| 1122 |
|
| 1123 |
pub const FIOCLEX: c_ulong = 0; // FIXME(haiku): does not exist on Haiku! |
| 1124 |
|
| 1125 |
pub const RUSAGE_CHILDREN: c_int = -1; |
| 1126 |
|
| 1127 |
pub const SOCK_STREAM: c_int = 1; |
| 1128 |
pub const SOCK_DGRAM: c_int = 2; |
| 1129 |
pub const SOCK_RAW: c_int = 3; |
| 1130 |
pub const SOCK_SEQPACKET: c_int = 5; |
| 1131 |
pub const SOCK_NONBLOCK: c_int = 0x00040000; |
| 1132 |
pub const SOCK_CLOEXEC: c_int = 0x00080000; |
| 1133 |
|
| 1134 |
pub const SOL_SOCKET: c_int = -1; |
| 1135 |
pub const SO_ACCEPTCONN: c_int = 0x00000001; |
| 1136 |
pub const SO_BROADCAST: c_int = 0x00000002; |
| 1137 |
pub const SO_DEBUG: c_int = 0x00000004; |
| 1138 |
pub const SO_DONTROUTE: c_int = 0x00000008; |
| 1139 |
pub const SO_KEEPALIVE: c_int = 0x00000010; |
| 1140 |
pub const SO_OOBINLINE: c_int = 0x00000020; |
| 1141 |
pub const SO_REUSEADDR: c_int = 0x00000040; |
| 1142 |
pub const SO_REUSEPORT: c_int = 0x00000080; |
| 1143 |
pub const SO_USELOOPBACK: c_int = 0x00000100; |
| 1144 |
pub const SO_LINGER: c_int = 0x00000200; |
| 1145 |
pub const SO_SNDBUF: c_int = 0x40000001; |
| 1146 |
pub const SO_SNDLOWAT: c_int = 0x40000002; |
| 1147 |
pub const SO_SNDTIMEO: c_int = 0x40000003; |
| 1148 |
pub const SO_RCVBUF: c_int = 0x40000004; |
| 1149 |
pub const SO_RCVLOWAT: c_int = 0x40000005; |
| 1150 |
pub const SO_RCVTIMEO: c_int = 0x40000006; |
| 1151 |
pub const SO_ERROR: c_int = 0x40000007; |
| 1152 |
pub const SO_TYPE: c_int = 0x40000008; |
| 1153 |
pub const SO_NONBLOCK: c_int = 0x40000009; |
| 1154 |
pub const SO_BINDTODEVICE: c_int = 0x4000000a; |
| 1155 |
pub const SO_PEERCRED: c_int = 0x4000000b; |
| 1156 |
|
| 1157 |
pub const SCM_RIGHTS: c_int = 0x01; |
| 1158 |
|
| 1159 |
pub const SOMAXCONN: c_int = 32; |
| 1160 |
|
| 1161 |
pub const NI_MAXHOST: size_t = 1025; |
| 1162 |
|
| 1163 |
pub const WNOHANG: c_int = 0x01; |
| 1164 |
pub const WUNTRACED: c_int = 0x02; |
| 1165 |
pub const WCONTINUED: c_int = 0x04; |
| 1166 |
pub const WEXITED: c_int = 0x08; |
| 1167 |
pub const WSTOPPED: c_int = 0x10; |
| 1168 |
pub const WNOWAIT: c_int = 0x20; |
| 1169 |
|
| 1170 |
// si_code values for SIGBUS signal |
| 1171 |
pub const BUS_ADRALN: c_int = 40; |
| 1172 |
pub const BUS_ADRERR: c_int = 41; |
| 1173 |
pub const BUS_OBJERR: c_int = 42; |
| 1174 |
|
| 1175 |
// si_code values for SIGCHLD signal |
| 1176 |
pub const CLD_EXITED: c_int = 60; |
| 1177 |
pub const CLD_KILLED: c_int = 61; |
| 1178 |
pub const CLD_DUMPED: c_int = 62; |
| 1179 |
pub const CLD_TRAPPED: c_int = 63; |
| 1180 |
pub const CLD_STOPPED: c_int = 64; |
| 1181 |
pub const CLD_CONTINUED: c_int = 65; |
| 1182 |
|
| 1183 |
pub const P_ALL: idtype_t = 0; |
| 1184 |
pub const P_PID: idtype_t = 1; |
| 1185 |
pub const P_PGID: idtype_t = 2; |
| 1186 |
|
| 1187 |
pub const UTIME_OMIT: c_long = 1000000001; |
| 1188 |
pub const UTIME_NOW: c_long = 1000000000; |
| 1189 |
|
| 1190 |
pub const VINTR: usize = 0; |
| 1191 |
pub const VQUIT: usize = 1; |
| 1192 |
pub const VERASE: usize = 2; |
| 1193 |
pub const VKILL: usize = 3; |
| 1194 |
pub const VEOF: usize = 4; |
| 1195 |
pub const VEOL: usize = 5; |
| 1196 |
pub const VMIN: usize = 4; |
| 1197 |
pub const VTIME: usize = 5; |
| 1198 |
pub const VEOL2: usize = 6; |
| 1199 |
pub const VSWTCH: usize = 7; |
| 1200 |
pub const VSTART: usize = 8; |
| 1201 |
pub const VSTOP: usize = 9; |
| 1202 |
pub const VSUSP: usize = 10; |
| 1203 |
|
| 1204 |
pub const IGNBRK: crate::tcflag_t = 0x01; |
| 1205 |
pub const BRKINT: crate::tcflag_t = 0x02; |
| 1206 |
pub const IGNPAR: crate::tcflag_t = 0x04; |
| 1207 |
pub const PARMRK: crate::tcflag_t = 0x08; |
| 1208 |
pub const INPCK: crate::tcflag_t = 0x10; |
| 1209 |
pub const ISTRIP: crate::tcflag_t = 0x20; |
| 1210 |
pub const INLCR: crate::tcflag_t = 0x40; |
| 1211 |
pub const IGNCR: crate::tcflag_t = 0x80; |
| 1212 |
pub const ICRNL: crate::tcflag_t = 0x100; |
| 1213 |
pub const IUCLC: crate::tcflag_t = 0x200; |
| 1214 |
pub const IXON: crate::tcflag_t = 0x400; |
| 1215 |
pub const IXANY: crate::tcflag_t = 0x800; |
| 1216 |
pub const IXOFF: crate::tcflag_t = 0x1000; |
| 1217 |
|
| 1218 |
pub const OPOST: crate::tcflag_t = 0x00000001; |
| 1219 |
pub const OLCUC: crate::tcflag_t = 0x00000002; |
| 1220 |
pub const ONLCR: crate::tcflag_t = 0x00000004; |
| 1221 |
pub const OCRNL: crate::tcflag_t = 0x00000008; |
| 1222 |
pub const ONOCR: crate::tcflag_t = 0x00000010; |
| 1223 |
pub const ONLRET: crate::tcflag_t = 0x00000020; |
| 1224 |
pub const OFILL: crate::tcflag_t = 0x00000040; |
| 1225 |
pub const OFDEL: crate::tcflag_t = 0x00000080; |
| 1226 |
pub const NLDLY: crate::tcflag_t = 0x00000100; |
| 1227 |
pub const NL0: crate::tcflag_t = 0x00000000; |
| 1228 |
pub const NL1: crate::tcflag_t = 0x00000100; |
| 1229 |
pub const CRDLY: crate::tcflag_t = 0x00000600; |
| 1230 |
pub const CR0: crate::tcflag_t = 0x00000000; |
| 1231 |
pub const CR1: crate::tcflag_t = 0x00000200; |
| 1232 |
pub const CR2: crate::tcflag_t = 0x00000400; |
| 1233 |
pub const CR3: crate::tcflag_t = 0x00000600; |
| 1234 |
pub const TABDLY: crate::tcflag_t = 0x00001800; |
| 1235 |
pub const TAB0: crate::tcflag_t = 0x00000000; |
| 1236 |
pub const TAB1: crate::tcflag_t = 0x00000800; |
| 1237 |
pub const TAB2: crate::tcflag_t = 0x00001000; |
| 1238 |
pub const TAB3: crate::tcflag_t = 0x00001800; |
| 1239 |
pub const BSDLY: crate::tcflag_t = 0x00002000; |
| 1240 |
pub const BS0: crate::tcflag_t = 0x00000000; |
| 1241 |
pub const BS1: crate::tcflag_t = 0x00002000; |
| 1242 |
pub const VTDLY: crate::tcflag_t = 0x00004000; |
| 1243 |
pub const VT0: crate::tcflag_t = 0x00000000; |
| 1244 |
pub const VT1: crate::tcflag_t = 0x00004000; |
| 1245 |
pub const FFDLY: crate::tcflag_t = 0x00008000; |
| 1246 |
pub const FF0: crate::tcflag_t = 0x00000000; |
| 1247 |
pub const FF1: crate::tcflag_t = 0x00008000; |
| 1248 |
|
| 1249 |
pub const CSIZE: crate::tcflag_t = 0x00000020; |
| 1250 |
pub const CS5: crate::tcflag_t = 0x00000000; |
| 1251 |
pub const CS6: crate::tcflag_t = 0x00000000; |
| 1252 |
pub const CS7: crate::tcflag_t = 0x00000000; |
| 1253 |
pub const CS8: crate::tcflag_t = 0x00000020; |
| 1254 |
pub const CSTOPB: crate::tcflag_t = 0x00000040; |
| 1255 |
pub const CREAD: crate::tcflag_t = 0x00000080; |
| 1256 |
pub const PARENB: crate::tcflag_t = 0x00000100; |
| 1257 |
pub const PARODD: crate::tcflag_t = 0x00000200; |
| 1258 |
pub const HUPCL: crate::tcflag_t = 0x00000400; |
| 1259 |
pub const CLOCAL: crate::tcflag_t = 0x00000800; |
| 1260 |
pub const XLOBLK: crate::tcflag_t = 0x00001000; |
| 1261 |
pub const CTSFLOW: crate::tcflag_t = 0x00002000; |
| 1262 |
pub const RTSFLOW: crate::tcflag_t = 0x00004000; |
| 1263 |
pub const CRTSCTS: crate::tcflag_t = RTSFLOW | CTSFLOW; |
| 1264 |
|
| 1265 |
pub const ISIG: crate::tcflag_t = 0x00000001; |
| 1266 |
pub const ICANON: crate::tcflag_t = 0x00000002; |
| 1267 |
pub const XCASE: crate::tcflag_t = 0x00000004; |
| 1268 |
pub const ECHO: crate::tcflag_t = 0x00000008; |
| 1269 |
pub const ECHOE: crate::tcflag_t = 0x00000010; |
| 1270 |
pub const ECHOK: crate::tcflag_t = 0x00000020; |
| 1271 |
pub const ECHONL: crate::tcflag_t = 0x00000040; |
| 1272 |
pub const NOFLSH: crate::tcflag_t = 0x00000080; |
| 1273 |
pub const TOSTOP: crate::tcflag_t = 0x00000100; |
| 1274 |
pub const IEXTEN: crate::tcflag_t = 0x00000200; |
| 1275 |
pub const ECHOCTL: crate::tcflag_t = 0x00000400; |
| 1276 |
pub const ECHOPRT: crate::tcflag_t = 0x00000800; |
| 1277 |
pub const ECHOKE: crate::tcflag_t = 0x00001000; |
| 1278 |
pub const FLUSHO: crate::tcflag_t = 0x00002000; |
| 1279 |
pub const PENDIN: crate::tcflag_t = 0x00004000; |
| 1280 |
|
| 1281 |
pub const TCGB_CTS: c_int = 0x01; |
| 1282 |
pub const TCGB_DSR: c_int = 0x02; |
| 1283 |
pub const TCGB_RI: c_int = 0x04; |
| 1284 |
pub const TCGB_DCD: c_int = 0x08; |
| 1285 |
pub const TIOCM_CTS: c_int = TCGB_CTS; |
| 1286 |
pub const TIOCM_CD: c_int = TCGB_DCD; |
| 1287 |
pub const TIOCM_CAR: c_int = TCGB_DCD; |
| 1288 |
pub const TIOCM_RI: c_int = TCGB_RI; |
| 1289 |
pub const TIOCM_RNG: c_int = TCGB_RI; |
| 1290 |
pub const TIOCM_DSR: c_int = TCGB_DSR; |
| 1291 |
pub const TIOCM_DTR: c_int = 0x10; |
| 1292 |
pub const TIOCM_RTS: c_int = 0x20; |
| 1293 |
|
| 1294 |
pub const B0: speed_t = 0x00; |
| 1295 |
pub const B50: speed_t = 0x01; |
| 1296 |
pub const B75: speed_t = 0x02; |
| 1297 |
pub const B110: speed_t = 0x03; |
| 1298 |
pub const B134: speed_t = 0x04; |
| 1299 |
pub const B150: speed_t = 0x05; |
| 1300 |
pub const B200: speed_t = 0x06; |
| 1301 |
pub const B300: speed_t = 0x07; |
| 1302 |
pub const B600: speed_t = 0x08; |
| 1303 |
pub const B1200: speed_t = 0x09; |
| 1304 |
pub const B1800: speed_t = 0x0A; |
| 1305 |
pub const B2400: speed_t = 0x0B; |
| 1306 |
pub const B4800: speed_t = 0x0C; |
| 1307 |
pub const B9600: speed_t = 0x0D; |
| 1308 |
pub const B19200: speed_t = 0x0E; |
| 1309 |
pub const B38400: speed_t = 0x0F; |
| 1310 |
pub const B57600: speed_t = 0x10; |
| 1311 |
pub const B115200: speed_t = 0x11; |
| 1312 |
pub const B230400: speed_t = 0x12; |
| 1313 |
pub const B31250: speed_t = 0x13; |
| 1314 |
|
| 1315 |
pub const TCSANOW: c_int = 0x01; |
| 1316 |
pub const TCSADRAIN: c_int = 0x02; |
| 1317 |
pub const TCSAFLUSH: c_int = 0x04; |
| 1318 |
|
| 1319 |
pub const TCOOFF: c_int = 0x01; |
| 1320 |
pub const TCOON: c_int = 0x02; |
| 1321 |
pub const TCIOFF: c_int = 0x04; |
| 1322 |
pub const TCION: c_int = 0x08; |
| 1323 |
|
| 1324 |
pub const TCIFLUSH: c_int = 0x01; |
| 1325 |
pub const TCOFLUSH: c_int = 0x02; |
| 1326 |
pub const TCIOFLUSH: c_int = 0x03; |
| 1327 |
|
| 1328 |
pub const TCGETA: c_ulong = 0x8000; |
| 1329 |
pub const TCSETA: c_ulong = TCGETA + 1; |
| 1330 |
pub const TCSETAF: c_ulong = TCGETA + 2; |
| 1331 |
pub const TCSETAW: c_ulong = TCGETA + 3; |
| 1332 |
pub const TCSBRK: c_ulong = TCGETA + 5; |
| 1333 |
pub const TCFLSH: c_ulong = TCGETA + 6; |
| 1334 |
pub const TCXONC: c_ulong = TCGETA + 7; |
| 1335 |
pub const TCGETBITS: c_ulong = TCGETA + 9; |
| 1336 |
pub const TCSETDTR: c_ulong = TCGETA + 10; |
| 1337 |
pub const TCSETRTS: c_ulong = TCGETA + 11; |
| 1338 |
pub const TIOCGWINSZ: c_ulong = TCGETA + 12; |
| 1339 |
pub const TIOCSWINSZ: c_ulong = TCGETA + 13; |
| 1340 |
pub const TIOCGPGRP: c_ulong = TCGETA + 15; |
| 1341 |
pub const TIOCSPGRP: c_ulong = TCGETA + 16; |
| 1342 |
pub const TIOCSCTTY: c_ulong = TCGETA + 17; |
| 1343 |
pub const TIOCMGET: c_ulong = TCGETA + 18; |
| 1344 |
pub const TIOCMSET: c_ulong = TCGETA + 19; |
| 1345 |
pub const TIOCSBRK: c_ulong = TCGETA + 20; |
| 1346 |
pub const TIOCCBRK: c_ulong = TCGETA + 21; |
| 1347 |
pub const TIOCMBIS: c_ulong = TCGETA + 22; |
| 1348 |
pub const TIOCMBIC: c_ulong = TCGETA + 23; |
| 1349 |
pub const TIOCGSID: c_ulong = TCGETA + 24; |
| 1350 |
pub const TIOCOUTQ: c_ulong = TCGETA + 25; |
| 1351 |
pub const TIOCEXCL: c_ulong = TCGETA + 26; |
| 1352 |
pub const TIOCNXCL: c_ulong = TCGETA + 27; |
| 1353 |
|
| 1354 |
pub const PRIO_PROCESS: c_int = 0; |
| 1355 |
pub const PRIO_PGRP: c_int = 1; |
| 1356 |
pub const PRIO_USER: c_int = 2; |
| 1357 |
|
| 1358 |
// utmpx entry types |
| 1359 |
pub const EMPTY: c_short = 0; |
| 1360 |
pub const BOOT_TIME: c_short = 1; |
| 1361 |
pub const OLD_TIME: c_short = 2; |
| 1362 |
pub const NEW_TIME: c_short = 3; |
| 1363 |
pub const USER_PROCESS: c_short = 4; |
| 1364 |
pub const INIT_PROCESS: c_short = 5; |
| 1365 |
pub const LOGIN_PROCESS: c_short = 6; |
| 1366 |
pub const DEAD_PROCESS: c_short = 7; |
| 1367 |
|
| 1368 |
pub const LOG_PID: c_int = 1 << 12; |
| 1369 |
pub const LOG_CONS: c_int = 2 << 12; |
| 1370 |
pub const LOG_ODELAY: c_int = 4 << 12; |
| 1371 |
pub const LOG_NDELAY: c_int = 8 << 12; |
| 1372 |
pub const LOG_SERIAL: c_int = 16 << 12; |
| 1373 |
pub const LOG_PERROR: c_int = 32 << 12; |
| 1374 |
pub const LOG_NOWAIT: c_int = 64 << 12; |
| 1375 |
|
| 1376 |
// spawn.h |
| 1377 |
// DIFF(main): changed to `c_short` in f62eb023ab |
| 1378 |
pub const POSIX_SPAWN_RESETIDS: c_int = 0x01; |
| 1379 |
pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02; |
| 1380 |
pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10; |
| 1381 |
pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20; |
| 1382 |
pub const POSIX_SPAWN_SETSID: c_int = 0x40; |
| 1383 |
|
| 1384 |
const fn CMSG_ALIGN(len: usize) -> usize { |
| 1385 |
len + size_of::<usize>() - 1 & !(size_of::<usize>() - 1) |
| 1386 |
} |
| 1387 |
|
| 1388 |
f! { |
| 1389 |
pub unsafe fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { |
| 1390 |
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() { |
| 1391 |
(*mhdr).msg_control.cast() |
| 1392 |
} else { |
| 1393 |
ptr::null_mut() |
| 1394 |
} |
| 1395 |
} |
| 1396 |
|
| 1397 |
pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { |
| 1398 |
(cmsg as *mut c_uchar).offset(CMSG_ALIGN(size_of::<cmsghdr>()) as isize) |
| 1399 |
} |
| 1400 |
|
| 1401 |
pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { |
| 1402 |
(CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::<cmsghdr>())) as c_uint |
| 1403 |
} |
| 1404 |
|
| 1405 |
pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint { |
| 1406 |
CMSG_ALIGN(size_of::<cmsghdr>()) as c_uint + length |
| 1407 |
} |
| 1408 |
|
| 1409 |
pub unsafe fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { |
| 1410 |
if cmsg.is_null() { |
| 1411 |
return crate::CMSG_FIRSTHDR(mhdr); |
| 1412 |
} |
| 1413 |
let next = cmsg as usize |
| 1414 |
+ CMSG_ALIGN((*cmsg).cmsg_len as usize) |
| 1415 |
+ CMSG_ALIGN(size_of::<cmsghdr>()); |
| 1416 |
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1417 |
if next > max { |
| 1418 |
ptr::null_mut() |
| 1419 |
} else { |
| 1420 |
(cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr |
| 1421 |
} |
| 1422 |
} |
| 1423 |
|
| 1424 |
pub unsafe fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { |
| 1425 |
let fd = fd as usize; |
| 1426 |
let size = size_of_val(&(*set).fds_bits[0]) * 8; |
| 1427 |
(*set).fds_bits[fd / size] &= !(1 << (fd % size)); |
| 1428 |
return; |
| 1429 |
} |
| 1430 |
|
| 1431 |
pub unsafe fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { |
| 1432 |
let fd = fd as usize; |
| 1433 |
let size = size_of_val(&(*set).fds_bits[0]) * 8; |
| 1434 |
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; |
| 1435 |
} |
| 1436 |
|
| 1437 |
pub unsafe fn FD_SET(fd: c_int, set: *mut fd_set) -> () { |
| 1438 |
let fd = fd as usize; |
| 1439 |
let size = size_of_val(&(*set).fds_bits[0]) * 8; |
| 1440 |
(*set).fds_bits[fd / size] |= 1 << (fd % size); |
| 1441 |
return; |
| 1442 |
} |
| 1443 |
|
| 1444 |
pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { |
| 1445 |
(*set).fds_bits.fill(0); |
| 1446 |
} |
| 1447 |
} |
| 1448 |
|
| 1449 |
safe_f! { |
| 1450 |
pub const safe fn WIFEXITED(status: c_int) -> bool { |
| 1451 |
(status & !0xff) == 0 |
| 1452 |
} |
| 1453 |
|
| 1454 |
pub const safe fn WEXITSTATUS(status: c_int) -> c_int { |
| 1455 |
status & 0xff |
| 1456 |
} |
| 1457 |
|
| 1458 |
pub const safe fn WIFSIGNALED(status: c_int) -> bool { |
| 1459 |
((status >> 8) & 0xff) != 0 |
| 1460 |
} |
| 1461 |
|
| 1462 |
pub const safe fn WTERMSIG(status: c_int) -> c_int { |
| 1463 |
(status >> 8) & 0xff |
| 1464 |
} |
| 1465 |
|
| 1466 |
pub const safe fn WIFSTOPPED(status: c_int) -> bool { |
| 1467 |
((status >> 16) & 0xff) != 0 |
| 1468 |
} |
| 1469 |
|
| 1470 |
pub const safe fn WSTOPSIG(status: c_int) -> c_int { |
| 1471 |
(status >> 16) & 0xff |
| 1472 |
} |
| 1473 |
|
| 1474 |
// actually WIFCORED, but this is used everywhere else |
| 1475 |
pub const safe fn WCOREDUMP(status: c_int) -> bool { |
| 1476 |
(status & 0x10000) != 0 |
| 1477 |
} |
| 1478 |
|
| 1479 |
pub const safe fn WIFCONTINUED(status: c_int) -> bool { |
| 1480 |
(status & 0x20000) != 0 |
| 1481 |
} |
| 1482 |
} |
| 1483 |
|
| 1484 |
extern "C" { |
| 1485 |
pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; |
| 1486 |
pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; |
| 1487 |
pub fn getpriority(which: c_int, who: id_t) -> c_int; |
| 1488 |
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int; |
| 1489 |
|
| 1490 |
pub fn endusershell(); |
| 1491 |
pub fn getpass(prompt: *const c_char) -> *mut c_char; |
| 1492 |
pub fn getusershell() -> *mut c_char; |
| 1493 |
pub fn issetugid() -> c_int; |
| 1494 |
pub fn setusershell(); |
| 1495 |
|
| 1496 |
pub fn utimensat( |
| 1497 |
fd: c_int, |
| 1498 |
path: *const c_char, |
| 1499 |
times: *const crate::timespec, |
| 1500 |
flag: c_int, |
| 1501 |
) -> c_int; |
| 1502 |
pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; |
| 1503 |
pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; |
| 1504 |
pub fn _errnop() -> *mut c_int; |
| 1505 |
|
| 1506 |
pub fn abs(i: c_int) -> c_int; |
| 1507 |
pub fn labs(i: c_long) -> c_long; |
| 1508 |
pub fn rand() -> c_int; |
| 1509 |
pub fn srand(seed: c_uint); |
| 1510 |
pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int; |
| 1511 |
pub fn freeifaddrs(ifa: *mut crate::ifaddrs); |
| 1512 |
pub fn ppoll( |
| 1513 |
fds: *mut crate::pollfd, |
| 1514 |
numfds: crate::nfds_t, |
| 1515 |
timeout: *const crate::timespec, |
| 1516 |
sigMask: *const sigset_t, |
| 1517 |
) -> c_int; |
| 1518 |
|
| 1519 |
pub fn getspent() -> *mut spwd; |
| 1520 |
pub fn getspent_r( |
| 1521 |
pwd: *mut spwd, |
| 1522 |
buf: *mut c_char, |
| 1523 |
bufferSize: size_t, |
| 1524 |
res: *mut *mut spwd, |
| 1525 |
) -> c_int; |
| 1526 |
pub fn setspent(); |
| 1527 |
pub fn endspent(); |
| 1528 |
pub fn getspnam(name: *const c_char) -> *mut spwd; |
| 1529 |
pub fn getspnam_r( |
| 1530 |
name: *const c_char, |
| 1531 |
spwd: *mut spwd, |
| 1532 |
buffer: *mut c_char, |
| 1533 |
bufferSize: size_t, |
| 1534 |
res: *mut *mut spwd, |
| 1535 |
) -> c_int; |
| 1536 |
pub fn sgetspent(line: *const c_char) -> *mut spwd; |
| 1537 |
pub fn sgetspent_r( |
| 1538 |
line: *const c_char, |
| 1539 |
spwd: *mut spwd, |
| 1540 |
buffer: *mut c_char, |
| 1541 |
bufferSize: size_t, |
| 1542 |
res: *mut *mut spwd, |
| 1543 |
) -> c_int; |
| 1544 |
pub fn fgetspent(file: *mut crate::FILE) -> *mut spwd; |
| 1545 |
pub fn fgetspent_r( |
| 1546 |
file: *mut crate::FILE, |
| 1547 |
spwd: *mut spwd, |
| 1548 |
buffer: *mut c_char, |
| 1549 |
bufferSize: size_t, |
| 1550 |
res: *mut *mut spwd, |
| 1551 |
) -> c_int; |
| 1552 |
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; |
| 1553 |
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int; |
| 1554 |
pub fn sem_destroy(sem: *mut sem_t) -> c_int; |
| 1555 |
pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int; |
| 1556 |
|
| 1557 |
pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; |
| 1558 |
pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; |
| 1559 |
pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int; |
| 1560 |
pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int; |
| 1561 |
pub fn pthread_create( |
| 1562 |
thread: *mut crate::pthread_t, |
| 1563 |
attr: *const crate::pthread_attr_t, |
| 1564 |
f: extern "C" fn(*mut c_void) -> *mut c_void, |
| 1565 |
value: *mut c_void, |
| 1566 |
) -> c_int; |
| 1567 |
pub fn pthread_attr_getguardsize( |
| 1568 |
attr: *const crate::pthread_attr_t, |
| 1569 |
guardsize: *mut size_t, |
| 1570 |
) -> c_int; |
| 1571 |
pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int; |
| 1572 |
pub fn pthread_attr_getstack( |
| 1573 |
attr: *const crate::pthread_attr_t, |
| 1574 |
stackaddr: *mut *mut c_void, |
| 1575 |
stacksize: *mut size_t, |
| 1576 |
) -> c_int; |
| 1577 |
pub fn pthread_condattr_getclock( |
| 1578 |
attr: *const pthread_condattr_t, |
| 1579 |
clock_id: *mut clockid_t, |
| 1580 |
) -> c_int; |
| 1581 |
pub fn pthread_condattr_setclock( |
| 1582 |
attr: *mut pthread_condattr_t, |
| 1583 |
clock_id: crate::clockid_t, |
| 1584 |
) -> c_int; |
| 1585 |
pub fn valloc(numBytes: size_t) -> *mut c_void; |
| 1586 |
pub fn malloc_usable_size(ptr: *mut c_void) -> size_t; |
| 1587 |
pub fn memalign(align: size_t, size: size_t) -> *mut c_void; |
| 1588 |
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int; |
| 1589 |
pub fn initgroups(name: *const c_char, basegid: crate::gid_t) -> c_int; |
| 1590 |
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int; |
| 1591 |
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1592 |
pub fn dirfd(dirp: *mut crate::DIR) -> c_int; |
| 1593 |
pub fn getnameinfo( |
| 1594 |
sa: *const crate::sockaddr, |
| 1595 |
salen: crate::socklen_t, |
| 1596 |
host: *mut c_char, |
| 1597 |
hostlen: crate::socklen_t, |
| 1598 |
serv: *mut c_char, |
| 1599 |
servlen: crate::socklen_t, |
| 1600 |
flags: c_int, |
| 1601 |
) -> c_int; |
| 1602 |
pub fn pthread_mutex_timedlock( |
| 1603 |
lock: *mut pthread_mutex_t, |
| 1604 |
abstime: *const crate::timespec, |
| 1605 |
) -> c_int; |
| 1606 |
pub fn pthread_sigqueue(thread: crate::pthread_t, sig: c_int, value: crate::sigval) -> c_int; |
| 1607 |
pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int; |
| 1608 |
pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int; |
| 1609 |
pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int; |
| 1610 |
pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int; |
| 1611 |
pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int; |
| 1612 |
pub fn waitid( |
| 1613 |
idtype: idtype_t, |
| 1614 |
id: id_t, |
| 1615 |
infop: *mut crate::siginfo_t, |
| 1616 |
options: c_int, |
| 1617 |
) -> c_int; |
| 1618 |
|
| 1619 |
pub fn glob( |
| 1620 |
pattern: *const c_char, |
| 1621 |
flags: c_int, |
| 1622 |
errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, |
| 1623 |
pglob: *mut crate::glob_t, |
| 1624 |
) -> c_int; |
| 1625 |
pub fn globfree(pglob: *mut crate::glob_t); |
| 1626 |
pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int; |
| 1627 |
pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; |
| 1628 |
pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advice: c_int) -> c_int; |
| 1629 |
pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; |
| 1630 |
|
| 1631 |
pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; |
| 1632 |
pub fn shm_unlink(name: *const c_char) -> c_int; |
| 1633 |
|
| 1634 |
pub fn seekdir(dirp: *mut crate::DIR, loc: c_long); |
| 1635 |
|
| 1636 |
pub fn telldir(dirp: *mut crate::DIR) -> c_long; |
| 1637 |
pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; |
| 1638 |
|
| 1639 |
pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; |
| 1640 |
|
| 1641 |
pub fn recvfrom( |
| 1642 |
socket: c_int, |
| 1643 |
buf: *mut c_void, |
| 1644 |
len: size_t, |
| 1645 |
flags: c_int, |
| 1646 |
addr: *mut crate::sockaddr, |
| 1647 |
addrlen: *mut crate::socklen_t, |
| 1648 |
) -> ssize_t; |
| 1649 |
pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char; |
| 1650 |
|
| 1651 |
pub fn bind( |
| 1652 |
socket: c_int, |
| 1653 |
address: *const crate::sockaddr, |
| 1654 |
address_len: crate::socklen_t, |
| 1655 |
) -> c_int; |
| 1656 |
|
| 1657 |
pub fn accept4( |
| 1658 |
socket: c_int, |
| 1659 |
address: *mut crate::sockaddr, |
| 1660 |
addressLength: *mut crate::socklen_t, |
| 1661 |
flags: c_int, |
| 1662 |
) -> c_int; |
| 1663 |
|
| 1664 |
pub fn writev(fd: c_int, iov: *const crate::iovec, count: c_int) -> ssize_t; |
| 1665 |
pub fn readv(fd: c_int, iov: *const crate::iovec, count: c_int) -> ssize_t; |
| 1666 |
|
| 1667 |
pub fn sendmsg(fd: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t; |
| 1668 |
pub fn recvmsg(fd: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t; |
| 1669 |
|
| 1670 |
// DIFF(main): changed to `*const *mut` in e77f551de9 |
| 1671 |
pub fn execvpe( |
| 1672 |
file: *const c_char, |
| 1673 |
argv: *const *const c_char, |
| 1674 |
environment: *const *const c_char, |
| 1675 |
) -> c_int; |
| 1676 |
|
| 1677 |
pub fn getgrgid_r( |
| 1678 |
gid: crate::gid_t, |
| 1679 |
grp: *mut crate::group, |
| 1680 |
buf: *mut c_char, |
| 1681 |
buflen: size_t, |
| 1682 |
result: *mut *mut crate::group, |
| 1683 |
) -> c_int; |
| 1684 |
pub fn getgrouplist( |
| 1685 |
user: *const c_char, |
| 1686 |
basegroup: crate::gid_t, |
| 1687 |
grouplist: *mut crate::gid_t, |
| 1688 |
groupcount: *mut c_int, |
| 1689 |
) -> c_int; |
| 1690 |
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int; |
| 1691 |
pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int; |
| 1692 |
pub fn sem_close(sem: *mut sem_t) -> c_int; |
| 1693 |
pub fn getdtablesize() -> c_int; |
| 1694 |
pub fn getgrnam_r( |
| 1695 |
name: *const c_char, |
| 1696 |
grp: *mut crate::group, |
| 1697 |
buf: *mut c_char, |
| 1698 |
buflen: size_t, |
| 1699 |
result: *mut *mut crate::group, |
| 1700 |
) -> c_int; |
| 1701 |
pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int; |
| 1702 |
pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t; |
| 1703 |
pub fn getgrnam(name: *const c_char) -> *mut crate::group; |
| 1704 |
pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int; |
| 1705 |
pub fn sem_unlink(name: *const c_char) -> c_int; |
| 1706 |
pub fn getpwnam_r( |
| 1707 |
name: *const c_char, |
| 1708 |
pwd: *mut passwd, |
| 1709 |
buf: *mut c_char, |
| 1710 |
buflen: size_t, |
| 1711 |
result: *mut *mut passwd, |
| 1712 |
) -> c_int; |
| 1713 |
pub fn getpwuid_r( |
| 1714 |
uid: crate::uid_t, |
| 1715 |
pwd: *mut passwd, |
| 1716 |
buf: *mut c_char, |
| 1717 |
buflen: size_t, |
| 1718 |
result: *mut *mut passwd, |
| 1719 |
) -> c_int; |
| 1720 |
pub fn getpwent() -> *mut passwd; |
| 1721 |
pub fn setpwent(); |
| 1722 |
pub fn endpwent(); |
| 1723 |
pub fn endgrent(); |
| 1724 |
pub fn getgrent() -> *mut crate::group; |
| 1725 |
pub fn setgrent(); |
| 1726 |
pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int; |
| 1727 |
pub fn pthread_atfork( |
| 1728 |
prepare: Option<unsafe extern "C" fn()>, |
| 1729 |
parent: Option<unsafe extern "C" fn()>, |
| 1730 |
child: Option<unsafe extern "C" fn()>, |
| 1731 |
) -> c_int; |
| 1732 |
pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group; |
| 1733 |
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE; |
| 1734 |
pub fn sethostname(name: *const c_char, len: size_t) -> c_int; |
| 1735 |
pub fn uname(buf: *mut crate::utsname) -> c_int; |
| 1736 |
pub fn getutxent() -> *mut utmpx; |
| 1737 |
pub fn getutxid(ut: *const utmpx) -> *mut utmpx; |
| 1738 |
pub fn getutxline(ut: *const utmpx) -> *mut utmpx; |
| 1739 |
pub fn pututxline(ut: *const utmpx) -> *mut utmpx; |
| 1740 |
pub fn setutxent(); |
| 1741 |
pub fn endutxent(); |
| 1742 |
pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; |
| 1743 |
|
| 1744 |
pub fn sigtimedwait( |
| 1745 |
set: *const sigset_t, |
| 1746 |
info: *mut siginfo_t, |
| 1747 |
timeout: *const crate::timespec, |
| 1748 |
) -> c_int; |
| 1749 |
pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int; |
| 1750 |
|
| 1751 |
pub fn getitimer(which: c_int, curr_value: *mut crate::itimerval) -> c_int; |
| 1752 |
pub fn setitimer( |
| 1753 |
which: c_int, |
| 1754 |
new_value: *const crate::itimerval, |
| 1755 |
old_value: *mut crate::itimerval, |
| 1756 |
) -> c_int; |
| 1757 |
|
| 1758 |
pub fn regcomp(preg: *mut regex_t, pattern: *const c_char, cflags: c_int) -> c_int; |
| 1759 |
|
| 1760 |
pub fn regexec( |
| 1761 |
preg: *const regex_t, |
| 1762 |
input: *const c_char, |
| 1763 |
nmatch: size_t, |
| 1764 |
pmatch: *mut regmatch_t, |
| 1765 |
eflags: c_int, |
| 1766 |
) -> c_int; |
| 1767 |
|
| 1768 |
pub fn regerror( |
| 1769 |
errcode: c_int, |
| 1770 |
preg: *const regex_t, |
| 1771 |
errbuf: *mut c_char, |
| 1772 |
errbuf_size: size_t, |
| 1773 |
) -> size_t; |
| 1774 |
|
| 1775 |
pub fn regfree(preg: *mut regex_t); |
| 1776 |
|
| 1777 |
pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut msqid_ds) -> c_int; |
| 1778 |
pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int; |
| 1779 |
pub fn msgrcv( |
| 1780 |
msqid: c_int, |
| 1781 |
msgp: *mut c_void, |
| 1782 |
msgsz: size_t, |
| 1783 |
msgtype: c_long, |
| 1784 |
msgflg: c_int, |
| 1785 |
) -> ssize_t; |
| 1786 |
pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int; |
| 1787 |
pub fn semget(key: crate::key_t, nsems: c_int, semflg: c_int) -> c_int; |
| 1788 |
pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int; |
| 1789 |
pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int; |
| 1790 |
pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t; |
| 1791 |
|
| 1792 |
pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
| 1793 |
|
| 1794 |
pub fn lsearch( |
| 1795 |
key: *const c_void, |
| 1796 |
base: *mut c_void, |
| 1797 |
nelp: *mut size_t, |
| 1798 |
width: size_t, |
| 1799 |
compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
| 1800 |
) -> *mut c_void; |
| 1801 |
pub fn lfind( |
| 1802 |
key: *const c_void, |
| 1803 |
base: *const c_void, |
| 1804 |
nelp: *mut size_t, |
| 1805 |
width: size_t, |
| 1806 |
compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
| 1807 |
) -> *mut c_void; |
| 1808 |
pub fn hcreate(nelt: size_t) -> c_int; |
| 1809 |
pub fn hdestroy(); |
| 1810 |
pub fn hsearch(entry: crate::ENTRY, action: crate::ACTION) -> *mut crate::ENTRY; |
| 1811 |
|
| 1812 |
pub fn drand48() -> c_double; |
| 1813 |
pub fn erand48(xseed: *mut c_ushort) -> c_double; |
| 1814 |
pub fn lrand48() -> c_long; |
| 1815 |
pub fn nrand48(xseed: *mut c_ushort) -> c_long; |
| 1816 |
pub fn mrand48() -> c_long; |
| 1817 |
pub fn jrand48(xseed: *mut c_ushort) -> c_long; |
| 1818 |
pub fn srand48(seed: c_long); |
| 1819 |
pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort; |
| 1820 |
pub fn lcong48(p: *mut c_ushort); |
| 1821 |
|
| 1822 |
pub fn clearenv() -> c_int; |
| 1823 |
pub fn ctermid(s: *mut c_char) -> *mut c_char; |
| 1824 |
|
| 1825 |
pub fn sync(); |
| 1826 |
pub fn getpagesize() -> c_int; |
| 1827 |
|
| 1828 |
pub fn brk(addr: *mut c_void) -> c_int; |
| 1829 |
pub fn sbrk(increment: intptr_t) -> *mut c_void; |
| 1830 |
|
| 1831 |
pub fn posix_spawn( |
| 1832 |
pid: *mut crate::pid_t, |
| 1833 |
path: *const c_char, |
| 1834 |
file_actions: *const crate::posix_spawn_file_actions_t, |
| 1835 |
attrp: *const crate::posix_spawnattr_t, |
| 1836 |
argv: *const *mut c_char, |
| 1837 |
envp: *const *mut c_char, |
| 1838 |
) -> c_int; |
| 1839 |
pub fn posix_spawnp( |
| 1840 |
pid: *mut crate::pid_t, |
| 1841 |
file: *const c_char, |
| 1842 |
file_actions: *const crate::posix_spawn_file_actions_t, |
| 1843 |
attrp: *const crate::posix_spawnattr_t, |
| 1844 |
argv: *const *mut c_char, |
| 1845 |
envp: *const *mut c_char, |
| 1846 |
) -> c_int; |
| 1847 |
|
| 1848 |
pub fn posix_spawn_file_actions_init(file_actions: *mut posix_spawn_file_actions_t) -> c_int; |
| 1849 |
pub fn posix_spawn_file_actions_destroy(file_actions: *mut posix_spawn_file_actions_t) |
| 1850 |
-> c_int; |
| 1851 |
pub fn posix_spawn_file_actions_addopen( |
| 1852 |
file_actions: *mut posix_spawn_file_actions_t, |
| 1853 |
fildes: c_int, |
| 1854 |
path: *const c_char, |
| 1855 |
oflag: c_int, |
| 1856 |
mode: mode_t, |
| 1857 |
) -> c_int; |
| 1858 |
pub fn posix_spawn_file_actions_addclose( |
| 1859 |
file_actions: *mut posix_spawn_file_actions_t, |
| 1860 |
fildes: c_int, |
| 1861 |
) -> c_int; |
| 1862 |
pub fn posix_spawn_file_actions_adddup2( |
| 1863 |
file_actions: *mut posix_spawn_file_actions_t, |
| 1864 |
fildes: c_int, |
| 1865 |
newfildes: c_int, |
| 1866 |
) -> c_int; |
| 1867 |
|
| 1868 |
pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int; |
| 1869 |
pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int; |
| 1870 |
pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, _flags: *mut c_short) -> c_int; |
| 1871 |
pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int; |
| 1872 |
pub fn posix_spawnattr_getpgroup( |
| 1873 |
attr: *const posix_spawnattr_t, |
| 1874 |
_pgroup: *mut crate::pid_t, |
| 1875 |
) -> c_int; |
| 1876 |
pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, pgroup: crate::pid_t) -> c_int; |
| 1877 |
pub fn posix_spawnattr_getsigdefault( |
| 1878 |
attr: *const posix_spawnattr_t, |
| 1879 |
sigdefault: *mut crate::sigset_t, |
| 1880 |
) -> c_int; |
| 1881 |
pub fn posix_spawnattr_setsigdefault( |
| 1882 |
attr: *mut posix_spawnattr_t, |
| 1883 |
sigdefault: *const crate::sigset_t, |
| 1884 |
) -> c_int; |
| 1885 |
pub fn posix_spawnattr_getsigmask( |
| 1886 |
attr: *const posix_spawnattr_t, |
| 1887 |
_sigmask: *mut crate::sigset_t, |
| 1888 |
) -> c_int; |
| 1889 |
pub fn posix_spawnattr_setsigmask( |
| 1890 |
attr: *mut posix_spawnattr_t, |
| 1891 |
sigmask: *const crate::sigset_t, |
| 1892 |
) -> c_int; |
| 1893 |
pub fn getopt_long( |
| 1894 |
argc: c_int, |
| 1895 |
argv: *const *mut c_char, |
| 1896 |
optstring: *const c_char, |
| 1897 |
longopts: *const option, |
| 1898 |
longindex: *mut c_int, |
| 1899 |
) -> c_int; |
| 1900 |
pub fn strcasecmp_l( |
| 1901 |
string1: *const c_char, |
| 1902 |
string2: *const c_char, |
| 1903 |
locale: crate::locale_t, |
| 1904 |
) -> c_int; |
| 1905 |
pub fn strncasecmp_l( |
| 1906 |
string1: *const c_char, |
| 1907 |
string2: *const c_char, |
| 1908 |
length: size_t, |
| 1909 |
locale: crate::locale_t, |
| 1910 |
) -> c_int; |
| 1911 |
|
| 1912 |
pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; |
| 1913 |
} |
| 1914 |
|
| 1915 |
#[link(name = "gnu")] |
| 1916 |
extern "C" { |
| 1917 |
pub fn memmem( |
| 1918 |
source: *const c_void, |
| 1919 |
sourceLength: size_t, |
| 1920 |
search: *const c_void, |
| 1921 |
searchLength: size_t, |
| 1922 |
) -> *mut c_void; |
| 1923 |
|
| 1924 |
pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int; |
| 1925 |
pub fn pthread_getname_np( |
| 1926 |
thread: crate::pthread_t, |
| 1927 |
buffer: *mut c_char, |
| 1928 |
length: size_t, |
| 1929 |
) -> c_int; |
| 1930 |
pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int; |
| 1931 |
} |
| 1932 |
|
| 1933 |
cfg_if! { |
| 1934 |
if #[cfg(target_pointer_width = "64")] { |
| 1935 |
mod b64; |
| 1936 |
pub use self::b64::*; |
| 1937 |
} else { |
| 1938 |
mod b32; |
| 1939 |
pub use self::b32::*; |
| 1940 |
} |
| 1941 |
} |
| 1942 |
|
| 1943 |
cfg_if! { |
| 1944 |
if #[cfg(target_arch = "x86")] { |
| 1945 |
// TODO |
| 1946 |
// mod x86; |
| 1947 |
// pub use self::x86::*; |
| 1948 |
} else if #[cfg(target_arch = "x86_64")] { |
| 1949 |
mod x86_64; |
| 1950 |
pub use self::x86_64::*; |
| 1951 |
} else if #[cfg(target_arch = "aarch64")] { |
| 1952 |
// TODO |
| 1953 |
// mod aarch64; |
| 1954 |
// pub use self::aarch64::*; |
| 1955 |
} |
| 1956 |
} |
| 1957 |
|
| 1958 |
mod bsd; |
| 1959 |
pub use self::bsd::*; |
| 1960 |
|
| 1961 |
mod native; |
| 1962 |
pub use self::native::*; |