1 pub type dev_t = u32; 2 pub type c_char = i8; 3 pub type wchar_t = i32; 4 pub type clock_t = u64; 5 pub type ino_t = u64; 6 pub type lwpid_t = i32; 7 pub type nlink_t = u32; 8 pub type blksize_t = i64; 9 pub type clockid_t = ::c_ulong; 10 11 pub type c_long = i64; 12 pub type c_ulong = u64; 13 pub type time_t = i64; 14 pub type suseconds_t = i64; 15 16 pub type uuid_t = ::uuid; 17 18 pub type fsblkcnt_t = u64; 19 pub type fsfilcnt_t = u64; 20 pub type idtype_t = ::c_uint; 21 22 pub type mqd_t = ::c_int; 23 pub type sem_t = *mut sem; 24 25 pub type cpuset_t = cpumask_t; 26 pub type cpu_set_t = cpumask_t; 27 28 pub type register_t = ::c_long; 29 30 #[cfg_attr(feature = "extra_traits", derive(Debug))] 31 pub enum sem {} 32 impl ::Copy for sem {} 33 impl ::Clone for sem { clone(&self) -> sem34 fn clone(&self) -> sem { 35 *self 36 } 37 } 38 39 s! { 40 pub struct kevent { 41 pub ident: ::uintptr_t, 42 pub filter: ::c_short, 43 pub flags: ::c_ushort, 44 pub fflags: ::c_uint, 45 pub data: ::intptr_t, 46 pub udata: *mut ::c_void, 47 } 48 49 pub struct exit_status { 50 pub e_termination: u16, 51 pub e_exit: u16 52 } 53 54 pub struct aiocb { 55 pub aio_fildes: ::c_int, 56 pub aio_offset: ::off_t, 57 pub aio_buf: *mut ::c_void, 58 pub aio_nbytes: ::size_t, 59 pub aio_sigevent: sigevent, 60 pub aio_lio_opcode: ::c_int, 61 pub aio_reqprio: ::c_int, 62 _aio_val: ::c_int, 63 _aio_err: ::c_int 64 } 65 66 pub struct uuid { 67 pub time_low: u32, 68 pub time_mid: u16, 69 pub time_hi_and_version: u16, 70 pub clock_seq_hi_and_reserved: u8, 71 pub clock_seq_low: u8, 72 pub node: [u8; 6], 73 } 74 75 pub struct mq_attr { 76 pub mq_flags: ::c_long, 77 pub mq_maxmsg: ::c_long, 78 pub mq_msgsize: ::c_long, 79 pub mq_curmsgs: ::c_long, 80 } 81 82 pub struct statvfs { 83 pub f_bsize: ::c_ulong, 84 pub f_frsize: ::c_ulong, 85 pub f_blocks: ::fsblkcnt_t, 86 pub f_bfree: ::fsblkcnt_t, 87 pub f_bavail: ::fsblkcnt_t, 88 pub f_files: ::fsfilcnt_t, 89 pub f_ffree: ::fsfilcnt_t, 90 pub f_favail: ::fsfilcnt_t, 91 pub f_fsid: ::c_ulong, 92 pub f_flag: ::c_ulong, 93 pub f_namemax: ::c_ulong, 94 pub f_owner: ::uid_t, 95 pub f_type: ::c_uint, 96 pub f_syncreads: u64, 97 pub f_syncwrites: u64, 98 pub f_asyncreads: u64, 99 pub f_asyncwrites: u64, 100 pub f_fsid_uuid: ::uuid_t, 101 pub f_uid_uuid: ::uuid_t, 102 } 103 104 pub struct stat { 105 pub st_ino: ::ino_t, 106 pub st_nlink: ::nlink_t, 107 pub st_dev: ::dev_t, 108 pub st_mode: ::mode_t, 109 pub st_padding1: u16, 110 pub st_uid: ::uid_t, 111 pub st_gid: ::gid_t, 112 pub st_rdev: ::dev_t, 113 pub st_atime: ::time_t, 114 pub st_atime_nsec: ::c_long, 115 pub st_mtime: ::time_t, 116 pub st_mtime_nsec: ::c_long, 117 pub st_ctime: ::time_t, 118 pub st_ctime_nsec: ::c_long, 119 pub st_size: ::off_t, 120 pub st_blocks: i64, 121 pub st_blksize: u32, 122 pub st_flags: u32, 123 pub st_gen: u32, 124 pub st_lspare: i32, 125 pub st_qspare1: i64, 126 pub st_qspare2: i64, 127 } 128 129 pub struct if_data { 130 pub ifi_type: ::c_uchar, 131 pub ifi_physical: ::c_uchar, 132 pub ifi_addrlen: ::c_uchar, 133 pub ifi_hdrlen: ::c_uchar, 134 pub ifi_recvquota: ::c_uchar, 135 pub ifi_xmitquota: ::c_uchar, 136 pub ifi_mtu: ::c_ulong, 137 pub ifi_metric: ::c_ulong, 138 pub ifi_link_state: ::c_ulong, 139 pub ifi_baudrate: u64, 140 pub ifi_ipackets: ::c_ulong, 141 pub ifi_ierrors: ::c_ulong, 142 pub ifi_opackets: ::c_ulong, 143 pub ifi_oerrors: ::c_ulong, 144 pub ifi_collisions: ::c_ulong, 145 pub ifi_ibytes: ::c_ulong, 146 pub ifi_obytes: ::c_ulong, 147 pub ifi_imcasts: ::c_ulong, 148 pub ifi_omcasts: ::c_ulong, 149 pub ifi_iqdrops: ::c_ulong, 150 pub ifi_noproto: ::c_ulong, 151 pub ifi_hwassist: ::c_ulong, 152 pub ifi_oqdrops: ::c_ulong, 153 pub ifi_lastchange: ::timeval, 154 } 155 156 pub struct if_msghdr { 157 pub ifm_msglen: ::c_ushort, 158 pub ifm_version: ::c_uchar, 159 pub ifm_type: ::c_uchar, 160 pub ifm_addrs: ::c_int, 161 pub ifm_flags: ::c_int, 162 pub ifm_index: ::c_ushort, 163 pub ifm_data: if_data, 164 } 165 166 pub struct sockaddr_dl { 167 pub sdl_len: ::c_uchar, 168 pub sdl_family: ::c_uchar, 169 pub sdl_index: ::c_ushort, 170 pub sdl_type: ::c_uchar, 171 pub sdl_nlen: ::c_uchar, 172 pub sdl_alen: ::c_uchar, 173 pub sdl_slen: ::c_uchar, 174 pub sdl_data: [::c_char; 12], 175 pub sdl_rcf: ::c_ushort, 176 pub sdl_route: [::c_ushort; 16], 177 } 178 179 pub struct xucred { 180 pub cr_version: ::c_uint, 181 pub cr_uid: ::uid_t, 182 pub cr_ngroups: ::c_short, 183 pub cr_groups: [::gid_t; 16], 184 __cr_unused1: *mut ::c_void, 185 } 186 187 pub struct stack_t { 188 pub ss_sp: *mut ::c_char, 189 pub ss_size: ::size_t, 190 pub ss_flags: ::c_int, 191 } 192 193 pub struct cpumask_t { 194 ary: [u64; 4], 195 } 196 } 197 198 s_no_extra_traits! { 199 pub struct utmpx { 200 pub ut_name: [::c_char; 32], 201 pub ut_id: [::c_char; 4], 202 203 pub ut_line: [::c_char; 32], 204 pub ut_host: [::c_char; 256], 205 206 pub ut_unused: [u8; 16], 207 pub ut_session: u16, 208 pub ut_type: u16, 209 pub ut_pid: ::pid_t, 210 ut_exit: exit_status, 211 ut_ss: ::sockaddr_storage, 212 pub ut_tv: ::timeval, 213 pub ut_unused2: [u8; 16], 214 } 215 216 pub struct dirent { 217 pub d_fileno: ::ino_t, 218 pub d_namlen: u16, 219 pub d_type: u8, 220 __unused1: u8, 221 __unused2: u32, 222 pub d_name: [::c_char; 256], 223 } 224 225 pub struct statfs { 226 pub f_bsize: ::c_long, 227 pub f_iosize: ::c_long, 228 pub f_blocks: ::c_long, 229 pub f_bfree: ::c_long, 230 pub f_bavail: ::c_long, 231 pub f_files: ::c_long, 232 pub f_ffree: ::c_long, 233 pub f_fsid: ::fsid_t, 234 pub f_owner: ::uid_t, 235 pub f_type: i32, 236 pub f_flags: i32, 237 pub f_syncwrites: ::c_long, 238 pub f_asyncwrites: ::c_long, 239 pub f_fstypename: [::c_char; 16], 240 pub f_mntonname: [::c_char; 90], 241 pub f_syncreads: ::c_long, 242 pub f_asyncreads: ::c_long, 243 pub f_mntfromname: [::c_char; 90], 244 } 245 246 pub struct sigevent { 247 pub sigev_notify: ::c_int, 248 // The union is 8-byte in size, so it is aligned at a 8-byte offset. 249 #[cfg(target_pointer_width = "64")] 250 __unused1: ::c_int, 251 pub sigev_signo: ::c_int, //actually a union 252 // pad the union 253 #[cfg(target_pointer_width = "64")] 254 __unused2: ::c_int, 255 pub sigev_value: ::sigval, 256 __unused3: *mut ::c_void //actually a function pointer 257 } 258 259 pub struct mcontext_t { 260 pub mc_onstack: register_t, 261 pub mc_rdi: register_t, 262 pub mc_rsi: register_t, 263 pub mc_rdx: register_t, 264 pub mc_rcx: register_t, 265 pub mc_r8: register_t, 266 pub mc_r9: register_t, 267 pub mc_rax: register_t, 268 pub mc_rbx: register_t, 269 pub mc_rbp: register_t, 270 pub mc_r10: register_t, 271 pub mc_r11: register_t, 272 pub mc_r12: register_t, 273 pub mc_r13: register_t, 274 pub mc_r14: register_t, 275 pub mc_r15: register_t, 276 pub mc_xflags: register_t, 277 pub mc_trapno: register_t, 278 pub mc_addr: register_t, 279 pub mc_flags: register_t, 280 pub mc_err: register_t, 281 pub mc_rip: register_t, 282 pub mc_cs: register_t, 283 pub mc_rflags: register_t, 284 pub mc_rsp: register_t, 285 pub mc_ss: register_t, 286 pub mc_len: ::c_uint, 287 pub mc_fpformat: ::c_uint, 288 pub mc_ownedfp: ::c_uint, 289 __reserved: ::c_uint, 290 __unused: [::c_uint; 8], 291 pub mc_fpregs: [[::c_uint; 8]; 32], 292 } 293 294 pub struct ucontext_t { 295 pub uc_sigmask: ::sigset_t, 296 pub uc_mcontext: mcontext_t, 297 pub uc_link: *mut ucontext_t, 298 pub uc_stack: stack_t, 299 pub uc_cofunc: ::Option<unsafe extern "C" fn(uc: *mut ucontext_t, arg: *mut ::c_void)>, 300 pub uc_arg: *mut ::c_void, 301 __pad: [::c_int; 4], 302 } 303 } 304 305 cfg_if! { 306 if #[cfg(feature = "extra_traits")] { 307 impl PartialEq for utmpx { 308 fn eq(&self, other: &utmpx) -> bool { 309 self.ut_name == other.ut_name 310 && self.ut_id == other.ut_id 311 && self.ut_line == other.ut_line 312 && self 313 .ut_host 314 .iter() 315 .zip(other.ut_host.iter()) 316 .all(|(a,b)| a == b) 317 && self.ut_unused == other.ut_unused 318 && self.ut_session == other.ut_session 319 && self.ut_type == other.ut_type 320 && self.ut_pid == other.ut_pid 321 && self.ut_exit == other.ut_exit 322 && self.ut_ss == other.ut_ss 323 && self.ut_tv == other.ut_tv 324 && self.ut_unused2 == other.ut_unused2 325 } 326 } 327 impl Eq for utmpx {} 328 impl ::fmt::Debug for utmpx { 329 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 330 f.debug_struct("utmpx") 331 .field("ut_name", &self.ut_name) 332 .field("ut_id", &self.ut_id) 333 .field("ut_line", &self.ut_line) 334 // FIXME: .field("ut_host", &self.ut_host) 335 .field("ut_unused", &self.ut_unused) 336 .field("ut_session", &self.ut_session) 337 .field("ut_type", &self.ut_type) 338 .field("ut_pid", &self.ut_pid) 339 .field("ut_exit", &self.ut_exit) 340 .field("ut_ss", &self.ut_ss) 341 .field("ut_tv", &self.ut_tv) 342 .field("ut_unused2", &self.ut_unused2) 343 .finish() 344 } 345 } 346 impl ::hash::Hash for utmpx { 347 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 348 self.ut_name.hash(state); 349 self.ut_id.hash(state); 350 self.ut_line.hash(state); 351 self.ut_host.hash(state); 352 self.ut_unused.hash(state); 353 self.ut_session.hash(state); 354 self.ut_type.hash(state); 355 self.ut_pid.hash(state); 356 self.ut_exit.hash(state); 357 self.ut_ss.hash(state); 358 self.ut_tv.hash(state); 359 self.ut_unused2.hash(state); 360 } 361 } 362 363 impl PartialEq for dirent { 364 fn eq(&self, other: &dirent) -> bool { 365 self.d_fileno == other.d_fileno 366 && self.d_namlen == other.d_namlen 367 && self.d_type == other.d_type 368 // Ignore __unused1 369 // Ignore __unused2 370 && self 371 .d_name 372 .iter() 373 .zip(other.d_name.iter()) 374 .all(|(a,b)| a == b) 375 } 376 } 377 impl Eq for dirent {} 378 impl ::fmt::Debug for dirent { 379 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 380 f.debug_struct("dirent") 381 .field("d_fileno", &self.d_fileno) 382 .field("d_namlen", &self.d_namlen) 383 .field("d_type", &self.d_type) 384 // Ignore __unused1 385 // Ignore __unused2 386 // FIXME: .field("d_name", &self.d_name) 387 .finish() 388 } 389 } 390 impl ::hash::Hash for dirent { 391 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 392 self.d_fileno.hash(state); 393 self.d_namlen.hash(state); 394 self.d_type.hash(state); 395 // Ignore __unused1 396 // Ignore __unused2 397 self.d_name.hash(state); 398 } 399 } 400 401 impl PartialEq for statfs { 402 fn eq(&self, other: &statfs) -> bool { 403 self.f_bsize == other.f_bsize 404 && self.f_iosize == other.f_iosize 405 && self.f_blocks == other.f_blocks 406 && self.f_bfree == other.f_bfree 407 && self.f_bavail == other.f_bavail 408 && self.f_files == other.f_files 409 && self.f_ffree == other.f_ffree 410 && self.f_fsid == other.f_fsid 411 && self.f_owner == other.f_owner 412 && self.f_type == other.f_type 413 && self.f_flags == other.f_flags 414 && self.f_syncwrites == other.f_syncwrites 415 && self.f_asyncwrites == other.f_asyncwrites 416 && self.f_fstypename == other.f_fstypename 417 && self 418 .f_mntonname 419 .iter() 420 .zip(other.f_mntonname.iter()) 421 .all(|(a,b)| a == b) 422 && self.f_syncreads == other.f_syncreads 423 && self.f_asyncreads == other.f_asyncreads 424 && self 425 .f_mntfromname 426 .iter() 427 .zip(other.f_mntfromname.iter()) 428 .all(|(a,b)| a == b) 429 } 430 } 431 impl Eq for statfs {} 432 impl ::fmt::Debug for statfs { 433 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 434 f.debug_struct("statfs") 435 .field("f_bsize", &self.f_bsize) 436 .field("f_iosize", &self.f_iosize) 437 .field("f_blocks", &self.f_blocks) 438 .field("f_bfree", &self.f_bfree) 439 .field("f_bavail", &self.f_bavail) 440 .field("f_files", &self.f_files) 441 .field("f_ffree", &self.f_ffree) 442 .field("f_fsid", &self.f_fsid) 443 .field("f_owner", &self.f_owner) 444 .field("f_type", &self.f_type) 445 .field("f_flags", &self.f_flags) 446 .field("f_syncwrites", &self.f_syncwrites) 447 .field("f_asyncwrites", &self.f_asyncwrites) 448 // FIXME: .field("f_mntonname", &self.f_mntonname) 449 .field("f_syncreads", &self.f_syncreads) 450 .field("f_asyncreads", &self.f_asyncreads) 451 // FIXME: .field("f_mntfromname", &self.f_mntfromname) 452 .finish() 453 } 454 } 455 impl ::hash::Hash for statfs { 456 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 457 self.f_bsize.hash(state); 458 self.f_iosize.hash(state); 459 self.f_blocks.hash(state); 460 self.f_bfree.hash(state); 461 self.f_bavail.hash(state); 462 self.f_files.hash(state); 463 self.f_ffree.hash(state); 464 self.f_fsid.hash(state); 465 self.f_owner.hash(state); 466 self.f_type.hash(state); 467 self.f_flags.hash(state); 468 self.f_syncwrites.hash(state); 469 self.f_asyncwrites.hash(state); 470 self.f_fstypename.hash(state); 471 self.f_mntonname.hash(state); 472 self.f_syncreads.hash(state); 473 self.f_asyncreads.hash(state); 474 self.f_mntfromname.hash(state); 475 } 476 } 477 478 impl PartialEq for sigevent { 479 fn eq(&self, other: &sigevent) -> bool { 480 self.sigev_notify == other.sigev_notify 481 && self.sigev_signo == other.sigev_signo 482 && self.sigev_value == other.sigev_value 483 } 484 } 485 impl Eq for sigevent {} 486 impl ::fmt::Debug for sigevent { 487 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 488 f.debug_struct("sigevent") 489 .field("sigev_notify", &self.sigev_notify) 490 .field("sigev_signo", &self.sigev_signo) 491 .field("sigev_value", &self.sigev_value) 492 .finish() 493 } 494 } 495 impl ::hash::Hash for sigevent { 496 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 497 self.sigev_notify.hash(state); 498 self.sigev_signo.hash(state); 499 self.sigev_value.hash(state); 500 } 501 } 502 impl PartialEq for mcontext_t { 503 fn eq(&self, other: &mcontext_t) -> bool { 504 self.mc_onstack == other.mc_onstack && 505 self.mc_rdi == other.mc_rdi && 506 self.mc_rsi == other.mc_rsi && 507 self.mc_rdx == other.mc_rdx && 508 self.mc_rcx == other.mc_rcx && 509 self.mc_r8 == other.mc_r8 && 510 self.mc_r9 == other.mc_r9 && 511 self.mc_rax == other.mc_rax && 512 self.mc_rbx == other.mc_rbx && 513 self.mc_rbp == other.mc_rbp && 514 self.mc_r10 == other.mc_r10 && 515 self.mc_r11 == other.mc_r11 && 516 self.mc_r12 == other.mc_r12 && 517 self.mc_r13 == other.mc_r13 && 518 self.mc_r14 == other.mc_r14 && 519 self.mc_r15 == other.mc_r15 && 520 self.mc_xflags == other.mc_xflags && 521 self.mc_trapno == other.mc_trapno && 522 self.mc_addr == other.mc_addr && 523 self.mc_flags == other.mc_flags && 524 self.mc_err == other.mc_err && 525 self.mc_rip == other.mc_rip && 526 self.mc_cs == other.mc_cs && 527 self.mc_rflags == other.mc_rflags && 528 self.mc_rsp == other.mc_rsp && 529 self.mc_ss == other.mc_ss && 530 self.mc_len == other.mc_len && 531 self.mc_fpformat == other.mc_fpformat && 532 self.mc_ownedfp == other.mc_ownedfp 533 // FIXME: self.mc_fpregs == other.mc_fpregs 534 } 535 } 536 impl Eq for mcontext_t {} 537 impl ::fmt::Debug for mcontext_t { 538 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 539 f.debug_struct("mcontext_t") 540 .field("mc_onstack", &self.mc_onstack) 541 .field("mc_rdi", &self.mc_rdi) 542 .field("mc_rsi", &self.mc_rsi) 543 .field("mc_rdx", &self.mc_rdx) 544 .field("mc_rcx", &self.mc_rcx) 545 .field("mc_r8", &self.mc_r8) 546 .field("mc_r9", &self.mc_r9) 547 .field("mc_rax", &self.mc_rax) 548 .field("mc_rbx", &self.mc_rbx) 549 .field("mc_rbp", &self.mc_rbp) 550 .field("mc_r10", &self.mc_r10) 551 .field("mc_r11", &self.mc_r11) 552 .field("mc_r12", &self.mc_r12) 553 .field("mc_r13", &self.mc_r13) 554 .field("mc_r14", &self.mc_r14) 555 .field("mc_r15", &self.mc_r15) 556 .field("mc_xflags", &self.mc_xflags) 557 .field("mc_trapno", &self.mc_trapno) 558 .field("mc_addr", &self.mc_addr) 559 .field("mc_flags", &self.mc_flags) 560 .field("mc_err", &self.mc_err) 561 .field("mc_rip", &self.mc_rip) 562 .field("mc_cs", &self.mc_cs) 563 .field("mc_rflags", &self.mc_rflags) 564 .field("mc_rsp", &self.mc_rsp) 565 .field("mc_ss", &self.mc_ss) 566 .field("mc_len", &self.mc_len) 567 .field("mc_fpformat", &self.mc_fpformat) 568 .field("mc_ownedfp", &self.mc_ownedfp) 569 // FIXME: .field("mc_fpregs", &self.mc_fpregs) 570 .finish() 571 } 572 } 573 impl PartialEq for ucontext_t { 574 fn eq(&self, other: &ucontext_t) -> bool { 575 self.uc_sigmask == other.uc_sigmask 576 && self.uc_mcontext == other.uc_mcontext 577 && self.uc_link == other.uc_link 578 && self.uc_stack == other.uc_stack 579 && self.uc_cofunc == other.uc_cofunc 580 && self.uc_arg == other.uc_arg 581 } 582 } 583 impl Eq for ucontext_t {} 584 impl ::fmt::Debug for ucontext_t { 585 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 586 f.debug_struct("ucontext_t") 587 .field("uc_sigmask", &self.uc_sigmask) 588 .field("uc_mcontext", &self.uc_mcontext) 589 .field("uc_link", &self.uc_link) 590 .field("uc_stack", &self.uc_stack) 591 .field("uc_cofunc", &self.uc_cofunc) 592 .field("uc_arg", &self.uc_arg) 593 .finish() 594 } 595 } 596 } 597 } 598 599 pub const RAND_MAX: ::c_int = 0x7fff_ffff; 600 pub const PTHREAD_STACK_MIN: ::size_t = 16384; 601 pub const SIGSTKSZ: ::size_t = 40960; 602 pub const MADV_INVAL: ::c_int = 10; 603 pub const MADV_SETMAP: ::c_int = 11; 604 pub const O_CLOEXEC: ::c_int = 0x00020000; 605 pub const O_DIRECTORY: ::c_int = 0x08000000; 606 pub const F_GETLK: ::c_int = 7; 607 pub const F_SETLK: ::c_int = 8; 608 pub const F_SETLKW: ::c_int = 9; 609 pub const ENOMEDIUM: ::c_int = 93; 610 pub const EASYNC: ::c_int = 99; 611 pub const ELAST: ::c_int = 99; 612 pub const RLIMIT_POSIXLOCKS: ::c_int = 11; 613 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 614 pub const RLIM_NLIMITS: ::rlim_t = 12; 615 616 pub const Q_GETQUOTA: ::c_int = 0x300; 617 pub const Q_SETQUOTA: ::c_int = 0x400; 618 619 pub const CTL_UNSPEC: ::c_int = 0; 620 pub const CTL_KERN: ::c_int = 1; 621 pub const CTL_VM: ::c_int = 2; 622 pub const CTL_VFS: ::c_int = 3; 623 pub const CTL_NET: ::c_int = 4; 624 pub const CTL_DEBUG: ::c_int = 5; 625 pub const CTL_HW: ::c_int = 6; 626 pub const CTL_MACHDEP: ::c_int = 7; 627 pub const CTL_USER: ::c_int = 8; 628 pub const CTL_P1003_1B: ::c_int = 9; 629 pub const CTL_LWKT: ::c_int = 10; 630 pub const CTL_MAXID: ::c_int = 11; 631 pub const KERN_OSTYPE: ::c_int = 1; 632 pub const KERN_OSRELEASE: ::c_int = 2; 633 pub const KERN_OSREV: ::c_int = 3; 634 pub const KERN_VERSION: ::c_int = 4; 635 pub const KERN_MAXVNODES: ::c_int = 5; 636 pub const KERN_MAXPROC: ::c_int = 6; 637 pub const KERN_MAXFILES: ::c_int = 7; 638 pub const KERN_ARGMAX: ::c_int = 8; 639 pub const KERN_SECURELVL: ::c_int = 9; 640 pub const KERN_HOSTNAME: ::c_int = 10; 641 pub const KERN_HOSTID: ::c_int = 11; 642 pub const KERN_CLOCKRATE: ::c_int = 12; 643 pub const KERN_VNODE: ::c_int = 13; 644 pub const KERN_PROC: ::c_int = 14; 645 pub const KERN_FILE: ::c_int = 15; 646 pub const KERN_PROF: ::c_int = 16; 647 pub const KERN_POSIX1: ::c_int = 17; 648 pub const KERN_NGROUPS: ::c_int = 18; 649 pub const KERN_JOB_CONTROL: ::c_int = 19; 650 pub const KERN_SAVED_IDS: ::c_int = 20; 651 pub const KERN_BOOTTIME: ::c_int = 21; 652 pub const KERN_NISDOMAINNAME: ::c_int = 22; 653 pub const KERN_UPDATEINTERVAL: ::c_int = 23; 654 pub const KERN_OSRELDATE: ::c_int = 24; 655 pub const KERN_NTP_PLL: ::c_int = 25; 656 pub const KERN_BOOTFILE: ::c_int = 26; 657 pub const KERN_MAXFILESPERPROC: ::c_int = 27; 658 pub const KERN_MAXPROCPERUID: ::c_int = 28; 659 pub const KERN_DUMPDEV: ::c_int = 29; 660 pub const KERN_IPC: ::c_int = 30; 661 pub const KERN_DUMMY: ::c_int = 31; 662 pub const KERN_PS_STRINGS: ::c_int = 32; 663 pub const KERN_USRSTACK: ::c_int = 33; 664 pub const KERN_LOGSIGEXIT: ::c_int = 34; 665 pub const KERN_IOV_MAX: ::c_int = 35; 666 pub const KERN_MAXPOSIXLOCKSPERUID: ::c_int = 36; 667 pub const KERN_MAXID: ::c_int = 37; 668 pub const KERN_PROC_ALL: ::c_int = 0; 669 pub const KERN_PROC_PID: ::c_int = 1; 670 pub const KERN_PROC_PGRP: ::c_int = 2; 671 pub const KERN_PROC_SESSION: ::c_int = 3; 672 pub const KERN_PROC_TTY: ::c_int = 4; 673 pub const KERN_PROC_UID: ::c_int = 5; 674 pub const KERN_PROC_RUID: ::c_int = 6; 675 pub const KERN_PROC_ARGS: ::c_int = 7; 676 pub const KERN_PROC_CWD: ::c_int = 8; 677 pub const KERN_PROC_PATHNAME: ::c_int = 9; 678 pub const KERN_PROC_FLAGMASK: ::c_int = 0x10; 679 pub const KERN_PROC_FLAG_LWP: ::c_int = 0x10; 680 pub const KIPC_MAXSOCKBUF: ::c_int = 1; 681 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; 682 pub const KIPC_SOMAXCONN: ::c_int = 3; 683 pub const KIPC_MAX_LINKHDR: ::c_int = 4; 684 pub const KIPC_MAX_PROTOHDR: ::c_int = 5; 685 pub const KIPC_MAX_HDR: ::c_int = 6; 686 pub const KIPC_MAX_DATALEN: ::c_int = 7; 687 pub const KIPC_MBSTAT: ::c_int = 8; 688 pub const KIPC_NMBCLUSTERS: ::c_int = 9; 689 pub const HW_MACHINE: ::c_int = 1; 690 pub const HW_MODEL: ::c_int = 2; 691 pub const HW_NCPU: ::c_int = 3; 692 pub const HW_BYTEORDER: ::c_int = 4; 693 pub const HW_PHYSMEM: ::c_int = 5; 694 pub const HW_USERMEM: ::c_int = 6; 695 pub const HW_PAGESIZE: ::c_int = 7; 696 pub const HW_DISKNAMES: ::c_int = 8; 697 pub const HW_DISKSTATS: ::c_int = 9; 698 pub const HW_FLOATINGPT: ::c_int = 10; 699 pub const HW_MACHINE_ARCH: ::c_int = 11; 700 pub const HW_MACHINE_PLATFORM: ::c_int = 12; 701 pub const HW_SENSORS: ::c_int = 13; 702 pub const HW_MAXID: ::c_int = 14; 703 pub const USER_CS_PATH: ::c_int = 1; 704 pub const USER_BC_BASE_MAX: ::c_int = 2; 705 pub const USER_BC_DIM_MAX: ::c_int = 3; 706 pub const USER_BC_SCALE_MAX: ::c_int = 4; 707 pub const USER_BC_STRING_MAX: ::c_int = 5; 708 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6; 709 pub const USER_EXPR_NEST_MAX: ::c_int = 7; 710 pub const USER_LINE_MAX: ::c_int = 8; 711 pub const USER_RE_DUP_MAX: ::c_int = 9; 712 pub const USER_POSIX2_VERSION: ::c_int = 10; 713 pub const USER_POSIX2_C_BIND: ::c_int = 11; 714 pub const USER_POSIX2_C_DEV: ::c_int = 12; 715 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13; 716 pub const USER_POSIX2_FORT_DEV: ::c_int = 14; 717 pub const USER_POSIX2_FORT_RUN: ::c_int = 15; 718 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16; 719 pub const USER_POSIX2_SW_DEV: ::c_int = 17; 720 pub const USER_POSIX2_UPE: ::c_int = 18; 721 pub const USER_STREAM_MAX: ::c_int = 19; 722 pub const USER_TZNAME_MAX: ::c_int = 20; 723 pub const USER_MAXID: ::c_int = 21; 724 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1; 725 pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2; 726 pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3; 727 pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4; 728 pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5; 729 pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6; 730 pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7; 731 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8; 732 pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9; 733 pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10; 734 pub const CTL_P1003_1B_FSYNC: ::c_int = 11; 735 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12; 736 pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13; 737 pub const CTL_P1003_1B_TIMERS: ::c_int = 14; 738 pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15; 739 pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16; 740 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17; 741 pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18; 742 pub const CTL_P1003_1B_UNUSED1: ::c_int = 19; 743 pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20; 744 pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21; 745 pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22; 746 pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23; 747 pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24; 748 pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; 749 pub const CTL_P1003_1B_MAXID: ::c_int = 26; 750 751 pub const EVFILT_READ: i16 = -1; 752 pub const EVFILT_WRITE: i16 = -2; 753 pub const EVFILT_AIO: i16 = -3; 754 pub const EVFILT_VNODE: i16 = -4; 755 pub const EVFILT_PROC: i16 = -5; 756 pub const EVFILT_SIGNAL: i16 = -6; 757 pub const EVFILT_TIMER: i16 = -7; 758 pub const EVFILT_EXCEPT: i16 = -8; 759 pub const EVFILT_USER: i16 = -9; 760 pub const EVFILT_FS: i16 = -10; 761 762 pub const EV_ADD: u16 = 0x1; 763 pub const EV_DELETE: u16 = 0x2; 764 pub const EV_ENABLE: u16 = 0x4; 765 pub const EV_DISABLE: u16 = 0x8; 766 pub const EV_ONESHOT: u16 = 0x10; 767 pub const EV_CLEAR: u16 = 0x20; 768 pub const EV_RECEIPT: u16 = 0x40; 769 pub const EV_DISPATCH: u16 = 0x80; 770 pub const EV_NODATA: u16 = 0x1000; 771 pub const EV_FLAG1: u16 = 0x2000; 772 pub const EV_ERROR: u16 = 0x4000; 773 pub const EV_EOF: u16 = 0x8000; 774 pub const EV_SYSFLAGS: u16 = 0xf000; 775 776 pub const NOTE_TRIGGER: u32 = 0x01000000; 777 pub const NOTE_FFNOP: u32 = 0x00000000; 778 pub const NOTE_FFAND: u32 = 0x40000000; 779 pub const NOTE_FFOR: u32 = 0x80000000; 780 pub const NOTE_FFCOPY: u32 = 0xc0000000; 781 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; 782 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; 783 pub const NOTE_LOWAT: u32 = 0x00000001; 784 pub const NOTE_OOB: u32 = 0x00000002; 785 pub const NOTE_DELETE: u32 = 0x00000001; 786 pub const NOTE_WRITE: u32 = 0x00000002; 787 pub const NOTE_EXTEND: u32 = 0x00000004; 788 pub const NOTE_ATTRIB: u32 = 0x00000008; 789 pub const NOTE_LINK: u32 = 0x00000010; 790 pub const NOTE_RENAME: u32 = 0x00000020; 791 pub const NOTE_REVOKE: u32 = 0x00000040; 792 pub const NOTE_EXIT: u32 = 0x80000000; 793 pub const NOTE_FORK: u32 = 0x40000000; 794 pub const NOTE_EXEC: u32 = 0x20000000; 795 pub const NOTE_PDATAMASK: u32 = 0x000fffff; 796 pub const NOTE_PCTRLMASK: u32 = 0xf0000000; 797 pub const NOTE_TRACK: u32 = 0x00000001; 798 pub const NOTE_TRACKERR: u32 = 0x00000002; 799 pub const NOTE_CHILD: u32 = 0x00000004; 800 801 pub const SO_SNDSPACE: ::c_int = 0x100a; 802 pub const SO_CPUHINT: ::c_int = 0x1030; 803 804 pub const PT_FIRSTMACH: ::c_int = 32; 805 806 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101 807 pub const IFF_UP: ::c_int = 0x1; // interface is up 808 pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid 809 pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging 810 pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net 811 pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link 812 pub const IFF_SMART: ::c_int = 0x20; // interface manages own routes 813 pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated 814 pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol 815 pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets 816 pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets 817 pub const IFF_OACTIVE_COMPAT: ::c_int = 0x400; // was transmission in progress 818 pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions 819 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit 820 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit 821 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit 822 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection 823 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast 824 // was interface is in polling mode 825 pub const IFF_POLLING_COMPAT: ::c_int = 0x10000; 826 pub const IFF_PPROMISC: ::c_int = 0x20000; // user-requested promisc mode 827 pub const IFF_MONITOR: ::c_int = 0x40000; // user-requested monitor mode 828 pub const IFF_STATICARP: ::c_int = 0x80000; // static ARP 829 pub const IFF_NPOLLING: ::c_int = 0x100000; // interface is in polling mode 830 pub const IFF_IDIRECT: ::c_int = 0x200000; // direct input 831 832 // 833 // sys/netinet/in.h 834 // Protocols (RFC 1700) 835 // NOTE: These are in addition to the constants defined in src/unix/mod.rs 836 837 // IPPROTO_IP defined in src/unix/mod.rs 838 /// IP6 hop-by-hop options 839 pub const IPPROTO_HOPOPTS: ::c_int = 0; 840 // IPPROTO_ICMP defined in src/unix/mod.rs 841 /// group mgmt protocol 842 pub const IPPROTO_IGMP: ::c_int = 2; 843 /// gateway^2 (deprecated) 844 pub const IPPROTO_GGP: ::c_int = 3; 845 /// for compatibility 846 pub const IPPROTO_IPIP: ::c_int = 4; 847 // IPPROTO_TCP defined in src/unix/mod.rs 848 /// Stream protocol II. 849 pub const IPPROTO_ST: ::c_int = 7; 850 /// exterior gateway protocol 851 pub const IPPROTO_EGP: ::c_int = 8; 852 /// private interior gateway 853 pub const IPPROTO_PIGP: ::c_int = 9; 854 /// BBN RCC Monitoring 855 pub const IPPROTO_RCCMON: ::c_int = 10; 856 /// network voice protocol 857 pub const IPPROTO_NVPII: ::c_int = 11; 858 /// pup 859 pub const IPPROTO_PUP: ::c_int = 12; 860 /// Argus 861 pub const IPPROTO_ARGUS: ::c_int = 13; 862 /// EMCON 863 pub const IPPROTO_EMCON: ::c_int = 14; 864 /// Cross Net Debugger 865 pub const IPPROTO_XNET: ::c_int = 15; 866 /// Chaos 867 pub const IPPROTO_CHAOS: ::c_int = 16; 868 // IPPROTO_UDP defined in src/unix/mod.rs 869 /// Multiplexing 870 pub const IPPROTO_MUX: ::c_int = 18; 871 /// DCN Measurement Subsystems 872 pub const IPPROTO_MEAS: ::c_int = 19; 873 /// Host Monitoring 874 pub const IPPROTO_HMP: ::c_int = 20; 875 /// Packet Radio Measurement 876 pub const IPPROTO_PRM: ::c_int = 21; 877 /// xns idp 878 pub const IPPROTO_IDP: ::c_int = 22; 879 /// Trunk-1 880 pub const IPPROTO_TRUNK1: ::c_int = 23; 881 /// Trunk-2 882 pub const IPPROTO_TRUNK2: ::c_int = 24; 883 /// Leaf-1 884 pub const IPPROTO_LEAF1: ::c_int = 25; 885 /// Leaf-2 886 pub const IPPROTO_LEAF2: ::c_int = 26; 887 /// Reliable Data 888 pub const IPPROTO_RDP: ::c_int = 27; 889 /// Reliable Transaction 890 pub const IPPROTO_IRTP: ::c_int = 28; 891 /// tp-4 w/ class negotiation 892 pub const IPPROTO_TP: ::c_int = 29; 893 /// Bulk Data Transfer 894 pub const IPPROTO_BLT: ::c_int = 30; 895 /// Network Services 896 pub const IPPROTO_NSP: ::c_int = 31; 897 /// Merit Internodal 898 pub const IPPROTO_INP: ::c_int = 32; 899 /// Sequential Exchange 900 pub const IPPROTO_SEP: ::c_int = 33; 901 /// Third Party Connect 902 pub const IPPROTO_3PC: ::c_int = 34; 903 /// InterDomain Policy Routing 904 pub const IPPROTO_IDPR: ::c_int = 35; 905 /// XTP 906 pub const IPPROTO_XTP: ::c_int = 36; 907 /// Datagram Delivery 908 pub const IPPROTO_DDP: ::c_int = 37; 909 /// Control Message Transport 910 pub const IPPROTO_CMTP: ::c_int = 38; 911 /// TP++ Transport 912 pub const IPPROTO_TPXX: ::c_int = 39; 913 /// IL transport protocol 914 pub const IPPROTO_IL: ::c_int = 40; 915 // IPPROTO_IPV6 defined in src/unix/mod.rs 916 /// Source Demand Routing 917 pub const IPPROTO_SDRP: ::c_int = 42; 918 /// IP6 routing header 919 pub const IPPROTO_ROUTING: ::c_int = 43; 920 /// IP6 fragmentation header 921 pub const IPPROTO_FRAGMENT: ::c_int = 44; 922 /// InterDomain Routing 923 pub const IPPROTO_IDRP: ::c_int = 45; 924 /// resource reservation 925 pub const IPPROTO_RSVP: ::c_int = 46; 926 /// General Routing Encap. 927 pub const IPPROTO_GRE: ::c_int = 47; 928 /// Mobile Host Routing 929 pub const IPPROTO_MHRP: ::c_int = 48; 930 /// BHA 931 pub const IPPROTO_BHA: ::c_int = 49; 932 /// IP6 Encap Sec. Payload 933 pub const IPPROTO_ESP: ::c_int = 50; 934 /// IP6 Auth Header 935 pub const IPPROTO_AH: ::c_int = 51; 936 /// Integ. Net Layer Security 937 pub const IPPROTO_INLSP: ::c_int = 52; 938 /// IP with encryption 939 pub const IPPROTO_SWIPE: ::c_int = 53; 940 /// Next Hop Resolution 941 pub const IPPROTO_NHRP: ::c_int = 54; 942 /// IP Mobility 943 pub const IPPROTO_MOBILE: ::c_int = 55; 944 /// Transport Layer Security 945 pub const IPPROTO_TLSP: ::c_int = 56; 946 /// SKIP 947 pub const IPPROTO_SKIP: ::c_int = 57; 948 // IPPROTO_ICMPV6 defined in src/unix/mod.rs 949 /// IP6 no next header 950 pub const IPPROTO_NONE: ::c_int = 59; 951 /// IP6 destination option 952 pub const IPPROTO_DSTOPTS: ::c_int = 60; 953 /// any host internal protocol 954 pub const IPPROTO_AHIP: ::c_int = 61; 955 /// CFTP 956 pub const IPPROTO_CFTP: ::c_int = 62; 957 /// "hello" routing protocol 958 pub const IPPROTO_HELLO: ::c_int = 63; 959 /// SATNET/Backroom EXPAK 960 pub const IPPROTO_SATEXPAK: ::c_int = 64; 961 /// Kryptolan 962 pub const IPPROTO_KRYPTOLAN: ::c_int = 65; 963 /// Remote Virtual Disk 964 pub const IPPROTO_RVD: ::c_int = 66; 965 /// Pluribus Packet Core 966 pub const IPPROTO_IPPC: ::c_int = 67; 967 /// Any distributed FS 968 pub const IPPROTO_ADFS: ::c_int = 68; 969 /// Satnet Monitoring 970 pub const IPPROTO_SATMON: ::c_int = 69; 971 /// VISA Protocol 972 pub const IPPROTO_VISA: ::c_int = 70; 973 /// Packet Core Utility 974 pub const IPPROTO_IPCV: ::c_int = 71; 975 /// Comp. Prot. Net. Executive 976 pub const IPPROTO_CPNX: ::c_int = 72; 977 /// Comp. Prot. HeartBeat 978 pub const IPPROTO_CPHB: ::c_int = 73; 979 /// Wang Span Network 980 pub const IPPROTO_WSN: ::c_int = 74; 981 /// Packet Video Protocol 982 pub const IPPROTO_PVP: ::c_int = 75; 983 /// BackRoom SATNET Monitoring 984 pub const IPPROTO_BRSATMON: ::c_int = 76; 985 /// Sun net disk proto (temp.) 986 pub const IPPROTO_ND: ::c_int = 77; 987 /// WIDEBAND Monitoring 988 pub const IPPROTO_WBMON: ::c_int = 78; 989 /// WIDEBAND EXPAK 990 pub const IPPROTO_WBEXPAK: ::c_int = 79; 991 /// ISO cnlp 992 pub const IPPROTO_EON: ::c_int = 80; 993 /// VMTP 994 pub const IPPROTO_VMTP: ::c_int = 81; 995 /// Secure VMTP 996 pub const IPPROTO_SVMTP: ::c_int = 82; 997 /// Banyon VINES 998 pub const IPPROTO_VINES: ::c_int = 83; 999 /// TTP 1000 pub const IPPROTO_TTP: ::c_int = 84; 1001 /// NSFNET-IGP 1002 pub const IPPROTO_IGP: ::c_int = 85; 1003 /// dissimilar gateway prot. 1004 pub const IPPROTO_DGP: ::c_int = 86; 1005 /// TCF 1006 pub const IPPROTO_TCF: ::c_int = 87; 1007 /// Cisco/GXS IGRP 1008 pub const IPPROTO_IGRP: ::c_int = 88; 1009 /// OSPFIGP 1010 pub const IPPROTO_OSPFIGP: ::c_int = 89; 1011 /// Strite RPC protocol 1012 pub const IPPROTO_SRPC: ::c_int = 90; 1013 /// Locus Address Resoloution 1014 pub const IPPROTO_LARP: ::c_int = 91; 1015 /// Multicast Transport 1016 pub const IPPROTO_MTP: ::c_int = 92; 1017 /// AX.25 Frames 1018 pub const IPPROTO_AX25: ::c_int = 93; 1019 /// IP encapsulated in IP 1020 pub const IPPROTO_IPEIP: ::c_int = 94; 1021 /// Mobile Int.ing control 1022 pub const IPPROTO_MICP: ::c_int = 95; 1023 /// Semaphore Comm. security 1024 pub const IPPROTO_SCCSP: ::c_int = 96; 1025 /// Ethernet IP encapsulation 1026 pub const IPPROTO_ETHERIP: ::c_int = 97; 1027 /// encapsulation header 1028 pub const IPPROTO_ENCAP: ::c_int = 98; 1029 /// any private encr. scheme 1030 pub const IPPROTO_APES: ::c_int = 99; 1031 /// GMTP 1032 pub const IPPROTO_GMTP: ::c_int = 100; 1033 /// payload compression (IPComp) 1034 pub const IPPROTO_IPCOMP: ::c_int = 108; 1035 1036 /* 101-254: Partly Unassigned */ 1037 /// Protocol Independent Mcast 1038 pub const IPPROTO_PIM: ::c_int = 103; 1039 /// CARP 1040 pub const IPPROTO_CARP: ::c_int = 112; 1041 /// PGM 1042 pub const IPPROTO_PGM: ::c_int = 113; 1043 /// PFSYNC 1044 pub const IPPROTO_PFSYNC: ::c_int = 240; 1045 1046 /* 255: Reserved */ 1047 /* BSD Private, local use, namespace incursion, no longer used */ 1048 /// divert pseudo-protocol 1049 pub const IPPROTO_DIVERT: ::c_int = 254; 1050 pub const IPPROTO_MAX: ::c_int = 256; 1051 /// last return value of *_input(), meaning "all job for this pkt is done". 1052 pub const IPPROTO_DONE: ::c_int = 257; 1053 1054 /// Used by RSS: the layer3 protocol is unknown 1055 pub const IPPROTO_UNKNOWN: ::c_int = 258; 1056 1057 // sys/netinet/tcp.h 1058 pub const TCP_SIGNATURE_ENABLE: ::c_int = 16; 1059 pub const TCP_KEEPINIT: ::c_int = 32; 1060 pub const TCP_FASTKEEP: ::c_int = 128; 1061 1062 pub const AF_BLUETOOTH: ::c_int = 33; 1063 pub const AF_MPLS: ::c_int = 34; 1064 pub const AF_IEEE80211: ::c_int = 35; 1065 1066 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 1067 1068 pub const NET_RT_DUMP: ::c_int = 1; 1069 pub const NET_RT_FLAGS: ::c_int = 2; 1070 pub const NET_RT_IFLIST: ::c_int = 3; 1071 pub const NET_RT_MAXID: ::c_int = 4; 1072 1073 pub const SOMAXOPT_SIZE: ::c_int = 65536; 1074 1075 pub const MSG_UNUSED09: ::c_int = 0x00000200; 1076 pub const MSG_NOSIGNAL: ::c_int = 0x00000400; 1077 pub const MSG_SYNC: ::c_int = 0x00000800; 1078 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00001000; 1079 pub const MSG_FBLOCKING: ::c_int = 0x00010000; 1080 pub const MSG_FNONBLOCKING: ::c_int = 0x00020000; 1081 pub const MSG_FMASK: ::c_int = 0xFFFF0000; 1082 1083 // utmpx entry types 1084 pub const EMPTY: ::c_short = 0; 1085 pub const RUN_LVL: ::c_short = 1; 1086 pub const BOOT_TIME: ::c_short = 2; 1087 pub const OLD_TIME: ::c_short = 3; 1088 pub const NEW_TIME: ::c_short = 4; 1089 pub const INIT_PROCESS: ::c_short = 5; 1090 pub const LOGIN_PROCESS: ::c_short = 6; 1091 pub const USER_PROCESS: ::c_short = 7; 1092 pub const DEAD_PROCESS: ::c_short = 8; 1093 pub const ACCOUNTING: ::c_short = 9; 1094 pub const SIGNATURE: ::c_short = 10; 1095 pub const DOWNTIME: ::c_short = 11; 1096 // utmpx database types 1097 pub const UTX_DB_UTMPX: ::c_uint = 0; 1098 pub const UTX_DB_WTMPX: ::c_uint = 1; 1099 pub const UTX_DB_LASTLOG: ::c_uint = 2; 1100 1101 pub const LC_COLLATE_MASK: ::c_int = 1 << 0; 1102 pub const LC_CTYPE_MASK: ::c_int = 1 << 1; 1103 pub const LC_MONETARY_MASK: ::c_int = 1 << 2; 1104 pub const LC_NUMERIC_MASK: ::c_int = 1 << 3; 1105 pub const LC_TIME_MASK: ::c_int = 1 << 4; 1106 pub const LC_MESSAGES_MASK: ::c_int = 1 << 5; 1107 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK 1108 | LC_CTYPE_MASK 1109 | LC_MESSAGES_MASK 1110 | LC_MONETARY_MASK 1111 | LC_NUMERIC_MASK 1112 | LC_TIME_MASK; 1113 1114 pub const TIOCSIG: ::c_uint = 0x2000745f; 1115 pub const BTUARTDISC: ::c_int = 0x7; 1116 pub const TIOCDCDTIMESTAMP: ::c_uint = 0x40107458; 1117 pub const TIOCISPTMASTER: ::c_uint = 0x20007455; 1118 pub const TIOCMODG: ::c_uint = 0x40047403; 1119 pub const TIOCMODS: ::c_ulong = 0x80047404; 1120 pub const TIOCREMOTE: ::c_ulong = 0x80047469; 1121 1122 // Constants used by "at" family of system calls. 1123 pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor 1124 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1; 1125 pub const AT_REMOVEDIR: ::c_int = 2; 1126 pub const AT_EACCESS: ::c_int = 4; 1127 pub const AT_SYMLINK_FOLLOW: ::c_int = 8; 1128 1129 pub const VCHECKPT: usize = 19; 1130 1131 pub const _PC_2_SYMLINKS: ::c_int = 22; 1132 pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23; 1133 1134 pub const _SC_V7_ILP32_OFF32: ::c_int = 122; 1135 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123; 1136 pub const _SC_V7_LP64_OFF64: ::c_int = 124; 1137 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125; 1138 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126; 1139 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127; 1140 1141 pub const WCONTINUED: ::c_int = 0x4; 1142 pub const WSTOPPED: ::c_int = 0x2; 1143 pub const WNOWAIT: ::c_int = 0x8; 1144 pub const WEXITED: ::c_int = 0x10; 1145 pub const WTRAPPED: ::c_int = 0x20; 1146 1147 // Similar to FreeBSD, only the standardized ones are exposed. 1148 // There are more. 1149 pub const P_PID: idtype_t = 0; 1150 pub const P_PGID: idtype_t = 2; 1151 pub const P_ALL: idtype_t = 7; 1152 1153 // Values for struct rtprio (type_ field) 1154 pub const RTP_PRIO_REALTIME: ::c_ushort = 0; 1155 pub const RTP_PRIO_NORMAL: ::c_ushort = 1; 1156 pub const RTP_PRIO_IDLE: ::c_ushort = 2; 1157 pub const RTP_PRIO_THREAD: ::c_ushort = 3; 1158 1159 // Flags for chflags(2) 1160 pub const UF_NOHISTORY: ::c_ulong = 0x00000040; 1161 pub const UF_CACHE: ::c_ulong = 0x00000080; 1162 pub const UF_XLINK: ::c_ulong = 0x00000100; 1163 pub const SF_NOHISTORY: ::c_ulong = 0x00400000; 1164 pub const SF_CACHE: ::c_ulong = 0x00800000; 1165 pub const SF_XLINK: ::c_ulong = 0x01000000; 1166 1167 // timespec constants 1168 pub const UTIME_OMIT: c_long = -2; 1169 pub const UTIME_NOW: c_long = -1; 1170 1171 const_fn! { 1172 {const} fn _CMSG_ALIGN(n: usize) -> usize { 1173 (n + 3) & !3 1174 } 1175 } 1176 1177 f! { 1178 pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { 1179 (cmsg as *mut ::c_uchar) 1180 .offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) 1181 } 1182 1183 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { 1184 (_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize) 1185 as ::c_uint 1186 } 1187 1188 pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) 1189 -> *mut ::cmsghdr 1190 { 1191 let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize) 1192 + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>()); 1193 let max = (*mhdr).msg_control as usize 1194 + (*mhdr).msg_controllen as usize; 1195 if next <= max { 1196 (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) 1197 as *mut ::cmsghdr 1198 } else { 1199 0 as *mut ::cmsghdr 1200 } 1201 } 1202 1203 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { 1204 (_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + 1205 _CMSG_ALIGN(length as usize)) as ::c_uint 1206 } 1207 1208 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { 1209 for slot in cpuset.ary.iter_mut() { 1210 *slot = 0; 1211 } 1212 } 1213 1214 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { 1215 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); 1216 cpuset.ary[idx] |= 1 << offset; 1217 () 1218 } 1219 1220 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { 1221 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); 1222 cpuset.ary[idx] &= !(1 << offset); 1223 () 1224 } 1225 1226 pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpu_set_t) -> bool { 1227 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); 1228 0 != cpuset.ary[idx] & (1 << offset) 1229 } 1230 } 1231 1232 safe_f! { 1233 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { 1234 (status & 0o177) != 0o177 && (status & 0o177) != 0 1235 } 1236 } 1237 1238 extern "C" { __errno_location() -> *mut ::c_int1239 pub fn __errno_location() -> *mut ::c_int; setgrent()1240 pub fn setgrent(); mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1241 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; 1242 setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int1243 pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int; 1244 aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::c_int1245 pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::c_int; 1246 waitid( idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int, ) -> ::c_int1247 pub fn waitid( 1248 idtype: idtype_t, 1249 id: ::id_t, 1250 infop: *mut ::siginfo_t, 1251 options: ::c_int, 1252 ) -> ::c_int; 1253 freelocale(loc: ::locale_t)1254 pub fn freelocale(loc: ::locale_t); 1255 lwp_rtprio( function: ::c_int, pid: ::pid_t, lwpid: lwpid_t, rtp: *mut super::rtprio, ) -> ::c_int1256 pub fn lwp_rtprio( 1257 function: ::c_int, 1258 pid: ::pid_t, 1259 lwpid: lwpid_t, 1260 rtp: *mut super::rtprio, 1261 ) -> ::c_int; 1262 statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1263 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1264 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; uname(buf: *mut ::utsname) -> ::c_int1265 pub fn uname(buf: *mut ::utsname) -> ::c_int; memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void1266 pub fn memmem( 1267 haystack: *const ::c_void, 1268 haystacklen: ::size_t, 1269 needle: *const ::c_void, 1270 needlelen: ::size_t, 1271 ) -> *mut ::c_void; sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int1272 pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int; sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t) -> ::c_int1273 pub fn sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t) 1274 -> ::c_int; setproctitle(fmt: *const ::c_char, ...)1275 pub fn setproctitle(fmt: *const ::c_char, ...); 1276 } 1277 1278 #[link(name = "rt")] 1279 extern "C" { aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1280 pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; aio_error(aiocbp: *const aiocb) -> ::c_int1281 pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1282 pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; aio_read(aiocbp: *mut aiocb) -> ::c_int1283 pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; aio_return(aiocbp: *mut aiocb) -> ::ssize_t1284 pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1285 pub fn aio_suspend( 1286 aiocb_list: *const *const aiocb, 1287 nitems: ::c_int, 1288 timeout: *const ::timespec, 1289 ) -> ::c_int; aio_write(aiocbp: *mut aiocb) -> ::c_int1290 pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int1291 pub fn lio_listio( 1292 mode: ::c_int, 1293 aiocb_list: *const *mut aiocb, 1294 nitems: ::c_int, 1295 sevp: *mut sigevent, 1296 ) -> ::c_int; 1297 } 1298 1299 cfg_if! { 1300 if #[cfg(libc_thread_local)] { 1301 mod errno; 1302 pub use self::errno::*; 1303 } 1304 } 1305