aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / unix / bsd / freebsdlike / dragonfly / mod.rs
| 1 | use crate::prelude::*; |
| 2 | use crate::{ |
| 3 | cmsghdr, |
| 4 | off_t, |
| 5 | }; |
| 6 | |
| 7 | pub type dev_t = u32; |
| 8 | pub type wchar_t = i32; |
| 9 | pub type clock_t = u64; |
| 10 | pub type ino_t = u64; |
| 11 | pub type lwpid_t = i32; |
| 12 | pub type nlink_t = u32; |
| 13 | pub type blksize_t = i64; |
| 14 | pub type clockid_t = c_ulong; |
| 15 | |
| 16 | pub type time_t = i64; |
| 17 | pub type suseconds_t = i64; |
| 18 | |
| 19 | pub type uuid_t = crate::uuid; |
| 20 | |
| 21 | pub type fsblkcnt_t = u64; |
| 22 | pub type fsfilcnt_t = u64; |
| 23 | pub type idtype_t = c_uint; |
| 24 | pub type shmatt_t = c_uint; |
| 25 | |
| 26 | pub type mqd_t = c_int; |
| 27 | pub type sem_t = *mut sem; |
| 28 | |
| 29 | pub type cpuset_t = cpumask_t; |
| 30 | pub type cpu_set_t = cpumask_t; |
| 31 | |
| 32 | pub type register_t = c_long; |
| 33 | pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr; |
| 34 | pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier; |
| 35 | pub type pthread_spinlock_t = crate::uintptr_t; |
| 36 | |
| 37 | pub type segsz_t = isize; |
| 38 | |
| 39 | pub type vm_prot_t = u8; |
| 40 | pub type vm_maptype_t = u8; |
| 41 | pub type vm_inherit_t = i8; |
| 42 | |
| 43 | pub type vm_map_t = *mut c_void; |
| 44 | pub type vm_map_entry_t = *mut c_void; |
| 45 | |
| 46 | extern_ty! { |
| 47 | pub type sem; |
| 48 | pub type __c_anonymous_pthread_barrier; |
| 49 | pub type __c_anonymous_pthread_barrierattr; |
| 50 | } |
| 51 | |
| 52 | e! { |
| 53 | #[repr(u32)] |
| 54 | pub enum lwpstat { |
| 55 | LSRUN = 1, |
| 56 | LSSTOP = 2, |
| 57 | LSSLEEP = 3, |
| 58 | } |
| 59 | |
| 60 | #[repr(u32)] |
| 61 | pub enum procstat { |
| 62 | SIDL = 1, |
| 63 | SACTIVE = 2, |
| 64 | SSTOP = 3, |
| 65 | SZOMB = 4, |
| 66 | SCORE = 5, |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | s! { |
| 71 | pub struct kevent { |
| 72 | pub ident: crate::uintptr_t, |
| 73 | pub filter: c_short, |
| 74 | pub flags: c_ushort, |
| 75 | pub fflags: c_uint, |
| 76 | pub data: intptr_t, |
| 77 | pub udata: *mut c_void, |
| 78 | } |
| 79 | |
| 80 | pub struct exit_status { |
| 81 | pub e_termination: u16, |
| 82 | pub e_exit: u16, |
| 83 | } |
| 84 | |
| 85 | pub struct aiocb { |
| 86 | pub aio_fildes: c_int, |
| 87 | pub aio_offset: off_t, |
| 88 | pub aio_buf: *mut c_void, |
| 89 | pub aio_nbytes: size_t, |
| 90 | pub aio_sigevent: sigevent, |
| 91 | pub aio_lio_opcode: c_int, |
| 92 | pub aio_reqprio: c_int, |
| 93 | _aio_val: c_int, |
| 94 | _aio_err: c_int, |
| 95 | } |
| 96 | |
| 97 | pub struct uuid { |
| 98 | pub time_low: u32, |
| 99 | pub time_mid: u16, |
| 100 | pub time_hi_and_version: u16, |
| 101 | clock_seq_hi_and_reserved: Padding<u8>, |
| 102 | pub clock_seq_low: u8, |
| 103 | pub node: [u8; 6], |
| 104 | } |
| 105 | |
| 106 | pub struct mq_attr { |
| 107 | pub mq_flags: c_long, |
| 108 | pub mq_maxmsg: c_long, |
| 109 | pub mq_msgsize: c_long, |
| 110 | pub mq_curmsgs: c_long, |
| 111 | } |
| 112 | |
| 113 | pub struct statvfs { |
| 114 | pub f_bsize: c_ulong, |
| 115 | pub f_frsize: c_ulong, |
| 116 | pub f_blocks: crate::fsblkcnt_t, |
| 117 | pub f_bfree: crate::fsblkcnt_t, |
| 118 | pub f_bavail: crate::fsblkcnt_t, |
| 119 | pub f_files: crate::fsfilcnt_t, |
| 120 | pub f_ffree: crate::fsfilcnt_t, |
| 121 | pub f_favail: crate::fsfilcnt_t, |
| 122 | pub f_fsid: c_ulong, |
| 123 | pub f_flag: c_ulong, |
| 124 | pub f_namemax: c_ulong, |
| 125 | pub f_owner: crate::uid_t, |
| 126 | pub f_type: c_uint, |
| 127 | pub f_syncreads: u64, |
| 128 | pub f_syncwrites: u64, |
| 129 | pub f_asyncreads: u64, |
| 130 | pub f_asyncwrites: u64, |
| 131 | pub f_fsid_uuid: crate::uuid_t, |
| 132 | pub f_uid_uuid: crate::uuid_t, |
| 133 | } |
| 134 | |
| 135 | pub struct stat { |
| 136 | pub st_ino: crate::ino_t, |
| 137 | pub st_nlink: crate::nlink_t, |
| 138 | pub st_dev: crate::dev_t, |
| 139 | pub st_mode: crate::mode_t, |
| 140 | st_padding1: Padding<u16>, |
| 141 | pub st_uid: crate::uid_t, |
| 142 | pub st_gid: crate::gid_t, |
| 143 | pub st_rdev: crate::dev_t, |
| 144 | pub st_atime: crate::time_t, |
| 145 | pub st_atime_nsec: c_long, |
| 146 | pub st_mtime: crate::time_t, |
| 147 | pub st_mtime_nsec: c_long, |
| 148 | pub st_ctime: crate::time_t, |
| 149 | pub st_ctime_nsec: c_long, |
| 150 | pub st_size: off_t, |
| 151 | pub st_blocks: i64, |
| 152 | pub __old_st_blksize: u32, |
| 153 | pub st_flags: u32, |
| 154 | pub st_gen: u32, |
| 155 | pub st_lspare: i32, |
| 156 | pub st_blksize: i64, |
| 157 | pub st_qspare2: i64, |
| 158 | } |
| 159 | |
| 160 | pub struct if_data { |
| 161 | pub ifi_type: c_uchar, |
| 162 | pub ifi_physical: c_uchar, |
| 163 | pub ifi_addrlen: c_uchar, |
| 164 | pub ifi_hdrlen: c_uchar, |
| 165 | pub ifi_recvquota: c_uchar, |
| 166 | pub ifi_xmitquota: c_uchar, |
| 167 | pub ifi_mtu: c_ulong, |
| 168 | pub ifi_metric: c_ulong, |
| 169 | pub ifi_link_state: c_ulong, |
| 170 | pub ifi_baudrate: u64, |
| 171 | pub ifi_ipackets: c_ulong, |
| 172 | pub ifi_ierrors: c_ulong, |
| 173 | pub ifi_opackets: c_ulong, |
| 174 | pub ifi_oerrors: c_ulong, |
| 175 | pub ifi_collisions: c_ulong, |
| 176 | pub ifi_ibytes: c_ulong, |
| 177 | pub ifi_obytes: c_ulong, |
| 178 | pub ifi_imcasts: c_ulong, |
| 179 | pub ifi_omcasts: c_ulong, |
| 180 | pub ifi_iqdrops: c_ulong, |
| 181 | pub ifi_noproto: c_ulong, |
| 182 | pub ifi_hwassist: c_ulong, |
| 183 | pub ifi_oqdrops: c_ulong, |
| 184 | pub ifi_lastchange: crate::timeval, |
| 185 | } |
| 186 | |
| 187 | pub struct if_msghdr { |
| 188 | pub ifm_msglen: c_ushort, |
| 189 | pub ifm_version: c_uchar, |
| 190 | pub ifm_type: c_uchar, |
| 191 | pub ifm_index: c_ushort, |
| 192 | pub ifm_flags: c_int, |
| 193 | pub ifm_addrs: c_int, |
| 194 | pub ifm_data: if_data, |
| 195 | } |
| 196 | |
| 197 | pub struct sockaddr_dl { |
| 198 | pub sdl_len: c_uchar, |
| 199 | pub sdl_family: c_uchar, |
| 200 | pub sdl_index: c_ushort, |
| 201 | pub sdl_type: c_uchar, |
| 202 | pub sdl_nlen: c_uchar, |
| 203 | pub sdl_alen: c_uchar, |
| 204 | pub sdl_slen: c_uchar, |
| 205 | pub sdl_data: [c_char; 12], |
| 206 | pub sdl_rcf: c_ushort, |
| 207 | pub sdl_route: [c_ushort; 16], |
| 208 | } |
| 209 | |
| 210 | pub struct xucred { |
| 211 | pub cr_version: c_uint, |
| 212 | pub cr_uid: crate::uid_t, |
| 213 | pub cr_ngroups: c_short, |
| 214 | pub cr_groups: [crate::gid_t; 16], |
| 215 | __cr_unused1: Padding<*mut c_void>, |
| 216 | } |
| 217 | |
| 218 | pub struct stack_t { |
| 219 | pub ss_sp: *mut c_void, |
| 220 | pub ss_size: size_t, |
| 221 | pub ss_flags: c_int, |
| 222 | } |
| 223 | |
| 224 | pub struct cpumask_t { |
| 225 | ary: [u64; 4], |
| 226 | } |
| 227 | |
| 228 | pub struct shmid_ds { |
| 229 | pub shm_perm: crate::ipc_perm, |
| 230 | pub shm_segsz: size_t, |
| 231 | pub shm_lpid: crate::pid_t, |
| 232 | pub shm_cpid: crate::pid_t, |
| 233 | pub shm_nattch: crate::shmatt_t, |
| 234 | pub shm_atime: crate::time_t, |
| 235 | pub shm_dtime: crate::time_t, |
| 236 | pub shm_ctime: crate::time_t, |
| 237 | shm_internal: *mut c_void, |
| 238 | } |
| 239 | |
| 240 | pub struct kinfo_file { |
| 241 | pub f_size: size_t, |
| 242 | pub f_pid: crate::pid_t, |
| 243 | pub f_uid: crate::uid_t, |
| 244 | pub f_fd: c_int, |
| 245 | pub f_file: *mut c_void, |
| 246 | pub f_type: c_short, |
| 247 | pub f_count: c_int, |
| 248 | pub f_msgcount: c_int, |
| 249 | pub f_offset: off_t, |
| 250 | pub f_data: *mut c_void, |
| 251 | pub f_flag: c_uint, |
| 252 | } |
| 253 | |
| 254 | pub struct kinfo_cputime { |
| 255 | pub cp_user: u64, |
| 256 | pub cp_nice: u64, |
| 257 | pub cp_sys: u64, |
| 258 | pub cp_intr: u64, |
| 259 | pub cp_idle: u64, |
| 260 | cp_unused01: Padding<u64>, |
| 261 | cp_unused02: Padding<u64>, |
| 262 | pub cp_sample_pc: u64, |
| 263 | pub cp_sample_sp: u64, |
| 264 | pub cp_msg: [c_char; 32], |
| 265 | } |
| 266 | |
| 267 | pub struct kinfo_lwp { |
| 268 | pub kl_pid: crate::pid_t, |
| 269 | pub kl_tid: crate::lwpid_t, |
| 270 | pub kl_flags: c_int, |
| 271 | pub kl_stat: crate::lwpstat, |
| 272 | pub kl_lock: c_int, |
| 273 | pub kl_tdflags: c_int, |
| 274 | pub kl_mpcount: c_int, |
| 275 | pub kl_prio: c_int, |
| 276 | pub kl_tdprio: c_int, |
| 277 | pub kl_rtprio: crate::rtprio, |
| 278 | pub kl_uticks: u64, |
| 279 | pub kl_sticks: u64, |
| 280 | pub kl_iticks: u64, |
| 281 | pub kl_cpticks: u64, |
| 282 | pub kl_pctcpu: c_uint, |
| 283 | pub kl_slptime: c_uint, |
| 284 | pub kl_origcpu: c_int, |
| 285 | pub kl_estcpu: c_int, |
| 286 | pub kl_cpuid: c_int, |
| 287 | pub kl_ru: crate::rusage, |
| 288 | pub kl_siglist: crate::sigset_t, |
| 289 | pub kl_sigmask: crate::sigset_t, |
| 290 | pub kl_wchan: crate::uintptr_t, |
| 291 | pub kl_wmesg: [c_char; 9], |
| 292 | pub kl_comm: [c_char; MAXCOMLEN + 1], |
| 293 | } |
| 294 | |
| 295 | pub struct kinfo_proc { |
| 296 | pub kp_paddr: crate::uintptr_t, |
| 297 | pub kp_flags: c_int, |
| 298 | pub kp_stat: crate::procstat, |
| 299 | pub kp_lock: c_int, |
| 300 | pub kp_acflag: c_int, |
| 301 | pub kp_traceflag: c_int, |
| 302 | pub kp_fd: crate::uintptr_t, |
| 303 | pub kp_siglist: crate::sigset_t, |
| 304 | pub kp_sigignore: crate::sigset_t, |
| 305 | pub kp_sigcatch: crate::sigset_t, |
| 306 | pub kp_sigflag: c_int, |
| 307 | pub kp_start: crate::timeval, |
| 308 | pub kp_comm: [c_char; MAXCOMLEN + 1], |
| 309 | pub kp_uid: crate::uid_t, |
| 310 | pub kp_ngroups: c_short, |
| 311 | pub kp_groups: [crate::gid_t; NGROUPS], |
| 312 | pub kp_ruid: crate::uid_t, |
| 313 | pub kp_svuid: crate::uid_t, |
| 314 | pub kp_rgid: crate::gid_t, |
| 315 | pub kp_svgid: crate::gid_t, |
| 316 | pub kp_pid: crate::pid_t, |
| 317 | pub kp_ppid: crate::pid_t, |
| 318 | pub kp_pgid: crate::pid_t, |
| 319 | pub kp_jobc: c_int, |
| 320 | pub kp_sid: crate::pid_t, |
| 321 | pub kp_login: [c_char; 40], // MAXNAMELEN rounded up to the nearest sizeof(long) |
| 322 | pub kp_tdev: crate::dev_t, |
| 323 | pub kp_tpgid: crate::pid_t, |
| 324 | pub kp_tsid: crate::pid_t, |
| 325 | pub kp_exitstat: c_ushort, |
| 326 | pub kp_nthreads: c_int, |
| 327 | pub kp_nice: c_int, |
| 328 | pub kp_swtime: c_uint, |
| 329 | pub kp_vm_map_size: size_t, |
| 330 | pub kp_vm_rssize: crate::segsz_t, |
| 331 | pub kp_vm_swrss: crate::segsz_t, |
| 332 | pub kp_vm_tsize: crate::segsz_t, |
| 333 | pub kp_vm_dsize: crate::segsz_t, |
| 334 | pub kp_vm_ssize: crate::segsz_t, |
| 335 | pub kp_vm_prssize: c_uint, |
| 336 | pub kp_jailid: c_int, |
| 337 | pub kp_ru: crate::rusage, |
| 338 | pub kp_cru: crate::rusage, |
| 339 | pub kp_auxflags: c_int, |
| 340 | pub kp_lwp: crate::kinfo_lwp, |
| 341 | pub kp_ktaddr: crate::uintptr_t, |
| 342 | kp_spare: [c_int; 2], |
| 343 | } |
| 344 | |
| 345 | pub struct cpuctl_msr_args_t { |
| 346 | pub msr: c_int, |
| 347 | pub data: u64, |
| 348 | } |
| 349 | |
| 350 | pub struct cpuctl_cpuid_args_t { |
| 351 | pub level: c_int, |
| 352 | pub data: [u32; 4], |
| 353 | } |
| 354 | |
| 355 | pub struct cpuctl_cpuid_count_args_t { |
| 356 | pub level: c_int, |
| 357 | pub level_type: c_int, |
| 358 | pub data: [u32; 4], |
| 359 | } |
| 360 | |
| 361 | pub struct cpuctl_update_args_t { |
| 362 | pub data: *mut c_void, |
| 363 | pub size: size_t, |
| 364 | } |
| 365 | |
| 366 | pub struct utmpx { |
| 367 | pub ut_name: [c_char; 32], |
| 368 | pub ut_id: [c_char; 4], |
| 369 | |
| 370 | pub ut_line: [c_char; 32], |
| 371 | pub ut_host: [c_char; 256], |
| 372 | |
| 373 | ut_unused: Padding<[u8; 16]>, |
| 374 | pub ut_session: u16, |
| 375 | pub ut_type: u16, |
| 376 | pub ut_pid: crate::pid_t, |
| 377 | ut_exit: exit_status, |
| 378 | ut_ss: crate::sockaddr_storage, |
| 379 | pub ut_tv: crate::timeval, |
| 380 | ut_unused2: Padding<[u8; 16]>, |
| 381 | } |
| 382 | |
| 383 | pub struct lastlogx { |
| 384 | pub ll_tv: crate::timeval, |
| 385 | pub ll_line: [c_char; _UTX_LINESIZE], |
| 386 | pub ll_host: [c_char; _UTX_HOSTSIZE], |
| 387 | pub ll_ss: crate::sockaddr_storage, |
| 388 | } |
| 389 | |
| 390 | pub struct dirent { |
| 391 | pub d_fileno: crate::ino_t, |
| 392 | pub d_namlen: u16, |
| 393 | pub d_type: u8, |
| 394 | __unused1: Padding<u8>, |
| 395 | __unused2: Padding<u32>, |
| 396 | pub d_name: [c_char; 256], |
| 397 | } |
| 398 | |
| 399 | pub struct statfs { |
| 400 | __spare2: c_long, |
| 401 | pub f_bsize: c_long, |
| 402 | pub f_iosize: c_long, |
| 403 | pub f_blocks: c_long, |
| 404 | pub f_bfree: c_long, |
| 405 | pub f_bavail: c_long, |
| 406 | pub f_files: c_long, |
| 407 | pub f_ffree: c_long, |
| 408 | pub f_fsid: crate::fsid_t, |
| 409 | pub f_owner: crate::uid_t, |
| 410 | pub f_type: c_int, |
| 411 | pub f_flags: c_int, |
| 412 | pub f_syncwrites: c_long, |
| 413 | pub f_asyncwrites: c_long, |
| 414 | pub f_fstypename: [c_char; 16], |
| 415 | pub f_mntonname: [c_char; 80], |
| 416 | pub f_syncreads: c_long, |
| 417 | pub f_asyncreads: c_long, |
| 418 | __spares1: c_short, |
| 419 | pub f_mntfromname: [c_char; 80], |
| 420 | __spares2: c_short, |
| 421 | __spare: [c_long; 2], |
| 422 | } |
| 423 | |
| 424 | pub struct sigevent { |
| 425 | pub sigev_notify: c_int, |
| 426 | // The union is 8-byte in size, so it is aligned at a 8-byte offset. |
| 427 | #[cfg(target_pointer_width = "64")] |
| 428 | __unused1: Padding<c_int>, |
| 429 | pub sigev_signo: c_int, //actually a union |
| 430 | // pad the union |
| 431 | #[cfg(target_pointer_width = "64")] |
| 432 | __unused2: Padding<c_int>, |
| 433 | pub sigev_value: crate::sigval, |
| 434 | __unused3: Padding<*mut c_void>, //actually a function pointer |
| 435 | } |
| 436 | |
| 437 | #[repr(align(64))] |
| 438 | pub struct mcontext_t { |
| 439 | pub mc_onstack: register_t, |
| 440 | pub mc_rdi: register_t, |
| 441 | pub mc_rsi: register_t, |
| 442 | pub mc_rdx: register_t, |
| 443 | pub mc_rcx: register_t, |
| 444 | pub mc_r8: register_t, |
| 445 | pub mc_r9: register_t, |
| 446 | pub mc_rax: register_t, |
| 447 | pub mc_rbx: register_t, |
| 448 | pub mc_rbp: register_t, |
| 449 | pub mc_r10: register_t, |
| 450 | pub mc_r11: register_t, |
| 451 | pub mc_r12: register_t, |
| 452 | pub mc_r13: register_t, |
| 453 | pub mc_r14: register_t, |
| 454 | pub mc_r15: register_t, |
| 455 | pub mc_xflags: register_t, |
| 456 | pub mc_trapno: register_t, |
| 457 | pub mc_addr: register_t, |
| 458 | pub mc_flags: register_t, |
| 459 | pub mc_err: register_t, |
| 460 | pub mc_rip: register_t, |
| 461 | pub mc_cs: register_t, |
| 462 | pub mc_rflags: register_t, |
| 463 | pub mc_rsp: register_t, |
| 464 | pub mc_ss: register_t, |
| 465 | pub mc_len: c_uint, |
| 466 | pub mc_fpformat: c_uint, |
| 467 | pub mc_ownedfp: c_uint, |
| 468 | __reserved: Padding<c_uint>, |
| 469 | __unused: Padding<[c_uint; 8]>, |
| 470 | pub mc_fpregs: [c_uint; 256], |
| 471 | } |
| 472 | |
| 473 | // FIXME(1.0): This should not implement `PartialEq` |
| 474 | #[allow(unpredictable_function_pointer_comparisons)] |
| 475 | pub struct ucontext_t { |
| 476 | pub uc_sigmask: crate::sigset_t, |
| 477 | pub uc_mcontext: mcontext_t, |
| 478 | pub uc_link: *mut ucontext_t, |
| 479 | pub uc_stack: stack_t, |
| 480 | pub uc_cofunc: Option<unsafe extern "C" fn(uc: *mut ucontext_t, arg: *mut c_void)>, |
| 481 | pub uc_arg: *mut c_void, |
| 482 | __pad: Padding<[c_int; 4]>, |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | pub const RAND_MAX: c_int = 0x7fff_ffff; |
| 487 | pub const PTHREAD_STACK_MIN: size_t = 16384; |
| 488 | pub const SIGSTKSZ: size_t = 40960; |
| 489 | pub const SIGCKPT: c_int = 33; |
| 490 | pub const SIGCKPTEXIT: c_int = 34; |
| 491 | pub const CKPT_FREEZE: c_int = 0x1; |
| 492 | pub const CKPT_THAW: c_int = 0x2; |
| 493 | pub const MADV_INVAL: c_int = 10; |
| 494 | pub const MADV_SETMAP: c_int = 11; |
| 495 | pub const O_CLOEXEC: c_int = 0x00020000; |
| 496 | pub const O_DIRECTORY: c_int = 0x08000000; |
| 497 | pub const O_FBLOCKING: c_int = 0x00040000; |
| 498 | pub const O_FNONBLOCKING: c_int = 0x00080000; |
| 499 | pub const O_FAPPEND: c_int = 0x00100000; |
| 500 | pub const O_FOFFSET: c_int = 0x00200000; |
| 501 | pub const O_FSYNCWRITE: c_int = 0x00400000; |
| 502 | pub const O_FASYNCWRITE: c_int = 0x00800000; |
| 503 | pub const O_FMASK: c_int = |
| 504 | O_FBLOCKING | O_FNONBLOCKING | O_FAPPEND | O_FOFFSET | O_FSYNCWRITE | O_FASYNCWRITE; |
| 505 | pub const F_GETLK: c_int = 7; |
| 506 | pub const F_SETLK: c_int = 8; |
| 507 | pub const F_SETLKW: c_int = 9; |
| 508 | pub const F_GETPATH: c_int = 19; |
| 509 | pub const POSIX_FADV_NORMAL: c_int = 0; |
| 510 | pub const POSIX_FADV_SEQUENTIAL: c_int = 1; |
| 511 | pub const POSIX_FADV_RANDOM: c_int = 2; |
| 512 | pub const POSIX_FADV_WILLNEED: c_int = 3; |
| 513 | pub const POSIX_FADV_DONTNEED: c_int = 4; |
| 514 | pub const POSIX_FADV_NOREUSE: c_int = 5; |
| 515 | pub const ENOMEDIUM: c_int = 93; |
| 516 | pub const ENOTRECOVERABLE: c_int = 94; |
| 517 | pub const EOWNERDEAD: c_int = 95; |
| 518 | pub const EASYNC: c_int = 99; |
| 519 | |
| 520 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 521 | /// for details.and use. |
| 522 | pub const ELAST: c_int = 99; |
| 523 | |
| 524 | pub const RLIMIT_POSIXLOCKS: c_int = 11; |
| 525 | #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 526 | pub const RLIM_NLIMITS: crate::rlim_t = 12; |
| 527 | |
| 528 | pub const Q_GETQUOTA: c_int = 0x300; |
| 529 | pub const Q_SETQUOTA: c_int = 0x400; |
| 530 | |
| 531 | pub const CTL_UNSPEC: c_int = 0; |
| 532 | pub const CTL_KERN: c_int = 1; |
| 533 | pub const CTL_VM: c_int = 2; |
| 534 | pub const CTL_VFS: c_int = 3; |
| 535 | pub const CTL_NET: c_int = 4; |
| 536 | pub const CTL_DEBUG: c_int = 5; |
| 537 | pub const CTL_HW: c_int = 6; |
| 538 | pub const CTL_MACHDEP: c_int = 7; |
| 539 | pub const CTL_USER: c_int = 8; |
| 540 | pub const CTL_P1003_1B: c_int = 9; |
| 541 | pub const CTL_LWKT: c_int = 10; |
| 542 | pub const CTL_MAXID: c_int = 11; |
| 543 | pub const KERN_OSTYPE: c_int = 1; |
| 544 | pub const KERN_OSRELEASE: c_int = 2; |
| 545 | pub const KERN_OSREV: c_int = 3; |
| 546 | pub const KERN_VERSION: c_int = 4; |
| 547 | pub const KERN_MAXVNODES: c_int = 5; |
| 548 | pub const KERN_MAXPROC: c_int = 6; |
| 549 | pub const KERN_MAXFILES: c_int = 7; |
| 550 | pub const KERN_ARGMAX: c_int = 8; |
| 551 | pub const KERN_SECURELVL: c_int = 9; |
| 552 | pub const KERN_HOSTNAME: c_int = 10; |
| 553 | pub const KERN_HOSTID: c_int = 11; |
| 554 | pub const KERN_CLOCKRATE: c_int = 12; |
| 555 | pub const KERN_VNODE: c_int = 13; |
| 556 | pub const KERN_PROC: c_int = 14; |
| 557 | pub const KERN_FILE: c_int = 15; |
| 558 | pub const KERN_PROF: c_int = 16; |
| 559 | pub const KERN_POSIX1: c_int = 17; |
| 560 | pub const KERN_NGROUPS: c_int = 18; |
| 561 | pub const KERN_JOB_CONTROL: c_int = 19; |
| 562 | pub const KERN_SAVED_IDS: c_int = 20; |
| 563 | pub const KERN_BOOTTIME: c_int = 21; |
| 564 | pub const KERN_NISDOMAINNAME: c_int = 22; |
| 565 | pub const KERN_UPDATEINTERVAL: c_int = 23; |
| 566 | pub const KERN_OSRELDATE: c_int = 24; |
| 567 | pub const KERN_NTP_PLL: c_int = 25; |
| 568 | pub const KERN_BOOTFILE: c_int = 26; |
| 569 | pub const KERN_MAXFILESPERPROC: c_int = 27; |
| 570 | pub const KERN_MAXPROCPERUID: c_int = 28; |
| 571 | pub const KERN_DUMPDEV: c_int = 29; |
| 572 | pub const KERN_IPC: c_int = 30; |
| 573 | pub const KERN_DUMMY: c_int = 31; |
| 574 | pub const KERN_PS_STRINGS: c_int = 32; |
| 575 | pub const KERN_USRSTACK: c_int = 33; |
| 576 | pub const KERN_LOGSIGEXIT: c_int = 34; |
| 577 | pub const KERN_IOV_MAX: c_int = 35; |
| 578 | pub const KERN_MAXPOSIXLOCKSPERUID: c_int = 36; |
| 579 | pub const KERN_STATIC_TLS_EXTRA: c_int = 37; |
| 580 | pub const KERN_MAXID: c_int = 38; |
| 581 | pub const KERN_PROC_ALL: c_int = 0; |
| 582 | pub const KERN_PROC_PID: c_int = 1; |
| 583 | pub const KERN_PROC_PGRP: c_int = 2; |
| 584 | pub const KERN_PROC_SESSION: c_int = 3; |
| 585 | pub const KERN_PROC_TTY: c_int = 4; |
| 586 | pub const KERN_PROC_UID: c_int = 5; |
| 587 | pub const KERN_PROC_RUID: c_int = 6; |
| 588 | pub const KERN_PROC_ARGS: c_int = 7; |
| 589 | pub const KERN_PROC_CWD: c_int = 8; |
| 590 | pub const KERN_PROC_PATHNAME: c_int = 9; |
| 591 | pub const KERN_PROC_FLAGMASK: c_int = 0x10; |
| 592 | pub const KERN_PROC_FLAG_LWP: c_int = 0x10; |
| 593 | pub const KIPC_MAXSOCKBUF: c_int = 1; |
| 594 | pub const KIPC_SOCKBUF_WASTE: c_int = 2; |
| 595 | pub const KIPC_SOMAXCONN: c_int = 3; |
| 596 | pub const KIPC_MAX_LINKHDR: c_int = 4; |
| 597 | pub const KIPC_MAX_PROTOHDR: c_int = 5; |
| 598 | pub const KIPC_MAX_HDR: c_int = 6; |
| 599 | pub const KIPC_MAX_DATALEN: c_int = 7; |
| 600 | pub const KIPC_MBSTAT: c_int = 8; |
| 601 | pub const KIPC_NMBCLUSTERS: c_int = 9; |
| 602 | pub const HW_MACHINE: c_int = 1; |
| 603 | pub const HW_MODEL: c_int = 2; |
| 604 | pub const HW_NCPU: c_int = 3; |
| 605 | pub const HW_BYTEORDER: c_int = 4; |
| 606 | pub const HW_PHYSMEM: c_int = 5; |
| 607 | pub const HW_USERMEM: c_int = 6; |
| 608 | pub const HW_PAGESIZE: c_int = 7; |
| 609 | pub const HW_DISKNAMES: c_int = 8; |
| 610 | pub const HW_DISKSTATS: c_int = 9; |
| 611 | pub const HW_FLOATINGPT: c_int = 10; |
| 612 | pub const HW_MACHINE_ARCH: c_int = 11; |
| 613 | pub const HW_MACHINE_PLATFORM: c_int = 12; |
| 614 | pub const HW_SENSORS: c_int = 13; |
| 615 | pub const HW_MAXID: c_int = 14; |
| 616 | pub const USER_CS_PATH: c_int = 1; |
| 617 | |
| 618 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 619 | /// for details. |
| 620 | pub const USER_BC_BASE_MAX: c_int = 2; |
| 621 | |
| 622 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 623 | /// for details. |
| 624 | pub const USER_BC_DIM_MAX: c_int = 3; |
| 625 | |
| 626 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 627 | /// for details. |
| 628 | pub const USER_BC_SCALE_MAX: c_int = 4; |
| 629 | |
| 630 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 631 | /// for details. |
| 632 | pub const USER_BC_STRING_MAX: c_int = 5; |
| 633 | |
| 634 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 635 | /// for details. |
| 636 | pub const USER_COLL_WEIGHTS_MAX: c_int = 6; |
| 637 | |
| 638 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 639 | /// for details. |
| 640 | pub const USER_EXPR_NEST_MAX: c_int = 7; |
| 641 | |
| 642 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 643 | /// for details. |
| 644 | pub const USER_LINE_MAX: c_int = 8; |
| 645 | |
| 646 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 647 | /// for details. |
| 648 | pub const USER_RE_DUP_MAX: c_int = 9; |
| 649 | |
| 650 | pub const USER_POSIX2_VERSION: c_int = 10; |
| 651 | pub const USER_POSIX2_C_BIND: c_int = 11; |
| 652 | pub const USER_POSIX2_C_DEV: c_int = 12; |
| 653 | pub const USER_POSIX2_CHAR_TERM: c_int = 13; |
| 654 | pub const USER_POSIX2_FORT_DEV: c_int = 14; |
| 655 | pub const USER_POSIX2_FORT_RUN: c_int = 15; |
| 656 | pub const USER_POSIX2_LOCALEDEF: c_int = 16; |
| 657 | pub const USER_POSIX2_SW_DEV: c_int = 17; |
| 658 | pub const USER_POSIX2_UPE: c_int = 18; |
| 659 | pub const USER_STREAM_MAX: c_int = 19; |
| 660 | pub const USER_TZNAME_MAX: c_int = 20; |
| 661 | pub const USER_MAXID: c_int = 21; |
| 662 | pub const CTL_P1003_1B_ASYNCHRONOUS_IO: c_int = 1; |
| 663 | pub const CTL_P1003_1B_MAPPED_FILES: c_int = 2; |
| 664 | pub const CTL_P1003_1B_MEMLOCK: c_int = 3; |
| 665 | pub const CTL_P1003_1B_MEMLOCK_RANGE: c_int = 4; |
| 666 | pub const CTL_P1003_1B_MEMORY_PROTECTION: c_int = 5; |
| 667 | pub const CTL_P1003_1B_MESSAGE_PASSING: c_int = 6; |
| 668 | pub const CTL_P1003_1B_PRIORITIZED_IO: c_int = 7; |
| 669 | pub const CTL_P1003_1B_PRIORITY_SCHEDULING: c_int = 8; |
| 670 | pub const CTL_P1003_1B_REALTIME_SIGNALS: c_int = 9; |
| 671 | pub const CTL_P1003_1B_SEMAPHORES: c_int = 10; |
| 672 | pub const CTL_P1003_1B_FSYNC: c_int = 11; |
| 673 | pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: c_int = 12; |
| 674 | pub const CTL_P1003_1B_SYNCHRONIZED_IO: c_int = 13; |
| 675 | pub const CTL_P1003_1B_TIMERS: c_int = 14; |
| 676 | pub const CTL_P1003_1B_AIO_LISTIO_MAX: c_int = 15; |
| 677 | pub const CTL_P1003_1B_AIO_MAX: c_int = 16; |
| 678 | pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: c_int = 17; |
| 679 | pub const CTL_P1003_1B_DELAYTIMER_MAX: c_int = 18; |
| 680 | pub const CTL_P1003_1B_UNUSED1: c_int = 19; |
| 681 | pub const CTL_P1003_1B_PAGESIZE: c_int = 20; |
| 682 | pub const CTL_P1003_1B_RTSIG_MAX: c_int = 21; |
| 683 | pub const CTL_P1003_1B_SEM_NSEMS_MAX: c_int = 22; |
| 684 | pub const CTL_P1003_1B_SEM_VALUE_MAX: c_int = 23; |
| 685 | pub const CTL_P1003_1B_SIGQUEUE_MAX: c_int = 24; |
| 686 | pub const CTL_P1003_1B_TIMER_MAX: c_int = 25; |
| 687 | pub const CTL_P1003_1B_MAXID: c_int = 26; |
| 688 | |
| 689 | pub const CPUCTL_RDMSR: c_int = u32_cast_int(0xc0106301); |
| 690 | #[deprecated(since = "0.2.187", note = "Replaced on DragonFly by CPUCTL_RDMSR")] |
| 691 | pub const CPUCTL_RSMSR: c_int = CPUCTL_RDMSR; |
| 692 | pub const CPUCTL_WRMSR: c_int = u32_cast_int(0xc0106302); |
| 693 | pub const CPUCTL_CPUID: c_int = u32_cast_int(0xc0146303); |
| 694 | pub const CPUCTL_UPDATE: c_int = u32_cast_int(0xc0106304); |
| 695 | pub const CPUCTL_MSRSBIT: c_int = u32_cast_int(0xc0106305); |
| 696 | pub const CPUCTL_MSRCBIT: c_int = u32_cast_int(0xc0106306); |
| 697 | pub const CPUCTL_CPUID_COUNT: c_int = u32_cast_int(0xc0186307); |
| 698 | |
| 699 | pub const CPU_SETSIZE: size_t = size_of::<crate::cpumask_t>() * 8; |
| 700 | |
| 701 | pub const REG_BASIC: c_int = 0o0000; |
| 702 | pub const REG_EXTENDED: c_int = 0o0001; |
| 703 | pub const REG_ICASE: c_int = 0o0002; |
| 704 | pub const REG_NOSUB: c_int = 0x8; |
| 705 | pub const REG_NEWLINE: c_int = 0x4; |
| 706 | pub const REG_NOSPEC: c_int = 0o0020; |
| 707 | pub const REG_PEND: c_int = 0x80; |
| 708 | pub const REG_DUMP: c_int = 0o0200; |
| 709 | |
| 710 | pub const REG_NOMATCH: c_int = 1; |
| 711 | pub const REG_BADPAT: c_int = 2; |
| 712 | pub const REG_ECOLLATE: c_int = 3; |
| 713 | pub const REG_ECTYPE: c_int = 4; |
| 714 | pub const REG_EESCAPE: c_int = 5; |
| 715 | pub const REG_ESUBREG: c_int = 6; |
| 716 | pub const REG_EBRACK: c_int = 7; |
| 717 | pub const REG_EPAREN: c_int = 8; |
| 718 | pub const REG_EBRACE: c_int = 9; |
| 719 | pub const REG_BADBR: c_int = 10; |
| 720 | pub const REG_ERANGE: c_int = 11; |
| 721 | pub const REG_ESPACE: c_int = 12; |
| 722 | pub const REG_BADRPT: c_int = 13; |
| 723 | pub const REG_EMPTY: c_int = 14; |
| 724 | pub const REG_ASSERT: c_int = 15; |
| 725 | pub const REG_INVARG: c_int = 15; |
| 726 | pub const REG_ILLSEQ: c_int = 16; |
| 727 | pub const REG_ATOI: c_int = 255; |
| 728 | pub const REG_ITOA: c_int = 0o0400; |
| 729 | |
| 730 | pub const REG_NOTBOL: c_int = 0o00001; |
| 731 | pub const REG_NOTEOL: c_int = 0o00002; |
| 732 | pub const REG_STARTEND: c_int = 0o00004; |
| 733 | pub const REG_TRACE: c_int = 0o00400; |
| 734 | pub const REG_LARGE: c_int = 0o01000; |
| 735 | pub const REG_BACKR: c_int = 0x8; |
| 736 | |
| 737 | pub const EVFILT_READ: i16 = -1; |
| 738 | pub const EVFILT_WRITE: i16 = -2; |
| 739 | pub const EVFILT_AIO: i16 = -3; |
| 740 | pub const EVFILT_VNODE: i16 = -4; |
| 741 | pub const EVFILT_PROC: i16 = -5; |
| 742 | pub const EVFILT_SIGNAL: i16 = -6; |
| 743 | pub const EVFILT_TIMER: i16 = -7; |
| 744 | pub const EVFILT_EXCEPT: i16 = -8; |
| 745 | pub const EVFILT_USER: i16 = -9; |
| 746 | pub const EVFILT_FS: i16 = -10; |
| 747 | |
| 748 | pub const EV_ADD: u16 = 0x1; |
| 749 | pub const EV_DELETE: u16 = 0x2; |
| 750 | pub const EV_ENABLE: u16 = 0x4; |
| 751 | pub const EV_DISABLE: u16 = 0x8; |
| 752 | pub const EV_ONESHOT: u16 = 0x10; |
| 753 | pub const EV_CLEAR: u16 = 0x20; |
| 754 | pub const EV_RECEIPT: u16 = 0x40; |
| 755 | pub const EV_DISPATCH: u16 = 0x80; |
| 756 | pub const EV_NODATA: u16 = 0x1000; |
| 757 | pub const EV_FLAG1: u16 = 0x2000; |
| 758 | pub const EV_ERROR: u16 = 0x4000; |
| 759 | pub const EV_EOF: u16 = 0x8000; |
| 760 | pub const EV_HUP: u16 = 0x0800; |
| 761 | pub const EV_SYSFLAGS: u16 = 0xF800; |
| 762 | |
| 763 | pub const FIODNAME: c_ulong = 0x80106678; |
| 764 | |
| 765 | pub const NOTE_TRIGGER: u32 = 0x01000000; |
| 766 | pub const NOTE_FFNOP: u32 = 0x00000000; |
| 767 | pub const NOTE_FFAND: u32 = 0x40000000; |
| 768 | pub const NOTE_FFOR: u32 = 0x80000000; |
| 769 | pub const NOTE_FFCOPY: u32 = 0xc0000000; |
| 770 | pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; |
| 771 | pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; |
| 772 | pub const NOTE_LOWAT: u32 = 0x00000001; |
| 773 | pub const NOTE_OOB: u32 = 0x00000002; |
| 774 | pub const NOTE_DELETE: u32 = 0x00000001; |
| 775 | pub const NOTE_WRITE: u32 = 0x00000002; |
| 776 | pub const NOTE_EXTEND: u32 = 0x00000004; |
| 777 | pub const NOTE_ATTRIB: u32 = 0x00000008; |
| 778 | pub const NOTE_LINK: u32 = 0x00000010; |
| 779 | pub const NOTE_RENAME: u32 = 0x00000020; |
| 780 | pub const NOTE_REVOKE: u32 = 0x00000040; |
| 781 | pub const NOTE_EXIT: u32 = 0x80000000; |
| 782 | pub const NOTE_FORK: u32 = 0x40000000; |
| 783 | pub const NOTE_EXEC: u32 = 0x20000000; |
| 784 | pub const NOTE_PDATAMASK: u32 = 0x000fffff; |
| 785 | pub const NOTE_PCTRLMASK: u32 = 0xf0000000; |
| 786 | pub const NOTE_TRACK: u32 = 0x00000001; |
| 787 | pub const NOTE_TRACKERR: u32 = 0x00000002; |
| 788 | pub const NOTE_CHILD: u32 = 0x00000004; |
| 789 | |
| 790 | pub const SO_SNDSPACE: c_int = 0x100a; |
| 791 | pub const SO_CPUHINT: c_int = 0x1030; |
| 792 | pub const SO_PASSCRED: c_int = 0x4000; |
| 793 | |
| 794 | pub const PT_FIRSTMACH: c_int = 32; |
| 795 | |
| 796 | pub const PROC_REAP_ACQUIRE: c_int = 0x0001; |
| 797 | pub const PROC_REAP_RELEASE: c_int = 0x0002; |
| 798 | pub const PROC_REAP_STATUS: c_int = 0x0003; |
| 799 | pub const PROC_PDEATHSIG_CTL: c_int = 0x0004; |
| 800 | pub const PROC_PDEATHSIG_STATUS: c_int = 0x0005; |
| 801 | |
| 802 | // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/HEAD/sys/net/if.h#L101 |
| 803 | pub const IFF_UP: c_int = 0x1; // interface is up |
| 804 | pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid |
| 805 | pub const IFF_DEBUG: c_int = 0x4; // turn on debugging |
| 806 | pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net |
| 807 | pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link |
| 808 | pub const IFF_SMART: c_int = 0x20; // interface manages own routes |
| 809 | pub const IFF_RUNNING: c_int = 0x40; // resources allocated |
| 810 | pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol |
| 811 | pub const IFF_PROMISC: c_int = 0x100; // receive all packets |
| 812 | pub const IFF_ALLMULTI: c_int = 0x200; // receive all multicast packets |
| 813 | pub const IFF_OACTIVE_COMPAT: c_int = 0x400; // was transmission in progress |
| 814 | pub const IFF_OACTIVE: c_int = IFF_OACTIVE_COMPAT; |
| 815 | pub const IFF_SIMPLEX: c_int = 0x800; // can't hear own transmissions |
| 816 | pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit |
| 817 | pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit |
| 818 | pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit |
| 819 | pub const IFF_ALTPHYS: c_int = IFF_LINK2; // use alternate physical connection |
| 820 | pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast |
| 821 | // was interface is in polling mode |
| 822 | pub const IFF_POLLING_COMPAT: c_int = 0x10000; |
| 823 | pub const IFF_PPROMISC: c_int = 0x20000; // user-requested promisc mode |
| 824 | pub const IFF_MONITOR: c_int = 0x40000; // user-requested monitor mode |
| 825 | pub const IFF_STATICARP: c_int = 0x80000; // static ARP |
| 826 | pub const IFF_NPOLLING: c_int = 0x100000; // interface is in polling mode |
| 827 | pub const IFF_IDIRECT: c_int = 0x200000; // direct input |
| 828 | |
| 829 | // |
| 830 | // sys/netinet/in.h |
| 831 | // Protocols (RFC 1700) |
| 832 | // NOTE: These are in addition to the constants defined in src/unix/mod.rs |
| 833 | |
| 834 | // IPPROTO_IP defined in src/unix/mod.rs |
| 835 | /// IP6 hop-by-hop options |
| 836 | pub const IPPROTO_HOPOPTS: c_int = 0; |
| 837 | // IPPROTO_ICMP defined in src/unix/mod.rs |
| 838 | /// group mgmt protocol |
| 839 | pub const IPPROTO_IGMP: c_int = 2; |
| 840 | /// gateway^2 (deprecated) |
| 841 | pub const IPPROTO_GGP: c_int = 3; |
| 842 | /// for compatibility |
| 843 | pub const IPPROTO_IPIP: c_int = 4; |
| 844 | // IPPROTO_TCP defined in src/unix/mod.rs |
| 845 | /// Stream protocol II. |
| 846 | pub const IPPROTO_ST: c_int = 7; |
| 847 | /// exterior gateway protocol |
| 848 | pub const IPPROTO_EGP: c_int = 8; |
| 849 | /// private interior gateway |
| 850 | pub const IPPROTO_PIGP: c_int = 9; |
| 851 | /// BBN RCC Monitoring |
| 852 | pub const IPPROTO_RCCMON: c_int = 10; |
| 853 | /// network voice protocol |
| 854 | pub const IPPROTO_NVPII: c_int = 11; |
| 855 | /// pup |
| 856 | pub const IPPROTO_PUP: c_int = 12; |
| 857 | /// Argus |
| 858 | pub const IPPROTO_ARGUS: c_int = 13; |
| 859 | /// EMCON |
| 860 | pub const IPPROTO_EMCON: c_int = 14; |
| 861 | /// Cross Net Debugger |
| 862 | pub const IPPROTO_XNET: c_int = 15; |
| 863 | /// Chaos |
| 864 | pub const IPPROTO_CHAOS: c_int = 16; |
| 865 | // IPPROTO_UDP defined in src/unix/mod.rs |
| 866 | /// Multiplexing |
| 867 | pub const IPPROTO_MUX: c_int = 18; |
| 868 | /// DCN Measurement Subsystems |
| 869 | pub const IPPROTO_MEAS: c_int = 19; |
| 870 | /// Host Monitoring |
| 871 | pub const IPPROTO_HMP: c_int = 20; |
| 872 | /// Packet Radio Measurement |
| 873 | pub const IPPROTO_PRM: c_int = 21; |
| 874 | /// xns idp |
| 875 | pub const IPPROTO_IDP: c_int = 22; |
| 876 | /// Trunk-1 |
| 877 | pub const IPPROTO_TRUNK1: c_int = 23; |
| 878 | /// Trunk-2 |
| 879 | pub const IPPROTO_TRUNK2: c_int = 24; |
| 880 | /// Leaf-1 |
| 881 | pub const IPPROTO_LEAF1: c_int = 25; |
| 882 | /// Leaf-2 |
| 883 | pub const IPPROTO_LEAF2: c_int = 26; |
| 884 | /// Reliable Data |
| 885 | pub const IPPROTO_RDP: c_int = 27; |
| 886 | /// Reliable Transaction |
| 887 | pub const IPPROTO_IRTP: c_int = 28; |
| 888 | /// tp-4 w/ class negotiation |
| 889 | pub const IPPROTO_TP: c_int = 29; |
| 890 | /// Bulk Data Transfer |
| 891 | pub const IPPROTO_BLT: c_int = 30; |
| 892 | /// Network Services |
| 893 | pub const IPPROTO_NSP: c_int = 31; |
| 894 | /// Merit Internodal |
| 895 | pub const IPPROTO_INP: c_int = 32; |
| 896 | /// Sequential Exchange |
| 897 | pub const IPPROTO_SEP: c_int = 33; |
| 898 | /// Third Party Connect |
| 899 | pub const IPPROTO_3PC: c_int = 34; |
| 900 | /// InterDomain Policy Routing |
| 901 | pub const IPPROTO_IDPR: c_int = 35; |
| 902 | /// XTP |
| 903 | pub const IPPROTO_XTP: c_int = 36; |
| 904 | /// Datagram Delivery |
| 905 | pub const IPPROTO_DDP: c_int = 37; |
| 906 | /// Control Message Transport |
| 907 | pub const IPPROTO_CMTP: c_int = 38; |
| 908 | /// TP++ Transport |
| 909 | pub const IPPROTO_TPXX: c_int = 39; |
| 910 | /// IL transport protocol |
| 911 | pub const IPPROTO_IL: c_int = 40; |
| 912 | // IPPROTO_IPV6 defined in src/unix/mod.rs |
| 913 | /// Source Demand Routing |
| 914 | pub const IPPROTO_SDRP: c_int = 42; |
| 915 | /// IP6 routing header |
| 916 | pub const IPPROTO_ROUTING: c_int = 43; |
| 917 | /// IP6 fragmentation header |
| 918 | pub const IPPROTO_FRAGMENT: c_int = 44; |
| 919 | /// InterDomain Routing |
| 920 | pub const IPPROTO_IDRP: c_int = 45; |
| 921 | /// resource reservation |
| 922 | pub const IPPROTO_RSVP: c_int = 46; |
| 923 | /// General Routing Encap. |
| 924 | pub const IPPROTO_GRE: c_int = 47; |
| 925 | /// Mobile Host Routing |
| 926 | pub const IPPROTO_MHRP: c_int = 48; |
| 927 | /// BHA |
| 928 | pub const IPPROTO_BHA: c_int = 49; |
| 929 | /// IP6 Encap Sec. Payload |
| 930 | pub const IPPROTO_ESP: c_int = 50; |
| 931 | /// IP6 Auth Header |
| 932 | pub const IPPROTO_AH: c_int = 51; |
| 933 | /// Integ. Net Layer Security |
| 934 | pub const IPPROTO_INLSP: c_int = 52; |
| 935 | /// IP with encryption |
| 936 | pub const IPPROTO_SWIPE: c_int = 53; |
| 937 | /// Next Hop Resolution |
| 938 | pub const IPPROTO_NHRP: c_int = 54; |
| 939 | /// IP Mobility |
| 940 | pub const IPPROTO_MOBILE: c_int = 55; |
| 941 | /// Transport Layer Security |
| 942 | pub const IPPROTO_TLSP: c_int = 56; |
| 943 | /// SKIP |
| 944 | pub const IPPROTO_SKIP: c_int = 57; |
| 945 | // IPPROTO_ICMPV6 defined in src/unix/mod.rs |
| 946 | /// IP6 no next header |
| 947 | pub const IPPROTO_NONE: c_int = 59; |
| 948 | /// IP6 destination option |
| 949 | pub const IPPROTO_DSTOPTS: c_int = 60; |
| 950 | /// any host internal protocol |
| 951 | pub const IPPROTO_AHIP: c_int = 61; |
| 952 | /// CFTP |
| 953 | pub const IPPROTO_CFTP: c_int = 62; |
| 954 | /// "hello" routing protocol |
| 955 | pub const IPPROTO_HELLO: c_int = 63; |
| 956 | /// SATNET/Backroom EXPAK |
| 957 | pub const IPPROTO_SATEXPAK: c_int = 64; |
| 958 | /// Kryptolan |
| 959 | pub const IPPROTO_KRYPTOLAN: c_int = 65; |
| 960 | /// Remote Virtual Disk |
| 961 | pub const IPPROTO_RVD: c_int = 66; |
| 962 | /// Pluribus Packet Core |
| 963 | pub const IPPROTO_IPPC: c_int = 67; |
| 964 | /// Any distributed FS |
| 965 | pub const IPPROTO_ADFS: c_int = 68; |
| 966 | /// Satnet Monitoring |
| 967 | pub const IPPROTO_SATMON: c_int = 69; |
| 968 | /// VISA Protocol |
| 969 | pub const IPPROTO_VISA: c_int = 70; |
| 970 | /// Packet Core Utility |
| 971 | pub const IPPROTO_IPCV: c_int = 71; |
| 972 | /// Comp. Prot. Net. Executive |
| 973 | pub const IPPROTO_CPNX: c_int = 72; |
| 974 | /// Comp. Prot. HeartBeat |
| 975 | pub const IPPROTO_CPHB: c_int = 73; |
| 976 | /// Wang Span Network |
| 977 | pub const IPPROTO_WSN: c_int = 74; |
| 978 | /// Packet Video Protocol |
| 979 | pub const IPPROTO_PVP: c_int = 75; |
| 980 | /// BackRoom SATNET Monitoring |
| 981 | pub const IPPROTO_BRSATMON: c_int = 76; |
| 982 | /// Sun net disk proto (temp.) |
| 983 | pub const IPPROTO_ND: c_int = 77; |
| 984 | /// WIDEBAND Monitoring |
| 985 | pub const IPPROTO_WBMON: c_int = 78; |
| 986 | /// WIDEBAND EXPAK |
| 987 | pub const IPPROTO_WBEXPAK: c_int = 79; |
| 988 | /// ISO cnlp |
| 989 | pub const IPPROTO_EON: c_int = 80; |
| 990 | /// VMTP |
| 991 | pub const IPPROTO_VMTP: c_int = 81; |
| 992 | /// Secure VMTP |
| 993 | pub const IPPROTO_SVMTP: c_int = 82; |
| 994 | /// Banyon VINES |
| 995 | pub const IPPROTO_VINES: c_int = 83; |
| 996 | /// TTP |
| 997 | pub const IPPROTO_TTP: c_int = 84; |
| 998 | /// NSFNET-IGP |
| 999 | pub const IPPROTO_IGP: c_int = 85; |
| 1000 | /// dissimilar gateway prot. |
| 1001 | pub const IPPROTO_DGP: c_int = 86; |
| 1002 | /// TCF |
| 1003 | pub const IPPROTO_TCF: c_int = 87; |
| 1004 | /// Cisco/GXS IGRP |
| 1005 | pub const IPPROTO_IGRP: c_int = 88; |
| 1006 | /// OSPFIGP |
| 1007 | pub const IPPROTO_OSPFIGP: c_int = 89; |
| 1008 | /// Strite RPC protocol |
| 1009 | pub const IPPROTO_SRPC: c_int = 90; |
| 1010 | /// Locus Address Resoloution |
| 1011 | pub const IPPROTO_LARP: c_int = 91; |
| 1012 | /// Multicast Transport |
| 1013 | pub const IPPROTO_MTP: c_int = 92; |
| 1014 | /// AX.25 Frames |
| 1015 | pub const IPPROTO_AX25: c_int = 93; |
| 1016 | /// IP encapsulated in IP |
| 1017 | pub const IPPROTO_IPEIP: c_int = 94; |
| 1018 | /// Mobile Int.ing control |
| 1019 | pub const IPPROTO_MICP: c_int = 95; |
| 1020 | /// Semaphore Comm. security |
| 1021 | pub const IPPROTO_SCCSP: c_int = 96; |
| 1022 | /// Ethernet IP encapsulation |
| 1023 | pub const IPPROTO_ETHERIP: c_int = 97; |
| 1024 | /// encapsulation header |
| 1025 | pub const IPPROTO_ENCAP: c_int = 98; |
| 1026 | /// any private encr. scheme |
| 1027 | pub const IPPROTO_APES: c_int = 99; |
| 1028 | /// GMTP |
| 1029 | pub const IPPROTO_GMTP: c_int = 100; |
| 1030 | /// payload compression (IPComp) |
| 1031 | pub const IPPROTO_IPCOMP: c_int = 108; |
| 1032 | |
| 1033 | /* 101-254: Partly Unassigned */ |
| 1034 | /// Protocol Independent Mcast |
| 1035 | pub const IPPROTO_PIM: c_int = 103; |
| 1036 | /// CARP |
| 1037 | pub const IPPROTO_CARP: c_int = 112; |
| 1038 | /// PGM |
| 1039 | pub const IPPROTO_PGM: c_int = 113; |
| 1040 | /// PFSYNC |
| 1041 | pub const IPPROTO_PFSYNC: c_int = 240; |
| 1042 | |
| 1043 | /* 255: Reserved */ |
| 1044 | /* BSD Private, local use, namespace incursion, no longer used */ |
| 1045 | /// divert pseudo-protocol |
| 1046 | pub const IPPROTO_DIVERT: c_int = 254; |
| 1047 | pub const IPPROTO_MAX: c_int = 256; |
| 1048 | /// last return value of *_input(), meaning "all job for this pkt is done". |
| 1049 | pub const IPPROTO_DONE: c_int = 257; |
| 1050 | |
| 1051 | /// Used by RSS: the layer3 protocol is unknown |
| 1052 | pub const IPPROTO_UNKNOWN: c_int = 258; |
| 1053 | |
| 1054 | // sys/netinet/tcp.h |
| 1055 | pub const TCP_SIGNATURE_ENABLE: c_int = 16; |
| 1056 | pub const TCP_KEEPINIT: c_int = 32; |
| 1057 | pub const TCP_FASTKEEP: c_int = 128; |
| 1058 | |
| 1059 | pub const AF_BLUETOOTH: c_int = 33; |
| 1060 | pub const AF_MPLS: c_int = 34; |
| 1061 | pub const AF_IEEE80211: c_int = 35; |
| 1062 | pub const AF_ARP: c_int = 36; |
| 1063 | |
| 1064 | pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH; |
| 1065 | pub const PF_ARP: c_int = AF_ARP; |
| 1066 | |
| 1067 | pub const NET_RT_DUMP: c_int = 1; |
| 1068 | pub const NET_RT_FLAGS: c_int = 2; |
| 1069 | pub const NET_RT_IFLIST: c_int = 3; |
| 1070 | pub const NET_RT_MAXID: c_int = 4; |
| 1071 | |
| 1072 | pub const SOMAXOPT_SIZE: c_int = 65536; |
| 1073 | |
| 1074 | pub const MSG_UNUSED09: c_int = 0x00000200; |
| 1075 | pub const MSG_NOSIGNAL: c_int = 0x00000400; |
| 1076 | pub const MSG_SYNC: c_int = 0x00000800; |
| 1077 | pub const MSG_CMSG_CLOEXEC: c_int = 0x00001000; |
| 1078 | pub const MSG_FBLOCKING: c_int = 0x00010000; |
| 1079 | pub const MSG_FNONBLOCKING: c_int = 0x00020000; |
| 1080 | pub const MSG_FMASK: c_int = u32_cast_int(0xFFFF0000); |
| 1081 | |
| 1082 | // sys/mount.h |
| 1083 | pub const MNT_NODEV: c_int = 0x00000010; |
| 1084 | pub const MNT_AUTOMOUNTED: c_int = 0x00000020; |
| 1085 | pub const MNT_TRIM: c_int = 0x01000000; |
| 1086 | pub const MNT_LOCAL: c_int = 0x00001000; |
| 1087 | pub const MNT_QUOTA: c_int = 0x00002000; |
| 1088 | pub const MNT_ROOTFS: c_int = 0x00004000; |
| 1089 | pub const MNT_USER: c_int = 0x00008000; |
| 1090 | pub const MNT_IGNORE: c_int = 0x00800000; |
| 1091 | |
| 1092 | // utmpx entry types |
| 1093 | pub const EMPTY: c_short = 0; |
| 1094 | pub const RUN_LVL: c_short = 1; |
| 1095 | pub const BOOT_TIME: c_short = 2; |
| 1096 | pub const OLD_TIME: c_short = 3; |
| 1097 | pub const NEW_TIME: c_short = 4; |
| 1098 | pub const INIT_PROCESS: c_short = 5; |
| 1099 | pub const LOGIN_PROCESS: c_short = 6; |
| 1100 | pub const USER_PROCESS: c_short = 7; |
| 1101 | pub const DEAD_PROCESS: c_short = 8; |
| 1102 | pub const ACCOUNTING: c_short = 9; |
| 1103 | pub const SIGNATURE: c_short = 10; |
| 1104 | pub const DOWNTIME: c_short = 11; |
| 1105 | // utmpx database types |
| 1106 | pub const UTX_DB_UTMPX: c_uint = 0; |
| 1107 | pub const UTX_DB_WTMPX: c_uint = 1; |
| 1108 | pub const UTX_DB_LASTLOGX: c_uint = 2; |
| 1109 | #[deprecated(since = "0.2.187", note = "Replaced on DragonFly by UTX_DB_LASTLOGX")] |
| 1110 | pub const UTX_DB_LASTLOG: c_uint = UTX_DB_LASTLOGX; |
| 1111 | pub const _UTX_LINESIZE: usize = 32; |
| 1112 | pub const _UTX_USERSIZE: usize = 32; |
| 1113 | pub const _UTX_IDSIZE: usize = 4; |
| 1114 | pub const _UTX_HOSTSIZE: usize = 256; |
| 1115 | |
| 1116 | pub const EXTATTR_NAMESPACE_EMPTY: c_int = 0; |
| 1117 | pub const EXTATTR_NAMESPACE_USER: c_int = 1; |
| 1118 | pub const EXTATTR_NAMESPACE_SYSTEM: c_int = 2; |
| 1119 | |
| 1120 | pub const GRND_NONBLOCK: c_uint = 0x2; |
| 1121 | pub const GRND_RANDOM: c_uint = 0x1; |
| 1122 | pub const GRND_INSECURE: c_uint = 0x4; |
| 1123 | |
| 1124 | pub const NI_NOFQDN: c_int = 0x00000001; |
| 1125 | pub const NI_NUMERICHOST: c_int = 0x00000002; |
| 1126 | pub const NI_NAMEREQD: c_int = 0x00000004; |
| 1127 | pub const NI_NUMERICSERV: c_int = 0x00000008; |
| 1128 | pub const NI_DGRAM: c_int = 0x00000010; |
| 1129 | pub const NI_NUMERICSCOPE: c_int = 0x00000040; |
| 1130 | |
| 1131 | pub const B460800: crate::speed_t = 460800; |
| 1132 | pub const B921600: crate::speed_t = 921600; |
| 1133 | |
| 1134 | pub const LC_COLLATE_MASK: c_int = 1 << 0; |
| 1135 | pub const LC_CTYPE_MASK: c_int = 1 << 1; |
| 1136 | pub const LC_MONETARY_MASK: c_int = 1 << 2; |
| 1137 | pub const LC_NUMERIC_MASK: c_int = 1 << 3; |
| 1138 | pub const LC_TIME_MASK: c_int = 1 << 4; |
| 1139 | pub const LC_MESSAGES_MASK: c_int = 1 << 5; |
| 1140 | pub const LC_ALL_MASK: c_int = LC_COLLATE_MASK |
| 1141 | | LC_CTYPE_MASK |
| 1142 | | LC_MESSAGES_MASK |
| 1143 | | LC_MONETARY_MASK |
| 1144 | | LC_NUMERIC_MASK |
| 1145 | | LC_TIME_MASK; |
| 1146 | |
| 1147 | pub const TIOCSIG: c_ulong = 0x2000745f; |
| 1148 | pub const BTUARTDISC: c_int = 0x7; |
| 1149 | pub const TIOCDCDTIMESTAMP: c_ulong = 0x40107458; |
| 1150 | pub const TIOCISPTMASTER: c_ulong = 0x20007455; |
| 1151 | pub const TIOCMODG: c_ulong = 0x40047403; |
| 1152 | pub const TIOCMODS: c_ulong = 0x80047404; |
| 1153 | pub const TIOCREMOTE: c_ulong = 0x80047469; |
| 1154 | pub const TIOCTIMESTAMP: c_ulong = 0x40107459; |
| 1155 | pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; |
| 1156 | pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; |
| 1157 | |
| 1158 | // Constants used by "at" family of system calls. |
| 1159 | pub const AT_FDCWD: c_int = u32_cast_int(0xFFFAFDCD); // invalid file descriptor |
| 1160 | pub const AT_SYMLINK_NOFOLLOW: c_int = 1; |
| 1161 | pub const AT_REMOVEDIR: c_int = 2; |
| 1162 | pub const AT_EACCESS: c_int = 4; |
| 1163 | pub const AT_SYMLINK_FOLLOW: c_int = 8; |
| 1164 | |
| 1165 | pub const VCHECKPT: usize = 19; |
| 1166 | |
| 1167 | pub const _PC_2_SYMLINKS: c_int = 22; |
| 1168 | pub const _PC_TIMESTAMP_RESOLUTION: c_int = 23; |
| 1169 | |
| 1170 | pub const _SC_V7_ILP32_OFF32: c_int = 122; |
| 1171 | pub const _SC_V7_ILP32_OFFBIG: c_int = 123; |
| 1172 | pub const _SC_V7_LP64_OFF64: c_int = 124; |
| 1173 | pub const _SC_V7_LPBIG_OFFBIG: c_int = 125; |
| 1174 | pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 126; |
| 1175 | pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 127; |
| 1176 | |
| 1177 | pub const WCONTINUED: c_int = 0x4; |
| 1178 | pub const WSTOPPED: c_int = 0x2; |
| 1179 | pub const WNOWAIT: c_int = 0x8; |
| 1180 | pub const WEXITED: c_int = 0x10; |
| 1181 | pub const WTRAPPED: c_int = 0x20; |
| 1182 | |
| 1183 | // Similar to FreeBSD, only the standardized ones are exposed. |
| 1184 | // There are more. |
| 1185 | pub const P_PID: idtype_t = 0; |
| 1186 | pub const P_PGID: idtype_t = 2; |
| 1187 | pub const P_ALL: idtype_t = 7; |
| 1188 | |
| 1189 | // Values for struct rtprio (type_ field) |
| 1190 | pub const RTP_PRIO_REALTIME: c_ushort = 0; |
| 1191 | pub const RTP_PRIO_NORMAL: c_ushort = 1; |
| 1192 | pub const RTP_PRIO_IDLE: c_ushort = 2; |
| 1193 | pub const RTP_PRIO_THREAD: c_ushort = 3; |
| 1194 | |
| 1195 | // Flags for chflags(2) |
| 1196 | pub const UF_NOHISTORY: c_ulong = 0x00000040; |
| 1197 | pub const UF_CACHE: c_ulong = 0x00000080; |
| 1198 | pub const UF_XLINK: c_ulong = 0x00000100; |
| 1199 | pub const SF_NOHISTORY: c_ulong = 0x00400000; |
| 1200 | pub const SF_CACHE: c_ulong = 0x00800000; |
| 1201 | pub const SF_XLINK: c_ulong = 0x01000000; |
| 1202 | |
| 1203 | // timespec constants |
| 1204 | pub const UTIME_OMIT: c_long = -2; |
| 1205 | pub const UTIME_NOW: c_long = -1; |
| 1206 | |
| 1207 | pub const MINCORE_SUPER: c_int = 0x20; |
| 1208 | |
| 1209 | // kinfo_proc constants |
| 1210 | pub const MAXCOMLEN: usize = 16; |
| 1211 | pub const MAXLOGNAME: usize = 33; |
| 1212 | pub const NGROUPS: usize = 16; |
| 1213 | |
| 1214 | pub const RB_PAUSE: c_int = 0x40000; |
| 1215 | pub const RB_VIDEO: c_int = 0x20000000; |
| 1216 | |
| 1217 | // net/route.h |
| 1218 | pub const RTF_CLONING: c_int = 0x100; |
| 1219 | pub const RTF_PRCLONING: c_int = 0x10000; |
| 1220 | pub const RTF_WASCLONED: c_int = 0x20000; |
| 1221 | pub const RTF_MPLSOPS: c_int = 0x1000000; |
| 1222 | |
| 1223 | pub const RTM_VERSION: c_int = 7; |
| 1224 | |
| 1225 | pub const RTAX_MPLS1: c_int = 8; |
| 1226 | pub const RTAX_MPLS2: c_int = 9; |
| 1227 | pub const RTAX_MPLS3: c_int = 10; |
| 1228 | |
| 1229 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1230 | /// for details. |
| 1231 | pub const RTAX_MAX: c_int = 11; |
| 1232 | |
| 1233 | const fn _CMSG_ALIGN(n: usize) -> usize { |
| 1234 | (n + (size_of::<c_long>() - 1)) & !(size_of::<c_long>() - 1) |
| 1235 | } |
| 1236 | |
| 1237 | f! { |
| 1238 | pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { |
| 1239 | (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(size_of::<cmsghdr>()) as isize) |
| 1240 | } |
| 1241 | |
| 1242 | pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint { |
| 1243 | (_CMSG_ALIGN(size_of::<cmsghdr>()) + length as usize) as c_uint |
| 1244 | } |
| 1245 | |
| 1246 | pub unsafe fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { |
| 1247 | let next = cmsg as usize |
| 1248 | + _CMSG_ALIGN((*cmsg).cmsg_len as usize) |
| 1249 | + _CMSG_ALIGN(size_of::<cmsghdr>()); |
| 1250 | let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1251 | if next <= max { |
| 1252 | (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr |
| 1253 | } else { |
| 1254 | ptr::null_mut() |
| 1255 | } |
| 1256 | } |
| 1257 | |
| 1258 | pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { |
| 1259 | (_CMSG_ALIGN(size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize)) as c_uint |
| 1260 | } |
| 1261 | |
| 1262 | pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { |
| 1263 | cpuset.ary.fill(0); |
| 1264 | } |
| 1265 | |
| 1266 | pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1267 | let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); |
| 1268 | cpuset.ary[idx] |= 1 << offset; |
| 1269 | () |
| 1270 | } |
| 1271 | |
| 1272 | pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1273 | let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); |
| 1274 | cpuset.ary[idx] &= !(1 << offset); |
| 1275 | () |
| 1276 | } |
| 1277 | |
| 1278 | pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { |
| 1279 | let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); |
| 1280 | 0 != cpuset.ary[idx] & (1 << offset) |
| 1281 | } |
| 1282 | } |
| 1283 | |
| 1284 | safe_f! { |
| 1285 | pub const safe fn WIFSIGNALED(status: c_int) -> bool { |
| 1286 | (status & 0o177) != 0o177 && (status & 0o177) != 0 |
| 1287 | } |
| 1288 | |
| 1289 | pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { |
| 1290 | let major = major as crate::dev_t; |
| 1291 | let minor = minor as crate::dev_t; |
| 1292 | let mut dev = 0; |
| 1293 | dev |= major << 8; |
| 1294 | dev |= minor; |
| 1295 | dev |
| 1296 | } |
| 1297 | |
| 1298 | pub const safe fn major(dev: crate::dev_t) -> c_int { |
| 1299 | ((dev >> 8) & 0xff) as c_int |
| 1300 | } |
| 1301 | |
| 1302 | pub const safe fn minor(dev: crate::dev_t) -> c_int { |
| 1303 | (dev & 0xffff00ff) as c_int |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | extern "C" { |
| 1308 | pub fn __errno_location() -> *mut c_int; |
| 1309 | pub fn setgrent(); |
| 1310 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1311 | |
| 1312 | pub fn setutxdb(_type: c_uint, file: *mut c_char) -> c_int; |
| 1313 | |
| 1314 | pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut crate::timespec) -> c_int; |
| 1315 | |
| 1316 | pub fn devname_r( |
| 1317 | dev: crate::dev_t, |
| 1318 | mode: crate::mode_t, |
| 1319 | buf: *mut c_char, |
| 1320 | len: size_t, |
| 1321 | ) -> *mut c_char; |
| 1322 | |
| 1323 | pub fn waitid( |
| 1324 | idtype: idtype_t, |
| 1325 | id: crate::id_t, |
| 1326 | infop: *mut crate::siginfo_t, |
| 1327 | options: c_int, |
| 1328 | ) -> c_int; |
| 1329 | |
| 1330 | pub fn freelocale(loc: crate::locale_t); |
| 1331 | |
| 1332 | pub fn lwp_rtprio( |
| 1333 | function: c_int, |
| 1334 | pid: crate::pid_t, |
| 1335 | lwpid: lwpid_t, |
| 1336 | rtp: *mut super::rtprio, |
| 1337 | ) -> c_int; |
| 1338 | |
| 1339 | pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; |
| 1340 | pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; |
| 1341 | pub fn fdatasync(fd: c_int) -> c_int; |
| 1342 | pub fn uname(buf: *mut crate::utsname) -> c_int; |
| 1343 | pub fn memmem( |
| 1344 | haystack: *const c_void, |
| 1345 | haystacklen: size_t, |
| 1346 | needle: *const c_void, |
| 1347 | needlelen: size_t, |
| 1348 | ) -> *mut c_void; |
| 1349 | pub fn dlvsym( |
| 1350 | handle: *mut c_void, |
| 1351 | symbol: *const c_char, |
| 1352 | version: *const c_char, |
| 1353 | ) -> *mut c_void; |
| 1354 | pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void; |
| 1355 | pub fn qsort_r( |
| 1356 | base: *mut c_void, |
| 1357 | num: size_t, |
| 1358 | size: size_t, |
| 1359 | arg: *mut c_void, |
| 1360 | compar: Option<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>, |
| 1361 | ); |
| 1362 | pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int; |
| 1363 | pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int; |
| 1364 | pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int; |
| 1365 | pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int; |
| 1366 | pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int; |
| 1367 | |
| 1368 | pub fn pthread_getaffinity_np( |
| 1369 | td: crate::pthread_t, |
| 1370 | cpusetsize: size_t, |
| 1371 | cpusetp: *mut cpuset_t, |
| 1372 | ) -> c_int; |
| 1373 | pub fn pthread_setaffinity_np( |
| 1374 | td: crate::pthread_t, |
| 1375 | cpusetsize: size_t, |
| 1376 | cpusetp: *const cpuset_t, |
| 1377 | ) -> c_int; |
| 1378 | |
| 1379 | pub fn sched_getaffinity(pid: crate::pid_t, cpusetsize: size_t, mask: *mut cpu_set_t) -> c_int; |
| 1380 | pub fn sched_setaffinity( |
| 1381 | pid: crate::pid_t, |
| 1382 | cpusetsize: size_t, |
| 1383 | mask: *const cpu_set_t, |
| 1384 | ) -> c_int; |
| 1385 | pub fn sched_getcpu() -> c_int; |
| 1386 | pub fn setproctitle(fmt: *const c_char, ...); |
| 1387 | |
| 1388 | pub fn ftok(path: *const c_char, id: c_int) -> crate::key_t; |
| 1389 | pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int; |
| 1390 | pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void; |
| 1391 | pub fn shmdt(shmaddr: *const c_void) -> c_int; |
| 1392 | pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int; |
| 1393 | pub fn procctl( |
| 1394 | idtype: crate::idtype_t, |
| 1395 | id: crate::id_t, |
| 1396 | cmd: c_int, |
| 1397 | data: *mut c_void, |
| 1398 | ) -> c_int; |
| 1399 | |
| 1400 | pub fn updwtmpx(file: *const c_char, ut: *const utmpx) -> c_int; |
| 1401 | pub fn getlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) |
| 1402 | -> *mut lastlogx; |
| 1403 | pub fn updlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) -> c_int; |
| 1404 | pub fn getutxuser(name: *const c_char) -> utmpx; |
| 1405 | pub fn utmpxname(file: *const c_char) -> c_int; |
| 1406 | |
| 1407 | pub fn sys_checkpoint(tpe: c_int, fd: c_int, pid: crate::pid_t, retval: c_int) -> c_int; |
| 1408 | |
| 1409 | pub fn umtx_sleep(ptr: *const c_int, value: c_int, timeout: c_int) -> c_int; |
| 1410 | pub fn umtx_wakeup(ptr: *const c_int, count: c_int) -> c_int; |
| 1411 | |
| 1412 | pub fn dirname(path: *mut c_char) -> *mut c_char; |
| 1413 | pub fn basename(path: *mut c_char) -> *mut c_char; |
| 1414 | pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, flags: c_int) -> c_int; |
| 1415 | pub fn getmntvinfo( |
| 1416 | mntbufp: *mut *mut crate::statfs, |
| 1417 | mntvbufp: *mut *mut crate::statvfs, |
| 1418 | flags: c_int, |
| 1419 | ) -> c_int; |
| 1420 | |
| 1421 | pub fn extattr_delete_file( |
| 1422 | path: *const c_char, |
| 1423 | attrnamespace: c_int, |
| 1424 | attrname: *const c_char, |
| 1425 | ) -> c_int; |
| 1426 | pub fn extattr_get_file( |
| 1427 | path: *const c_char, |
| 1428 | attrnamespace: c_int, |
| 1429 | attrname: *const c_char, |
| 1430 | data: *mut c_void, |
| 1431 | nbytes: size_t, |
| 1432 | ) -> ssize_t; |
| 1433 | pub fn extattr_set_file( |
| 1434 | path: *const c_char, |
| 1435 | attrnamespace: c_int, |
| 1436 | attrname: *const c_char, |
| 1437 | data: *const c_void, |
| 1438 | nbytes: size_t, |
| 1439 | ) -> c_int; |
| 1440 | |
| 1441 | pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int; |
| 1442 | pub fn closefrom(lowfd: c_int) -> c_int; |
| 1443 | } |
| 1444 | |
| 1445 | #[link(name = "rt")] |
| 1446 | extern "C" { |
| 1447 | pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int; |
| 1448 | pub fn aio_error(aiocbp: *const aiocb) -> c_int; |
| 1449 | pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int; |
| 1450 | pub fn aio_read(aiocbp: *mut aiocb) -> c_int; |
| 1451 | pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t; |
| 1452 | pub fn aio_suspend( |
| 1453 | aiocb_list: *const *const aiocb, |
| 1454 | nitems: c_int, |
| 1455 | timeout: *const crate::timespec, |
| 1456 | ) -> c_int; |
| 1457 | pub fn aio_write(aiocbp: *mut aiocb) -> c_int; |
| 1458 | pub fn lio_listio( |
| 1459 | mode: c_int, |
| 1460 | aiocb_list: *const *mut aiocb, |
| 1461 | nitems: c_int, |
| 1462 | sevp: *mut sigevent, |
| 1463 | ) -> c_int; |
| 1464 | |
| 1465 | pub fn reallocf(ptr: *mut c_void, size: size_t) -> *mut c_void; |
| 1466 | pub fn freezero(ptr: *mut c_void, size: size_t); |
| 1467 | } |
| 1468 | |
| 1469 | #[link(name = "kvm")] |
| 1470 | extern "C" { |
| 1471 | pub fn kvm_vm_map_entry_first( |
| 1472 | kvm: *mut crate::kvm_t, |
| 1473 | map: vm_map_t, |
| 1474 | entry: vm_map_entry_t, |
| 1475 | ) -> vm_map_entry_t; |
| 1476 | pub fn kvm_vm_map_entry_next( |
| 1477 | kvm: *mut crate::kvm_t, |
| 1478 | map: vm_map_entry_t, |
| 1479 | entry: vm_map_entry_t, |
| 1480 | ) -> vm_map_entry_t; |
| 1481 | } |