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 / netbsdlike / openbsd / mod.rs
| 1 | use crate::prelude::*; |
| 2 | use crate::unix::bsd::O_SYNC; |
| 3 | use crate::{ |
| 4 | cmsghdr, |
| 5 | off_t, |
| 6 | }; |
| 7 | |
| 8 | pub type clock_t = i64; |
| 9 | pub type suseconds_t = c_long; |
| 10 | pub type dev_t = i32; |
| 11 | pub type sigset_t = c_uint; |
| 12 | pub type blksize_t = i32; |
| 13 | pub type fsblkcnt_t = u64; |
| 14 | pub type fsfilcnt_t = u64; |
| 15 | pub type idtype_t = c_uint; |
| 16 | pub type pthread_attr_t = *mut c_void; |
| 17 | pub type pthread_mutex_t = *mut c_void; |
| 18 | pub type pthread_mutexattr_t = *mut c_void; |
| 19 | pub type pthread_cond_t = *mut c_void; |
| 20 | pub type pthread_condattr_t = *mut c_void; |
| 21 | pub type pthread_rwlock_t = *mut c_void; |
| 22 | pub type pthread_rwlockattr_t = *mut c_void; |
| 23 | pub type pthread_spinlock_t = crate::uintptr_t; |
| 24 | pub type caddr_t = *mut c_char; |
| 25 | |
| 26 | // elf.h |
| 27 | |
| 28 | pub type Elf32_Addr = u32; |
| 29 | pub type Elf32_Half = u16; |
| 30 | pub type Elf32_Lword = u64; |
| 31 | pub type Elf32_Off = u32; |
| 32 | pub type Elf32_Sword = i32; |
| 33 | pub type Elf32_Word = u32; |
| 34 | |
| 35 | pub type Elf64_Addr = u64; |
| 36 | pub type Elf64_Half = u16; |
| 37 | pub type Elf64_Lword = u64; |
| 38 | pub type Elf64_Off = u64; |
| 39 | pub type Elf64_Sword = i32; |
| 40 | pub type Elf64_Sxword = i64; |
| 41 | pub type Elf64_Word = u32; |
| 42 | pub type Elf64_Xword = u64; |
| 43 | |
| 44 | // search.h |
| 45 | |
| 46 | pub type ENTRY = entry; |
| 47 | pub type ACTION = c_uint; |
| 48 | |
| 49 | // spawn.h |
| 50 | pub type posix_spawnattr_t = *mut c_void; |
| 51 | pub type posix_spawn_file_actions_t = *mut c_void; |
| 52 | |
| 53 | cfg_if! { |
| 54 | if #[cfg(target_pointer_width = "64")] { |
| 55 | type Elf_Addr = Elf64_Addr; |
| 56 | type Elf_Half = Elf64_Half; |
| 57 | type Elf_Phdr = Elf64_Phdr; |
| 58 | } else if #[cfg(target_pointer_width = "32")] { |
| 59 | type Elf_Addr = Elf32_Addr; |
| 60 | type Elf_Half = Elf32_Half; |
| 61 | type Elf_Phdr = Elf32_Phdr; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | s! { |
| 66 | pub struct ip_mreqn { |
| 67 | pub imr_multiaddr: in_addr, |
| 68 | pub imr_address: in_addr, |
| 69 | pub imr_ifindex: c_int, |
| 70 | } |
| 71 | |
| 72 | pub struct glob_t { |
| 73 | pub gl_pathc: size_t, |
| 74 | pub gl_matchc: size_t, |
| 75 | pub gl_offs: size_t, |
| 76 | pub gl_flags: c_int, |
| 77 | pub gl_pathv: *mut *mut c_char, |
| 78 | __unused1: Padding<*mut c_void>, |
| 79 | __unused2: Padding<*mut c_void>, |
| 80 | __unused3: Padding<*mut c_void>, |
| 81 | __unused4: Padding<*mut c_void>, |
| 82 | __unused5: Padding<*mut c_void>, |
| 83 | __unused6: Padding<*mut c_void>, |
| 84 | __unused7: Padding<*mut c_void>, |
| 85 | } |
| 86 | |
| 87 | pub struct tm { |
| 88 | pub tm_sec: c_int, |
| 89 | pub tm_min: c_int, |
| 90 | pub tm_hour: c_int, |
| 91 | pub tm_mday: c_int, |
| 92 | pub tm_mon: c_int, |
| 93 | pub tm_year: c_int, |
| 94 | pub tm_wday: c_int, |
| 95 | pub tm_yday: c_int, |
| 96 | pub tm_isdst: c_int, |
| 97 | pub tm_gmtoff: c_long, |
| 98 | pub tm_zone: *const c_char, |
| 99 | } |
| 100 | |
| 101 | pub struct lconv { |
| 102 | pub decimal_point: *mut c_char, |
| 103 | pub thousands_sep: *mut c_char, |
| 104 | pub grouping: *mut c_char, |
| 105 | pub int_curr_symbol: *mut c_char, |
| 106 | pub currency_symbol: *mut c_char, |
| 107 | pub mon_decimal_point: *mut c_char, |
| 108 | pub mon_thousands_sep: *mut c_char, |
| 109 | pub mon_grouping: *mut c_char, |
| 110 | pub positive_sign: *mut c_char, |
| 111 | pub negative_sign: *mut c_char, |
| 112 | pub int_frac_digits: c_char, |
| 113 | pub frac_digits: c_char, |
| 114 | pub p_cs_precedes: c_char, |
| 115 | pub p_sep_by_space: c_char, |
| 116 | pub n_cs_precedes: c_char, |
| 117 | pub n_sep_by_space: c_char, |
| 118 | pub p_sign_posn: c_char, |
| 119 | pub n_sign_posn: c_char, |
| 120 | pub int_p_cs_precedes: c_char, |
| 121 | pub int_p_sep_by_space: c_char, |
| 122 | pub int_n_cs_precedes: c_char, |
| 123 | pub int_n_sep_by_space: c_char, |
| 124 | pub int_p_sign_posn: c_char, |
| 125 | pub int_n_sign_posn: c_char, |
| 126 | } |
| 127 | |
| 128 | pub struct ufs_args { |
| 129 | pub fspec: *mut c_char, |
| 130 | pub export_info: export_args, |
| 131 | } |
| 132 | |
| 133 | pub struct mfs_args { |
| 134 | pub fspec: *mut c_char, |
| 135 | pub export_info: export_args, |
| 136 | // https://github.com/openbsd/src/blob/HEAD/sys/sys/types.h#L134 |
| 137 | pub base: *mut c_char, |
| 138 | pub size: c_ulong, |
| 139 | } |
| 140 | |
| 141 | pub struct iso_args { |
| 142 | pub fspec: *mut c_char, |
| 143 | pub export_info: export_args, |
| 144 | pub flags: c_int, |
| 145 | pub sess: c_int, |
| 146 | } |
| 147 | |
| 148 | pub struct nfs_args { |
| 149 | pub version: c_int, |
| 150 | pub addr: *mut crate::sockaddr, |
| 151 | pub addrlen: c_int, |
| 152 | pub sotype: c_int, |
| 153 | pub proto: c_int, |
| 154 | pub fh: *mut c_uchar, |
| 155 | pub fhsize: c_int, |
| 156 | pub flags: c_int, |
| 157 | pub wsize: c_int, |
| 158 | pub rsize: c_int, |
| 159 | pub readdirsize: c_int, |
| 160 | pub timeo: c_int, |
| 161 | pub retrans: c_int, |
| 162 | pub maxgrouplist: c_int, |
| 163 | pub readahead: c_int, |
| 164 | pub leaseterm: c_int, |
| 165 | pub deadthresh: c_int, |
| 166 | pub hostname: *mut c_char, |
| 167 | pub acregmin: c_int, |
| 168 | pub acregmax: c_int, |
| 169 | pub acdirmin: c_int, |
| 170 | pub acdirmax: c_int, |
| 171 | } |
| 172 | |
| 173 | pub struct msdosfs_args { |
| 174 | pub fspec: *mut c_char, |
| 175 | pub export_info: export_args, |
| 176 | pub uid: crate::uid_t, |
| 177 | pub gid: crate::gid_t, |
| 178 | pub mask: crate::mode_t, |
| 179 | pub flags: c_int, |
| 180 | } |
| 181 | |
| 182 | pub struct ntfs_args { |
| 183 | pub fspec: *mut c_char, |
| 184 | pub export_info: export_args, |
| 185 | pub uid: crate::uid_t, |
| 186 | pub gid: crate::gid_t, |
| 187 | pub mode: crate::mode_t, |
| 188 | pub flag: c_ulong, |
| 189 | } |
| 190 | |
| 191 | pub struct udf_args { |
| 192 | pub fspec: *mut c_char, |
| 193 | pub lastblock: u32, |
| 194 | } |
| 195 | |
| 196 | pub struct tmpfs_args { |
| 197 | pub ta_version: c_int, |
| 198 | pub ta_nodes_max: crate::ino_t, |
| 199 | pub ta_size_max: off_t, |
| 200 | pub ta_root_uid: crate::uid_t, |
| 201 | pub ta_root_gid: crate::gid_t, |
| 202 | pub ta_root_mode: crate::mode_t, |
| 203 | } |
| 204 | |
| 205 | pub struct fusefs_args { |
| 206 | pub name: *mut c_char, |
| 207 | pub fd: c_int, |
| 208 | pub max_read: c_int, |
| 209 | pub allow_other: c_int, |
| 210 | } |
| 211 | |
| 212 | pub struct xucred { |
| 213 | pub cr_uid: crate::uid_t, |
| 214 | pub cr_gid: crate::gid_t, |
| 215 | pub cr_ngroups: c_short, |
| 216 | //https://github.com/openbsd/src/blob/HEAD/sys/sys/syslimits.h#L44 |
| 217 | pub cr_groups: [crate::gid_t; 16], |
| 218 | } |
| 219 | |
| 220 | pub struct export_args { |
| 221 | pub ex_flags: c_int, |
| 222 | pub ex_root: crate::uid_t, |
| 223 | pub ex_anon: xucred, |
| 224 | pub ex_addr: *mut crate::sockaddr, |
| 225 | pub ex_addrlen: c_int, |
| 226 | pub ex_mask: *mut crate::sockaddr, |
| 227 | pub ex_masklen: c_int, |
| 228 | } |
| 229 | |
| 230 | pub struct ip_mreq { |
| 231 | pub imr_multiaddr: in_addr, |
| 232 | pub imr_interface: in_addr, |
| 233 | } |
| 234 | |
| 235 | pub struct in_addr { |
| 236 | pub s_addr: crate::in_addr_t, |
| 237 | } |
| 238 | |
| 239 | pub struct sockaddr_in { |
| 240 | pub sin_len: u8, |
| 241 | pub sin_family: crate::sa_family_t, |
| 242 | pub sin_port: crate::in_port_t, |
| 243 | pub sin_addr: crate::in_addr, |
| 244 | pub sin_zero: [i8; 8], |
| 245 | } |
| 246 | |
| 247 | pub struct splice { |
| 248 | pub sp_fd: c_int, |
| 249 | pub sp_max: off_t, |
| 250 | pub sp_idle: crate::timeval, |
| 251 | } |
| 252 | |
| 253 | pub struct kevent { |
| 254 | pub ident: crate::uintptr_t, |
| 255 | pub filter: c_short, |
| 256 | pub flags: c_ushort, |
| 257 | pub fflags: c_uint, |
| 258 | pub data: i64, |
| 259 | pub udata: *mut c_void, |
| 260 | } |
| 261 | |
| 262 | pub struct stat { |
| 263 | pub st_mode: crate::mode_t, |
| 264 | pub st_dev: crate::dev_t, |
| 265 | pub st_ino: crate::ino_t, |
| 266 | pub st_nlink: crate::nlink_t, |
| 267 | pub st_uid: crate::uid_t, |
| 268 | pub st_gid: crate::gid_t, |
| 269 | pub st_rdev: crate::dev_t, |
| 270 | pub st_atime: crate::time_t, |
| 271 | pub st_atime_nsec: c_long, |
| 272 | pub st_mtime: crate::time_t, |
| 273 | pub st_mtime_nsec: c_long, |
| 274 | pub st_ctime: crate::time_t, |
| 275 | pub st_ctime_nsec: c_long, |
| 276 | pub st_size: off_t, |
| 277 | pub st_blocks: crate::blkcnt_t, |
| 278 | pub st_blksize: crate::blksize_t, |
| 279 | pub st_flags: u32, |
| 280 | pub st_gen: u32, |
| 281 | pub st_birthtime: crate::time_t, |
| 282 | pub st_birthtime_nsec: c_long, |
| 283 | } |
| 284 | |
| 285 | pub struct statvfs { |
| 286 | pub f_bsize: c_ulong, |
| 287 | pub f_frsize: c_ulong, |
| 288 | pub f_blocks: crate::fsblkcnt_t, |
| 289 | pub f_bfree: crate::fsblkcnt_t, |
| 290 | pub f_bavail: crate::fsblkcnt_t, |
| 291 | pub f_files: crate::fsfilcnt_t, |
| 292 | pub f_ffree: crate::fsfilcnt_t, |
| 293 | pub f_favail: crate::fsfilcnt_t, |
| 294 | pub f_fsid: c_ulong, |
| 295 | pub f_flag: c_ulong, |
| 296 | pub f_namemax: c_ulong, |
| 297 | } |
| 298 | |
| 299 | pub struct addrinfo { |
| 300 | pub ai_flags: c_int, |
| 301 | pub ai_family: c_int, |
| 302 | pub ai_socktype: c_int, |
| 303 | pub ai_protocol: c_int, |
| 304 | pub ai_addrlen: crate::socklen_t, |
| 305 | pub ai_addr: *mut crate::sockaddr, |
| 306 | pub ai_canonname: *mut c_char, |
| 307 | pub ai_next: *mut crate::addrinfo, |
| 308 | } |
| 309 | |
| 310 | pub struct Dl_info { |
| 311 | pub dli_fname: *const c_char, |
| 312 | pub dli_fbase: *mut c_void, |
| 313 | pub dli_sname: *const c_char, |
| 314 | pub dli_saddr: *mut c_void, |
| 315 | } |
| 316 | |
| 317 | pub struct if_data { |
| 318 | pub ifi_type: c_uchar, |
| 319 | pub ifi_addrlen: c_uchar, |
| 320 | pub ifi_hdrlen: c_uchar, |
| 321 | pub ifi_link_state: c_uchar, |
| 322 | pub ifi_mtu: u32, |
| 323 | pub ifi_metric: u32, |
| 324 | pub ifi_rdomain: u32, |
| 325 | pub ifi_baudrate: u64, |
| 326 | pub ifi_ipackets: u64, |
| 327 | pub ifi_ierrors: u64, |
| 328 | pub ifi_opackets: u64, |
| 329 | pub ifi_oerrors: u64, |
| 330 | pub ifi_collisions: u64, |
| 331 | pub ifi_ibytes: u64, |
| 332 | pub ifi_obytes: u64, |
| 333 | pub ifi_imcasts: u64, |
| 334 | pub ifi_omcasts: u64, |
| 335 | pub ifi_iqdrops: u64, |
| 336 | pub ifi_oqdrops: u64, |
| 337 | pub ifi_noproto: u64, |
| 338 | pub ifi_capabilities: u32, |
| 339 | pub ifi_lastchange: crate::timeval, |
| 340 | } |
| 341 | |
| 342 | pub struct if_msghdr { |
| 343 | pub ifm_msglen: c_ushort, |
| 344 | pub ifm_version: c_uchar, |
| 345 | pub ifm_type: c_uchar, |
| 346 | pub ifm_hdrlen: c_ushort, |
| 347 | pub ifm_index: c_ushort, |
| 348 | pub ifm_tableid: c_ushort, |
| 349 | pub ifm_pad1: c_uchar, |
| 350 | pub ifm_pad2: c_uchar, |
| 351 | pub ifm_addrs: c_int, |
| 352 | pub ifm_flags: c_int, |
| 353 | pub ifm_xflags: c_int, |
| 354 | pub ifm_data: if_data, |
| 355 | } |
| 356 | |
| 357 | pub struct sockaddr_dl { |
| 358 | pub sdl_len: c_uchar, |
| 359 | pub sdl_family: c_uchar, |
| 360 | pub sdl_index: c_ushort, |
| 361 | pub sdl_type: c_uchar, |
| 362 | pub sdl_nlen: c_uchar, |
| 363 | pub sdl_alen: c_uchar, |
| 364 | pub sdl_slen: c_uchar, |
| 365 | pub sdl_data: [c_char; 24], |
| 366 | } |
| 367 | |
| 368 | pub struct sockpeercred { |
| 369 | pub uid: crate::uid_t, |
| 370 | pub gid: crate::gid_t, |
| 371 | pub pid: crate::pid_t, |
| 372 | } |
| 373 | |
| 374 | pub struct arphdr { |
| 375 | pub ar_hrd: u16, |
| 376 | pub ar_pro: u16, |
| 377 | pub ar_hln: u8, |
| 378 | pub ar_pln: u8, |
| 379 | pub ar_op: u16, |
| 380 | } |
| 381 | |
| 382 | pub struct shmid_ds { |
| 383 | pub shm_perm: crate::ipc_perm, |
| 384 | pub shm_segsz: c_int, |
| 385 | pub shm_lpid: crate::pid_t, |
| 386 | pub shm_cpid: crate::pid_t, |
| 387 | pub shm_nattch: c_short, |
| 388 | pub shm_atime: crate::time_t, |
| 389 | __shm_atimensec: c_long, |
| 390 | pub shm_dtime: crate::time_t, |
| 391 | __shm_dtimensec: c_long, |
| 392 | pub shm_ctime: crate::time_t, |
| 393 | __shm_ctimensec: c_long, |
| 394 | pub shm_internal: *mut c_void, |
| 395 | } |
| 396 | |
| 397 | // elf.h |
| 398 | pub struct Elf32_Phdr { |
| 399 | pub p_type: Elf32_Word, |
| 400 | pub p_offset: Elf32_Off, |
| 401 | pub p_vaddr: Elf32_Addr, |
| 402 | pub p_paddr: Elf32_Addr, |
| 403 | pub p_filesz: Elf32_Word, |
| 404 | pub p_memsz: Elf32_Word, |
| 405 | pub p_flags: Elf32_Word, |
| 406 | pub p_align: Elf32_Word, |
| 407 | } |
| 408 | |
| 409 | pub struct Elf64_Phdr { |
| 410 | pub p_type: Elf64_Word, |
| 411 | pub p_flags: Elf64_Word, |
| 412 | pub p_offset: Elf64_Off, |
| 413 | pub p_vaddr: Elf64_Addr, |
| 414 | pub p_paddr: Elf64_Addr, |
| 415 | pub p_filesz: Elf64_Xword, |
| 416 | pub p_memsz: Elf64_Xword, |
| 417 | pub p_align: Elf64_Xword, |
| 418 | } |
| 419 | |
| 420 | // link.h |
| 421 | |
| 422 | pub struct dl_phdr_info { |
| 423 | pub dlpi_addr: Elf_Addr, |
| 424 | pub dlpi_name: *const c_char, |
| 425 | pub dlpi_phdr: *const Elf_Phdr, |
| 426 | pub dlpi_phnum: Elf_Half, |
| 427 | } |
| 428 | |
| 429 | // sys/sysctl.h |
| 430 | pub struct kinfo_proc { |
| 431 | pub p_forw: u64, |
| 432 | pub p_back: u64, |
| 433 | pub p_paddr: u64, |
| 434 | pub p_addr: u64, |
| 435 | pub p_fd: u64, |
| 436 | pub p_stats: u64, |
| 437 | pub p_limit: u64, |
| 438 | pub p_vmspace: u64, |
| 439 | pub p_sigacts: u64, |
| 440 | pub p_sess: u64, |
| 441 | pub p_tsess: u64, |
| 442 | pub p_ru: u64, |
| 443 | pub p_eflag: i32, |
| 444 | pub p_exitsig: i32, |
| 445 | pub p_flag: i32, |
| 446 | pub p_pid: i32, |
| 447 | pub p_ppid: i32, |
| 448 | pub p_sid: i32, |
| 449 | pub p__pgid: i32, |
| 450 | pub p_tpgid: i32, |
| 451 | pub p_uid: u32, |
| 452 | pub p_ruid: u32, |
| 453 | pub p_gid: u32, |
| 454 | pub p_rgid: u32, |
| 455 | pub p_groups: [u32; KI_NGROUPS as usize], |
| 456 | pub p_ngroups: i16, |
| 457 | pub p_jobc: i16, |
| 458 | pub p_tdev: u32, |
| 459 | pub p_estcpu: u32, |
| 460 | pub p_rtime_sec: u32, |
| 461 | pub p_rtime_usec: u32, |
| 462 | pub p_cpticks: i32, |
| 463 | pub p_pctcpu: u32, |
| 464 | pub p_swtime: u32, |
| 465 | pub p_slptime: u32, |
| 466 | pub p_schedflags: i32, |
| 467 | pub p_uticks: u64, |
| 468 | pub p_sticks: u64, |
| 469 | pub p_iticks: u64, |
| 470 | pub p_tracep: u64, |
| 471 | pub p_traceflag: i32, |
| 472 | pub p_holdcnt: i32, |
| 473 | pub p_siglist: i32, |
| 474 | pub p_sigmask: u32, |
| 475 | pub p_sigignore: u32, |
| 476 | pub p_sigcatch: u32, |
| 477 | pub p_stat: i8, |
| 478 | pub p_priority: u8, |
| 479 | pub p_usrpri: u8, |
| 480 | pub p_nice: u8, |
| 481 | pub p_xstat: u16, |
| 482 | pub p_spare: u16, |
| 483 | pub p_comm: [c_char; KI_MAXCOMLEN as usize], |
| 484 | pub p_wmesg: [c_char; KI_WMESGLEN as usize], |
| 485 | pub p_wchan: u64, |
| 486 | pub p_login: [c_char; KI_MAXLOGNAME as usize], |
| 487 | pub p_vm_rssize: i32, |
| 488 | pub p_vm_tsize: i32, |
| 489 | pub p_vm_dsize: i32, |
| 490 | pub p_vm_ssize: i32, |
| 491 | pub p_uvalid: i64, |
| 492 | pub p_ustart_sec: u64, |
| 493 | pub p_ustart_usec: u32, |
| 494 | pub p_uutime_sec: u32, |
| 495 | pub p_uutime_usec: u32, |
| 496 | pub p_ustime_sec: u32, |
| 497 | pub p_ustime_usec: u32, |
| 498 | pub p_uru_maxrss: u64, |
| 499 | pub p_uru_ixrss: u64, |
| 500 | pub p_uru_idrss: u64, |
| 501 | pub p_uru_isrss: u64, |
| 502 | pub p_uru_minflt: u64, |
| 503 | pub p_uru_majflt: u64, |
| 504 | pub p_uru_nswap: u64, |
| 505 | pub p_uru_inblock: u64, |
| 506 | pub p_uru_oublock: u64, |
| 507 | pub p_uru_msgsnd: u64, |
| 508 | pub p_uru_msgrcv: u64, |
| 509 | pub p_uru_nsignals: u64, |
| 510 | pub p_uru_nvcsw: u64, |
| 511 | pub p_uru_nivcsw: u64, |
| 512 | pub p_uctime_sec: u32, |
| 513 | pub p_uctime_usec: u32, |
| 514 | pub p_psflags: u32, |
| 515 | pub p_acflag: u32, |
| 516 | pub p_svuid: u32, |
| 517 | pub p_svgid: u32, |
| 518 | pub p_emul: [c_char; KI_EMULNAMELEN as usize], |
| 519 | pub p_rlim_rss_cur: u64, |
| 520 | pub p_cpuid: u64, |
| 521 | pub p_vm_map_size: u64, |
| 522 | pub p_tid: i32, |
| 523 | pub p_rtableid: u32, |
| 524 | pub p_pledge: u64, |
| 525 | pub p_name: [c_char; KI_MAXCOMLEN as usize], |
| 526 | } |
| 527 | |
| 528 | pub struct kinfo_file { |
| 529 | pub f_fileaddr: u64, |
| 530 | pub f_flag: u32, |
| 531 | pub f_iflags: u32, |
| 532 | pub f_type: u32, |
| 533 | pub f_count: u32, |
| 534 | pub f_msgcount: u32, |
| 535 | pub f_usecount: u32, |
| 536 | pub f_ucred: u64, |
| 537 | pub f_uid: u32, |
| 538 | pub f_gid: u32, |
| 539 | pub f_ops: u64, |
| 540 | pub f_offset: u64, |
| 541 | pub f_data: u64, |
| 542 | pub f_rxfer: u64, |
| 543 | pub f_rwfer: u64, |
| 544 | pub f_seek: u64, |
| 545 | pub f_rbytes: u64, |
| 546 | pub f_wbytes: u64, |
| 547 | pub v_un: u64, |
| 548 | pub v_type: u32, |
| 549 | pub v_tag: u32, |
| 550 | pub v_flag: u32, |
| 551 | pub va_rdev: u32, |
| 552 | pub v_data: u64, |
| 553 | pub v_mount: u64, |
| 554 | pub va_fileid: u64, |
| 555 | pub va_size: u64, |
| 556 | pub va_mode: u32, |
| 557 | pub va_fsid: u32, |
| 558 | pub f_mntonname: [c_char; KI_MNAMELEN as usize], |
| 559 | pub so_type: u32, |
| 560 | pub so_state: u32, |
| 561 | pub so_pcb: u64, |
| 562 | pub so_protocol: u32, |
| 563 | pub so_family: u32, |
| 564 | pub inp_ppcb: u64, |
| 565 | pub inp_lport: u32, |
| 566 | pub inp_laddru: [u32; 4], |
| 567 | pub inp_fport: u32, |
| 568 | pub inp_faddru: [u32; 4], |
| 569 | pub unp_conn: u64, |
| 570 | pub pipe_peer: u64, |
| 571 | pub pipe_state: u32, |
| 572 | pub kq_count: u32, |
| 573 | pub kq_state: u32, |
| 574 | __unused1: Padding<u32>, |
| 575 | pub p_pid: u32, |
| 576 | pub fd_fd: i32, |
| 577 | pub fd_ofileflags: u32, |
| 578 | pub p_uid: u32, |
| 579 | pub p_gid: u32, |
| 580 | pub p_tid: u32, |
| 581 | pub p_comm: [c_char; KI_MAXCOMLEN as usize], |
| 582 | pub inp_rtableid: u32, |
| 583 | pub so_splice: u64, |
| 584 | pub so_splicelen: i64, |
| 585 | pub so_rcv_cc: u64, |
| 586 | pub so_snd_cc: u64, |
| 587 | pub unp_refs: u64, |
| 588 | pub unp_nextref: u64, |
| 589 | pub unp_addr: u64, |
| 590 | pub unp_path: [c_char; KI_UNPPATHLEN as usize], |
| 591 | pub inp_proto: u32, |
| 592 | pub t_state: u32, |
| 593 | pub t_rcv_wnd: u64, |
| 594 | pub t_snd_wnd: u64, |
| 595 | pub t_snd_cwnd: u64, |
| 596 | pub va_nlink: u32, |
| 597 | } |
| 598 | |
| 599 | pub struct kinfo_vmentry { |
| 600 | pub kve_start: c_ulong, |
| 601 | pub kve_end: c_ulong, |
| 602 | pub kve_guard: c_ulong, |
| 603 | pub kve_fspace: c_ulong, |
| 604 | pub kve_fspace_augment: c_ulong, |
| 605 | pub kve_offset: u64, |
| 606 | pub kve_wired_count: c_int, |
| 607 | pub kve_etype: c_int, |
| 608 | pub kve_protection: c_int, |
| 609 | pub kve_max_protection: c_int, |
| 610 | pub kve_advice: c_int, |
| 611 | pub kve_inheritance: c_int, |
| 612 | pub kve_flags: u8, |
| 613 | } |
| 614 | |
| 615 | pub struct ptrace_state { |
| 616 | pub pe_report_event: c_int, |
| 617 | pub pe_other_pid: crate::pid_t, |
| 618 | pub pe_tid: crate::pid_t, |
| 619 | } |
| 620 | |
| 621 | pub struct ptrace_thread_state { |
| 622 | pub pts_tid: crate::pid_t, |
| 623 | pub pts_name: [c_char; PT_PTS_NAMELEN as usize], |
| 624 | } |
| 625 | |
| 626 | // search.h |
| 627 | pub struct entry { |
| 628 | pub key: *mut c_char, |
| 629 | pub data: *mut c_void, |
| 630 | } |
| 631 | |
| 632 | pub struct ifreq { |
| 633 | pub ifr_name: [c_char; crate::IFNAMSIZ], |
| 634 | pub ifr_ifru: __c_anonymous_ifr_ifru, |
| 635 | } |
| 636 | |
| 637 | pub struct tcp_info { |
| 638 | pub tcpi_state: u8, |
| 639 | pub __tcpi_ca_state: u8, |
| 640 | pub __tcpi_retransmits: u8, |
| 641 | pub __tcpi_probes: u8, |
| 642 | pub __tcpi_backoff: u8, |
| 643 | pub tcpi_options: u8, |
| 644 | pub tcpi_snd_wscale: u8, |
| 645 | pub tcpi_rcv_wscale: u8, |
| 646 | pub tcpi_rto: u32, |
| 647 | pub __tcpi_ato: u32, |
| 648 | pub tcpi_snd_mss: u32, |
| 649 | pub tcpi_rcv_mss: u32, |
| 650 | pub __tcpi_unacked: u32, |
| 651 | pub __tcpi_sacked: u32, |
| 652 | pub __tcpi_lost: u32, |
| 653 | pub __tcpi_retrans: u32, |
| 654 | pub __tcpi_fackets: u32, |
| 655 | pub tcpi_last_data_sent: u32, |
| 656 | pub tcpi_last_ack_sent: u32, |
| 657 | pub tcpi_last_data_recv: u32, |
| 658 | pub tcpi_last_ack_recv: u32, |
| 659 | pub __tcpi_pmtu: u32, |
| 660 | pub __tcpi_rcv_ssthresh: u32, |
| 661 | pub tcpi_rtt: u32, |
| 662 | pub tcpi_rttvar: u32, |
| 663 | pub tcpi_snd_ssthresh: u32, |
| 664 | pub tcpi_snd_cwnd: u32, |
| 665 | pub __tcpi_advmss: u32, |
| 666 | pub __tcpi_reordering: u32, |
| 667 | pub __tcpi_rcv_rtt: u32, |
| 668 | pub tcpi_rcv_space: u32, |
| 669 | pub tcpi_snd_wnd: u32, |
| 670 | pub tcpi_snd_nxt: u32, |
| 671 | pub tcpi_rcv_nxt: u32, |
| 672 | pub tcpi_toe_tid: u32, |
| 673 | pub tcpi_snd_rexmitpack: u32, |
| 674 | pub tcpi_rcv_ooopack: u32, |
| 675 | pub tcpi_snd_zerowin: u32, |
| 676 | pub tcpi_rttmin: u32, |
| 677 | pub tcpi_max_sndwnd: u32, |
| 678 | pub tcpi_rcv_adv: u32, |
| 679 | pub tcpi_rcv_up: u32, |
| 680 | pub tcpi_snd_una: u32, |
| 681 | pub tcpi_snd_up: u32, |
| 682 | pub tcpi_snd_wl1: u32, |
| 683 | pub tcpi_snd_wl2: u32, |
| 684 | pub tcpi_snd_max: u32, |
| 685 | pub tcpi_ts_recent: u32, |
| 686 | pub tcpi_ts_recent_age: u32, |
| 687 | pub tcpi_rfbuf_cnt: u32, |
| 688 | pub tcpi_rfbuf_ts: u32, |
| 689 | pub tcpi_so_rcv_sb_cc: u32, |
| 690 | pub tcpi_so_rcv_sb_hiwat: u32, |
| 691 | pub tcpi_so_rcv_sb_lowat: u32, |
| 692 | pub tcpi_so_rcv_sb_wat: u32, |
| 693 | pub tcpi_so_snd_sb_cc: u32, |
| 694 | pub tcpi_so_snd_sb_hiwat: u32, |
| 695 | pub tcpi_so_snd_sb_lowat: u32, |
| 696 | pub tcpi_so_snd_sb_wat: u32, |
| 697 | } |
| 698 | |
| 699 | pub struct dirent { |
| 700 | pub d_fileno: crate::ino_t, |
| 701 | pub d_off: off_t, |
| 702 | pub d_reclen: u16, |
| 703 | pub d_type: u8, |
| 704 | pub d_namlen: u8, |
| 705 | __d_padding: Padding<[u8; 4]>, |
| 706 | pub d_name: [c_char; 256], |
| 707 | } |
| 708 | |
| 709 | pub struct sockaddr_storage { |
| 710 | pub ss_len: u8, |
| 711 | pub ss_family: crate::sa_family_t, |
| 712 | __ss_pad1: Padding<[u8; 6]>, |
| 713 | __ss_pad2: Padding<i64>, |
| 714 | __ss_pad3: Padding<[u8; 240]>, |
| 715 | } |
| 716 | |
| 717 | pub struct siginfo_t { |
| 718 | pub si_signo: c_int, |
| 719 | pub si_code: c_int, |
| 720 | pub si_errno: c_int, |
| 721 | pub si_addr: *mut c_char, |
| 722 | #[cfg(target_pointer_width = "32")] |
| 723 | __pad: Padding<[u8; 112]>, |
| 724 | #[cfg(target_pointer_width = "64")] |
| 725 | __pad: Padding<[u8; 108]>, |
| 726 | } |
| 727 | |
| 728 | pub struct lastlog { |
| 729 | ll_time: crate::time_t, |
| 730 | ll_line: [c_char; UT_LINESIZE], |
| 731 | ll_host: [c_char; UT_HOSTSIZE], |
| 732 | } |
| 733 | |
| 734 | pub struct utmp { |
| 735 | pub ut_line: [c_char; UT_LINESIZE], |
| 736 | pub ut_name: [c_char; UT_NAMESIZE], |
| 737 | pub ut_host: [c_char; UT_HOSTSIZE], |
| 738 | pub ut_time: crate::time_t, |
| 739 | } |
| 740 | |
| 741 | pub struct statfs { |
| 742 | pub f_flags: u32, |
| 743 | pub f_bsize: u32, |
| 744 | pub f_iosize: u32, |
| 745 | pub f_blocks: u64, |
| 746 | pub f_bfree: u64, |
| 747 | pub f_bavail: i64, |
| 748 | pub f_files: u64, |
| 749 | pub f_ffree: u64, |
| 750 | pub f_favail: i64, |
| 751 | pub f_syncwrites: u64, |
| 752 | pub f_syncreads: u64, |
| 753 | pub f_asyncwrites: u64, |
| 754 | pub f_asyncreads: u64, |
| 755 | pub f_fsid: crate::fsid_t, |
| 756 | pub f_namemax: u32, |
| 757 | pub f_owner: crate::uid_t, |
| 758 | pub f_ctime: u64, |
| 759 | pub f_fstypename: [c_char; 16], |
| 760 | pub f_mntonname: [c_char; 90], |
| 761 | pub f_mntfromname: [c_char; 90], |
| 762 | pub f_mntfromspec: [c_char; 90], |
| 763 | pub mount_info: mount_info, |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | s_no_extra_traits! { |
| 768 | pub union mount_info { |
| 769 | pub ufs_args: ufs_args, |
| 770 | pub mfs_args: mfs_args, |
| 771 | pub nfs_args: nfs_args, |
| 772 | pub iso_args: iso_args, |
| 773 | pub msdosfs_args: msdosfs_args, |
| 774 | pub ntfs_args: ntfs_args, |
| 775 | pub tmpfs_args: tmpfs_args, |
| 776 | align: [c_char; 160], |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | cfg_if! { |
| 781 | if #[cfg(feature = "extra_traits")] { |
| 782 | impl PartialEq for mount_info { |
| 783 | fn eq(&self, other: &mount_info) -> bool { |
| 784 | unsafe { |
| 785 | self.align |
| 786 | .iter() |
| 787 | .zip(other.align.iter()) |
| 788 | .all(|(a, b)| a == b) |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | impl Eq for mount_info {} |
| 794 | |
| 795 | impl hash::Hash for mount_info { |
| 796 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 797 | unsafe { self.align.hash(state) }; |
| 798 | } |
| 799 | } |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | impl siginfo_t { |
| 804 | pub unsafe fn si_addr(&self) -> *mut c_char { |
| 805 | self.si_addr |
| 806 | } |
| 807 | |
| 808 | pub unsafe fn si_code(&self) -> c_int { |
| 809 | self.si_code |
| 810 | } |
| 811 | |
| 812 | pub unsafe fn si_errno(&self) -> c_int { |
| 813 | self.si_errno |
| 814 | } |
| 815 | |
| 816 | pub unsafe fn si_pid(&self) -> crate::pid_t { |
| 817 | #[repr(C)] |
| 818 | struct siginfo_timer { |
| 819 | _si_signo: c_int, |
| 820 | _si_code: c_int, |
| 821 | _si_errno: c_int, |
| 822 | _pad: Padding<[c_int; SI_PAD]>, |
| 823 | _pid: crate::pid_t, |
| 824 | } |
| 825 | (*(self as *const siginfo_t).cast::<siginfo_timer>())._pid |
| 826 | } |
| 827 | |
| 828 | pub unsafe fn si_uid(&self) -> crate::uid_t { |
| 829 | #[repr(C)] |
| 830 | struct siginfo_timer { |
| 831 | _si_signo: c_int, |
| 832 | _si_code: c_int, |
| 833 | _si_errno: c_int, |
| 834 | _pad: Padding<[c_int; SI_PAD]>, |
| 835 | _pid: crate::pid_t, |
| 836 | _uid: crate::uid_t, |
| 837 | } |
| 838 | (*(self as *const siginfo_t).cast::<siginfo_timer>())._uid |
| 839 | } |
| 840 | |
| 841 | pub unsafe fn si_value(&self) -> crate::sigval { |
| 842 | #[repr(C)] |
| 843 | struct siginfo_timer { |
| 844 | _si_signo: c_int, |
| 845 | _si_code: c_int, |
| 846 | _si_errno: c_int, |
| 847 | _pad: Padding<[c_int; SI_PAD]>, |
| 848 | _pid: crate::pid_t, |
| 849 | _uid: crate::uid_t, |
| 850 | value: crate::sigval, |
| 851 | } |
| 852 | (*(self as *const siginfo_t).cast::<siginfo_timer>()).value |
| 853 | } |
| 854 | |
| 855 | pub unsafe fn si_status(&self) -> c_int { |
| 856 | #[repr(C)] |
| 857 | struct siginfo_proc { |
| 858 | _si_signo: c_int, |
| 859 | _si_code: c_int, |
| 860 | _si_errno: c_int, |
| 861 | _pad: Padding<[c_int; SI_PAD]>, |
| 862 | _pid: crate::pid_t, |
| 863 | _uid: crate::uid_t, |
| 864 | _utime: crate::clock_t, |
| 865 | _stime: crate::clock_t, |
| 866 | _status: crate::c_int, |
| 867 | } |
| 868 | (*(self as *const siginfo_t).cast::<siginfo_proc>())._status |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | s_no_extra_traits! { |
| 873 | pub union __c_anonymous_ifr_ifru { |
| 874 | pub ifru_addr: crate::sockaddr, |
| 875 | pub ifru_dstaddr: crate::sockaddr, |
| 876 | pub ifru_broadaddr: crate::sockaddr, |
| 877 | pub ifru_flags: c_short, |
| 878 | pub ifru_metric: c_int, |
| 879 | pub ifru_vnetid: i64, |
| 880 | pub ifru_media: u64, |
| 881 | pub ifru_data: crate::caddr_t, |
| 882 | pub ifru_index: c_uint, |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | cfg_if! { |
| 887 | if #[cfg(feature = "extra_traits")] { |
| 888 | impl PartialEq for __c_anonymous_ifr_ifru { |
| 889 | fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { |
| 890 | unsafe { |
| 891 | self.ifru_addr == other.ifru_addr |
| 892 | && self.ifru_dstaddr == other.ifru_dstaddr |
| 893 | && self.ifru_broadaddr == other.ifru_broadaddr |
| 894 | && self.ifru_flags == other.ifru_flags |
| 895 | && self.ifru_metric == other.ifru_metric |
| 896 | && self.ifru_vnetid == other.ifru_vnetid |
| 897 | && self.ifru_media == other.ifru_media |
| 898 | && self.ifru_data == other.ifru_data |
| 899 | && self.ifru_index == other.ifru_index |
| 900 | } |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | impl Eq for __c_anonymous_ifr_ifru {} |
| 905 | |
| 906 | impl hash::Hash for __c_anonymous_ifr_ifru { |
| 907 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 908 | unsafe { |
| 909 | self.ifru_addr.hash(state); |
| 910 | self.ifru_dstaddr.hash(state); |
| 911 | self.ifru_broadaddr.hash(state); |
| 912 | self.ifru_flags.hash(state); |
| 913 | self.ifru_metric.hash(state); |
| 914 | self.ifru_vnetid.hash(state); |
| 915 | self.ifru_media.hash(state); |
| 916 | self.ifru_data.hash(state); |
| 917 | self.ifru_index.hash(state); |
| 918 | } |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | pub const UT_NAMESIZE: usize = 32; |
| 925 | pub const UT_LINESIZE: usize = 8; |
| 926 | pub const UT_HOSTSIZE: usize = 256; |
| 927 | |
| 928 | pub const O_CLOEXEC: c_int = 0x10000; |
| 929 | pub const O_DIRECTORY: c_int = 0x20000; |
| 930 | pub const O_RSYNC: c_int = O_SYNC; |
| 931 | |
| 932 | pub const MS_SYNC: c_int = 0x0002; |
| 933 | pub const MS_INVALIDATE: c_int = 0x0004; |
| 934 | |
| 935 | pub const POLLNORM: c_short = crate::POLLRDNORM; |
| 936 | |
| 937 | pub const ENOATTR: c_int = 83; |
| 938 | pub const EILSEQ: c_int = 84; |
| 939 | pub const EOVERFLOW: c_int = 87; |
| 940 | pub const ECANCELED: c_int = 88; |
| 941 | pub const EIDRM: c_int = 89; |
| 942 | pub const ENOMSG: c_int = 90; |
| 943 | pub const ENOTSUP: c_int = 91; |
| 944 | pub const EBADMSG: c_int = 92; |
| 945 | pub const ENOTRECOVERABLE: c_int = 93; |
| 946 | pub const EOWNERDEAD: c_int = 94; |
| 947 | pub const EPROTO: c_int = 95; |
| 948 | |
| 949 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 950 | /// for details. |
| 951 | pub const ELAST: c_int = 95; |
| 952 | |
| 953 | pub const F_DUPFD_CLOEXEC: c_int = 10; |
| 954 | |
| 955 | pub const UTIME_OMIT: c_long = -1; |
| 956 | pub const UTIME_NOW: c_long = -2; |
| 957 | |
| 958 | pub const AT_FDCWD: c_int = -100; |
| 959 | pub const AT_EACCESS: c_int = 0x01; |
| 960 | pub const AT_SYMLINK_NOFOLLOW: c_int = 0x02; |
| 961 | pub const AT_SYMLINK_FOLLOW: c_int = 0x04; |
| 962 | pub const AT_REMOVEDIR: c_int = 0x08; |
| 963 | |
| 964 | pub const AT_NULL: c_int = 0; |
| 965 | pub const AT_IGNORE: c_int = 1; |
| 966 | pub const AT_PAGESZ: c_int = 6; |
| 967 | pub const AT_HWCAP: c_int = 25; |
| 968 | pub const AT_HWCAP2: c_int = 26; |
| 969 | |
| 970 | #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 971 | pub const RLIM_NLIMITS: c_int = 9; |
| 972 | |
| 973 | pub const SO_TIMESTAMP: c_int = 0x0800; |
| 974 | pub const SO_SNDTIMEO: c_int = 0x1005; |
| 975 | pub const SO_RCVTIMEO: c_int = 0x1006; |
| 976 | pub const SO_BINDANY: c_int = 0x1000; |
| 977 | pub const SO_NETPROC: c_int = 0x1020; |
| 978 | pub const SO_RTABLE: c_int = 0x1021; |
| 979 | pub const SO_PEERCRED: c_int = 0x1022; |
| 980 | pub const SO_SPLICE: c_int = 0x1023; |
| 981 | pub const SO_DOMAIN: c_int = 0x1024; |
| 982 | pub const SO_PROTOCOL: c_int = 0x1025; |
| 983 | |
| 984 | // sys/netinet/in.h |
| 985 | // Protocols (RFC 1700) |
| 986 | // NOTE: These are in addition to the constants defined in src/unix/mod.rs |
| 987 | |
| 988 | // IPPROTO_IP defined in src/unix/mod.rs |
| 989 | /// Hop-by-hop option header |
| 990 | pub const IPPROTO_HOPOPTS: c_int = 0; |
| 991 | // IPPROTO_ICMP defined in src/unix/mod.rs |
| 992 | /// group mgmt protocol |
| 993 | pub const IPPROTO_IGMP: c_int = 2; |
| 994 | /// gateway^2 (deprecated) |
| 995 | pub const IPPROTO_GGP: c_int = 3; |
| 996 | /// for compatibility |
| 997 | pub const IPPROTO_IPIP: c_int = 4; |
| 998 | // IPPROTO_TCP defined in src/unix/mod.rs |
| 999 | /// exterior gateway protocol |
| 1000 | pub const IPPROTO_EGP: c_int = 8; |
| 1001 | /// pup |
| 1002 | pub const IPPROTO_PUP: c_int = 12; |
| 1003 | // IPPROTO_UDP defined in src/unix/mod.rs |
| 1004 | /// xns idp |
| 1005 | pub const IPPROTO_IDP: c_int = 22; |
| 1006 | /// tp-4 w/ class negotiation |
| 1007 | pub const IPPROTO_TP: c_int = 29; |
| 1008 | // IPPROTO_IPV6 defined in src/unix/mod.rs |
| 1009 | /// IP6 routing header |
| 1010 | pub const IPPROTO_ROUTING: c_int = 43; |
| 1011 | /// IP6 fragmentation header |
| 1012 | pub const IPPROTO_FRAGMENT: c_int = 44; |
| 1013 | /// resource reservation |
| 1014 | pub const IPPROTO_RSVP: c_int = 46; |
| 1015 | /// General Routing Encap. |
| 1016 | pub const IPPROTO_GRE: c_int = 47; |
| 1017 | /// IP6 Encap Sec. Payload |
| 1018 | pub const IPPROTO_ESP: c_int = 50; |
| 1019 | /// IP6 Auth Header |
| 1020 | pub const IPPROTO_AH: c_int = 51; |
| 1021 | /// IP Mobility RFC 2004 |
| 1022 | pub const IPPROTO_MOBILE: c_int = 55; |
| 1023 | // IPPROTO_ICMPV6 defined in src/unix/mod.rs |
| 1024 | /// IP6 no next header |
| 1025 | pub const IPPROTO_NONE: c_int = 59; |
| 1026 | /// IP6 destination option |
| 1027 | pub const IPPROTO_DSTOPTS: c_int = 60; |
| 1028 | /// ISO cnlp |
| 1029 | pub const IPPROTO_EON: c_int = 80; |
| 1030 | /// Ethernet-in-IP |
| 1031 | pub const IPPROTO_ETHERIP: c_int = 97; |
| 1032 | /// encapsulation header |
| 1033 | pub const IPPROTO_ENCAP: c_int = 98; |
| 1034 | /// Protocol indep. multicast |
| 1035 | pub const IPPROTO_PIM: c_int = 103; |
| 1036 | /// IP Payload Comp. Protocol |
| 1037 | pub const IPPROTO_IPCOMP: c_int = 108; |
| 1038 | /// CARP |
| 1039 | pub const IPPROTO_CARP: c_int = 112; |
| 1040 | /// unicast MPLS packet |
| 1041 | pub const IPPROTO_MPLS: c_int = 137; |
| 1042 | /// PFSYNC |
| 1043 | pub const IPPROTO_PFSYNC: c_int = 240; |
| 1044 | pub const IPPROTO_MAX: c_int = 256; |
| 1045 | |
| 1046 | // Only used internally, so it can be outside the range of valid IP protocols |
| 1047 | pub const IPPROTO_DIVERT: c_int = 258; |
| 1048 | |
| 1049 | pub const IP_RECVDSTADDR: c_int = 7; |
| 1050 | pub const IP_SENDSRCADDR: c_int = IP_RECVDSTADDR; |
| 1051 | pub const IP_RECVIF: c_int = 30; |
| 1052 | |
| 1053 | // sys/netinet/in.h |
| 1054 | pub const TCP_MD5SIG: c_int = 0x04; |
| 1055 | pub const TCP_NOPUSH: c_int = 0x10; |
| 1056 | |
| 1057 | pub const MSG_WAITFORONE: c_int = 0x1000; |
| 1058 | |
| 1059 | pub const AF_ECMA: c_int = 8; |
| 1060 | pub const AF_ROUTE: c_int = 17; |
| 1061 | pub const AF_ENCAP: c_int = 28; |
| 1062 | pub const AF_SIP: c_int = 29; |
| 1063 | pub const AF_KEY: c_int = 30; |
| 1064 | pub const pseudo_AF_HDRCMPLT: c_int = 31; |
| 1065 | pub const AF_BLUETOOTH: c_int = 32; |
| 1066 | pub const AF_MPLS: c_int = 33; |
| 1067 | pub const pseudo_AF_PFLOW: c_int = 34; |
| 1068 | pub const pseudo_AF_PIPEX: c_int = 35; |
| 1069 | pub const NET_RT_DUMP: c_int = 1; |
| 1070 | pub const NET_RT_FLAGS: c_int = 2; |
| 1071 | pub const NET_RT_IFLIST: c_int = 3; |
| 1072 | pub const NET_RT_STATS: c_int = 4; |
| 1073 | pub const NET_RT_TABLE: c_int = 5; |
| 1074 | pub const NET_RT_IFNAMES: c_int = 6; |
| 1075 | #[doc(hidden)] |
| 1076 | #[deprecated( |
| 1077 | since = "0.2.95", |
| 1078 | note = "Possibly increasing over the releases and might not be so used in the field" |
| 1079 | )] |
| 1080 | pub const NET_RT_MAXID: c_int = 7; |
| 1081 | |
| 1082 | pub const IPV6_JOIN_GROUP: c_int = 12; |
| 1083 | pub const IPV6_LEAVE_GROUP: c_int = 13; |
| 1084 | |
| 1085 | pub const PF_ROUTE: c_int = AF_ROUTE; |
| 1086 | pub const PF_ECMA: c_int = AF_ECMA; |
| 1087 | pub const PF_ENCAP: c_int = AF_ENCAP; |
| 1088 | pub const PF_SIP: c_int = AF_SIP; |
| 1089 | pub const PF_KEY: c_int = AF_KEY; |
| 1090 | pub const PF_BPF: c_int = pseudo_AF_HDRCMPLT; |
| 1091 | pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH; |
| 1092 | pub const PF_MPLS: c_int = AF_MPLS; |
| 1093 | pub const PF_PFLOW: c_int = pseudo_AF_PFLOW; |
| 1094 | pub const PF_PIPEX: c_int = pseudo_AF_PIPEX; |
| 1095 | |
| 1096 | pub const SCM_TIMESTAMP: c_int = 0x04; |
| 1097 | |
| 1098 | pub const O_DSYNC: c_int = 128; |
| 1099 | |
| 1100 | pub const MAP_RENAME: c_int = 0x0000; |
| 1101 | pub const MAP_NORESERVE: c_int = 0x0000; |
| 1102 | pub const MAP_HASSEMAPHORE: c_int = 0x0000; |
| 1103 | pub const MAP_TRYFIXED: c_int = 0; |
| 1104 | |
| 1105 | pub const EIPSEC: c_int = 82; |
| 1106 | pub const ENOMEDIUM: c_int = 85; |
| 1107 | pub const EMEDIUMTYPE: c_int = 86; |
| 1108 | |
| 1109 | pub const EAI_BADFLAGS: c_int = -1; |
| 1110 | pub const EAI_NONAME: c_int = -2; |
| 1111 | pub const EAI_AGAIN: c_int = -3; |
| 1112 | pub const EAI_FAIL: c_int = -4; |
| 1113 | pub const EAI_NODATA: c_int = -5; |
| 1114 | pub const EAI_FAMILY: c_int = -6; |
| 1115 | pub const EAI_SOCKTYPE: c_int = -7; |
| 1116 | pub const EAI_SERVICE: c_int = -8; |
| 1117 | pub const EAI_MEMORY: c_int = -10; |
| 1118 | pub const EAI_SYSTEM: c_int = -11; |
| 1119 | pub const EAI_OVERFLOW: c_int = -14; |
| 1120 | |
| 1121 | pub const RUSAGE_THREAD: c_int = 1; |
| 1122 | |
| 1123 | pub const MAP_COPY: c_int = 0x0002; |
| 1124 | pub const MAP_NOEXTEND: c_int = 0x0000; |
| 1125 | |
| 1126 | pub const _PC_LINK_MAX: c_int = 1; |
| 1127 | pub const _PC_MAX_CANON: c_int = 2; |
| 1128 | pub const _PC_MAX_INPUT: c_int = 3; |
| 1129 | pub const _PC_NAME_MAX: c_int = 4; |
| 1130 | pub const _PC_PATH_MAX: c_int = 5; |
| 1131 | pub const _PC_PIPE_BUF: c_int = 6; |
| 1132 | pub const _PC_CHOWN_RESTRICTED: c_int = 7; |
| 1133 | pub const _PC_NO_TRUNC: c_int = 8; |
| 1134 | pub const _PC_VDISABLE: c_int = 9; |
| 1135 | pub const _PC_2_SYMLINKS: c_int = 10; |
| 1136 | pub const _PC_ALLOC_SIZE_MIN: c_int = 11; |
| 1137 | pub const _PC_ASYNC_IO: c_int = 12; |
| 1138 | pub const _PC_FILESIZEBITS: c_int = 13; |
| 1139 | pub const _PC_PRIO_IO: c_int = 14; |
| 1140 | pub const _PC_REC_INCR_XFER_SIZE: c_int = 15; |
| 1141 | pub const _PC_REC_MAX_XFER_SIZE: c_int = 16; |
| 1142 | pub const _PC_REC_MIN_XFER_SIZE: c_int = 17; |
| 1143 | pub const _PC_REC_XFER_ALIGN: c_int = 18; |
| 1144 | pub const _PC_SYMLINK_MAX: c_int = 19; |
| 1145 | pub const _PC_SYNC_IO: c_int = 20; |
| 1146 | pub const _PC_TIMESTAMP_RESOLUTION: c_int = 21; |
| 1147 | |
| 1148 | pub const _CS_PATH: c_int = 1; |
| 1149 | |
| 1150 | pub const _SC_CLK_TCK: c_int = 3; |
| 1151 | pub const _SC_SEM_NSEMS_MAX: c_int = 31; |
| 1152 | pub const _SC_SEM_VALUE_MAX: c_int = 32; |
| 1153 | pub const _SC_HOST_NAME_MAX: c_int = 33; |
| 1154 | pub const _SC_MONOTONIC_CLOCK: c_int = 34; |
| 1155 | pub const _SC_2_PBS: c_int = 35; |
| 1156 | pub const _SC_2_PBS_ACCOUNTING: c_int = 36; |
| 1157 | pub const _SC_2_PBS_CHECKPOINT: c_int = 37; |
| 1158 | pub const _SC_2_PBS_LOCATE: c_int = 38; |
| 1159 | pub const _SC_2_PBS_MESSAGE: c_int = 39; |
| 1160 | pub const _SC_2_PBS_TRACK: c_int = 40; |
| 1161 | pub const _SC_ADVISORY_INFO: c_int = 41; |
| 1162 | pub const _SC_AIO_LISTIO_MAX: c_int = 42; |
| 1163 | pub const _SC_AIO_MAX: c_int = 43; |
| 1164 | pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44; |
| 1165 | pub const _SC_ASYNCHRONOUS_IO: c_int = 45; |
| 1166 | pub const _SC_ATEXIT_MAX: c_int = 46; |
| 1167 | pub const _SC_BARRIERS: c_int = 47; |
| 1168 | pub const _SC_CLOCK_SELECTION: c_int = 48; |
| 1169 | pub const _SC_CPUTIME: c_int = 49; |
| 1170 | pub const _SC_DELAYTIMER_MAX: c_int = 50; |
| 1171 | pub const _SC_IOV_MAX: c_int = 51; |
| 1172 | pub const _SC_IPV6: c_int = 52; |
| 1173 | pub const _SC_MAPPED_FILES: c_int = 53; |
| 1174 | pub const _SC_MEMLOCK: c_int = 54; |
| 1175 | pub const _SC_MEMLOCK_RANGE: c_int = 55; |
| 1176 | pub const _SC_MEMORY_PROTECTION: c_int = 56; |
| 1177 | pub const _SC_MESSAGE_PASSING: c_int = 57; |
| 1178 | pub const _SC_MQ_OPEN_MAX: c_int = 58; |
| 1179 | pub const _SC_MQ_PRIO_MAX: c_int = 59; |
| 1180 | pub const _SC_PRIORITIZED_IO: c_int = 60; |
| 1181 | pub const _SC_PRIORITY_SCHEDULING: c_int = 61; |
| 1182 | pub const _SC_RAW_SOCKETS: c_int = 62; |
| 1183 | pub const _SC_READER_WRITER_LOCKS: c_int = 63; |
| 1184 | pub const _SC_REALTIME_SIGNALS: c_int = 64; |
| 1185 | pub const _SC_REGEXP: c_int = 65; |
| 1186 | pub const _SC_RTSIG_MAX: c_int = 66; |
| 1187 | pub const _SC_SEMAPHORES: c_int = 67; |
| 1188 | pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 68; |
| 1189 | pub const _SC_SHELL: c_int = 69; |
| 1190 | pub const _SC_SIGQUEUE_MAX: c_int = 70; |
| 1191 | pub const _SC_SPAWN: c_int = 71; |
| 1192 | pub const _SC_SPIN_LOCKS: c_int = 72; |
| 1193 | pub const _SC_SPORADIC_SERVER: c_int = 73; |
| 1194 | pub const _SC_SS_REPL_MAX: c_int = 74; |
| 1195 | pub const _SC_SYNCHRONIZED_IO: c_int = 75; |
| 1196 | pub const _SC_SYMLOOP_MAX: c_int = 76; |
| 1197 | pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77; |
| 1198 | pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78; |
| 1199 | pub const _SC_THREAD_CPUTIME: c_int = 79; |
| 1200 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 80; |
| 1201 | pub const _SC_THREAD_KEYS_MAX: c_int = 81; |
| 1202 | pub const _SC_THREAD_PRIO_INHERIT: c_int = 82; |
| 1203 | pub const _SC_THREAD_PRIO_PROTECT: c_int = 83; |
| 1204 | pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 84; |
| 1205 | pub const _SC_THREAD_PROCESS_SHARED: c_int = 85; |
| 1206 | pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 86; |
| 1207 | pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 87; |
| 1208 | pub const _SC_THREAD_SPORADIC_SERVER: c_int = 88; |
| 1209 | pub const _SC_THREAD_STACK_MIN: c_int = 89; |
| 1210 | pub const _SC_THREAD_THREADS_MAX: c_int = 90; |
| 1211 | pub const _SC_THREADS: c_int = 91; |
| 1212 | pub const _SC_TIMEOUTS: c_int = 92; |
| 1213 | pub const _SC_TIMER_MAX: c_int = 93; |
| 1214 | pub const _SC_TIMERS: c_int = 94; |
| 1215 | pub const _SC_TRACE: c_int = 95; |
| 1216 | pub const _SC_TRACE_EVENT_FILTER: c_int = 96; |
| 1217 | pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 97; |
| 1218 | pub const _SC_TRACE_INHERIT: c_int = 98; |
| 1219 | pub const _SC_TRACE_LOG: c_int = 99; |
| 1220 | pub const _SC_GETGR_R_SIZE_MAX: c_int = 100; |
| 1221 | pub const _SC_GETPW_R_SIZE_MAX: c_int = 101; |
| 1222 | pub const _SC_LOGIN_NAME_MAX: c_int = 102; |
| 1223 | pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 103; |
| 1224 | pub const _SC_TRACE_NAME_MAX: c_int = 104; |
| 1225 | pub const _SC_TRACE_SYS_MAX: c_int = 105; |
| 1226 | pub const _SC_TRACE_USER_EVENT_MAX: c_int = 106; |
| 1227 | pub const _SC_TTY_NAME_MAX: c_int = 107; |
| 1228 | pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 108; |
| 1229 | pub const _SC_V6_ILP32_OFF32: c_int = 109; |
| 1230 | pub const _SC_V6_ILP32_OFFBIG: c_int = 110; |
| 1231 | pub const _SC_V6_LP64_OFF64: c_int = 111; |
| 1232 | pub const _SC_V6_LPBIG_OFFBIG: c_int = 112; |
| 1233 | pub const _SC_V7_ILP32_OFF32: c_int = 113; |
| 1234 | pub const _SC_V7_ILP32_OFFBIG: c_int = 114; |
| 1235 | pub const _SC_V7_LP64_OFF64: c_int = 115; |
| 1236 | pub const _SC_V7_LPBIG_OFFBIG: c_int = 116; |
| 1237 | pub const _SC_XOPEN_CRYPT: c_int = 117; |
| 1238 | pub const _SC_XOPEN_ENH_I18N: c_int = 118; |
| 1239 | pub const _SC_XOPEN_LEGACY: c_int = 119; |
| 1240 | pub const _SC_XOPEN_REALTIME: c_int = 120; |
| 1241 | pub const _SC_XOPEN_REALTIME_THREADS: c_int = 121; |
| 1242 | pub const _SC_XOPEN_STREAMS: c_int = 122; |
| 1243 | pub const _SC_XOPEN_UNIX: c_int = 123; |
| 1244 | pub const _SC_XOPEN_UUCP: c_int = 124; |
| 1245 | pub const _SC_XOPEN_VERSION: c_int = 125; |
| 1246 | pub const _SC_PHYS_PAGES: c_int = 500; |
| 1247 | pub const _SC_AVPHYS_PAGES: c_int = 501; |
| 1248 | pub const _SC_NPROCESSORS_CONF: c_int = 502; |
| 1249 | pub const _SC_NPROCESSORS_ONLN: c_int = 503; |
| 1250 | |
| 1251 | pub const FD_SETSIZE: usize = 1024; |
| 1252 | |
| 1253 | pub const SCHED_FIFO: c_int = 1; |
| 1254 | pub const SCHED_OTHER: c_int = 2; |
| 1255 | pub const SCHED_RR: c_int = 3; |
| 1256 | |
| 1257 | pub const ST_NOSUID: c_ulong = 2; |
| 1258 | |
| 1259 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut(); |
| 1260 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut(); |
| 1261 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut(); |
| 1262 | |
| 1263 | pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1; |
| 1264 | pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2; |
| 1265 | pub const PTHREAD_MUTEX_NORMAL: c_int = 3; |
| 1266 | pub const PTHREAD_MUTEX_STRICT_NP: c_int = 4; |
| 1267 | pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_STRICT_NP; |
| 1268 | |
| 1269 | pub const EVFILT_READ: i16 = -1; |
| 1270 | pub const EVFILT_WRITE: i16 = -2; |
| 1271 | pub const EVFILT_AIO: i16 = -3; |
| 1272 | pub const EVFILT_VNODE: i16 = -4; |
| 1273 | pub const EVFILT_PROC: i16 = -5; |
| 1274 | pub const EVFILT_SIGNAL: i16 = -6; |
| 1275 | pub const EVFILT_TIMER: i16 = -7; |
| 1276 | pub const EVFILT_DEVICE: i16 = -8; |
| 1277 | pub const EVFILT_EXCEPT: i16 = -9; |
| 1278 | pub const EVFILT_USER: i16 = -10; |
| 1279 | pub const EV_ADD: u16 = 0x1; |
| 1280 | pub const EV_DELETE: u16 = 0x2; |
| 1281 | pub const EV_ENABLE: u16 = 0x4; |
| 1282 | pub const EV_DISABLE: u16 = 0x8; |
| 1283 | pub const EV_ONESHOT: u16 = 0x10; |
| 1284 | pub const EV_CLEAR: u16 = 0x20; |
| 1285 | pub const EV_RECEIPT: u16 = 0x40; |
| 1286 | pub const EV_DISPATCH: u16 = 0x80; |
| 1287 | pub const EV_FLAG1: u16 = 0x2000; |
| 1288 | pub const EV_ERROR: u16 = 0x4000; |
| 1289 | pub const EV_EOF: u16 = 0x8000; |
| 1290 | |
| 1291 | #[deprecated(since = "0.2.113", note = "Not stable across OS versions")] |
| 1292 | pub const EV_SYSFLAGS: u16 = 0xf800; |
| 1293 | |
| 1294 | pub const NOTE_TRIGGER: u32 = 0x01000000; |
| 1295 | pub const NOTE_FFNOP: u32 = 0x00000000; |
| 1296 | pub const NOTE_FFAND: u32 = 0x40000000; |
| 1297 | pub const NOTE_FFOR: u32 = 0x80000000; |
| 1298 | pub const NOTE_FFCOPY: u32 = 0xc0000000; |
| 1299 | pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; |
| 1300 | pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; |
| 1301 | pub const NOTE_LOWAT: u32 = 0x00000001; |
| 1302 | pub const NOTE_EOF: u32 = 0x00000002; |
| 1303 | pub const NOTE_OOB: u32 = 0x00000004; |
| 1304 | pub const NOTE_DELETE: u32 = 0x00000001; |
| 1305 | pub const NOTE_WRITE: u32 = 0x00000002; |
| 1306 | pub const NOTE_EXTEND: u32 = 0x00000004; |
| 1307 | pub const NOTE_ATTRIB: u32 = 0x00000008; |
| 1308 | pub const NOTE_LINK: u32 = 0x00000010; |
| 1309 | pub const NOTE_RENAME: u32 = 0x00000020; |
| 1310 | pub const NOTE_REVOKE: u32 = 0x00000040; |
| 1311 | pub const NOTE_TRUNCATE: u32 = 0x00000080; |
| 1312 | pub const NOTE_EXIT: u32 = 0x80000000; |
| 1313 | pub const NOTE_FORK: u32 = 0x40000000; |
| 1314 | pub const NOTE_EXEC: u32 = 0x20000000; |
| 1315 | pub const NOTE_PDATAMASK: u32 = 0x000fffff; |
| 1316 | pub const NOTE_PCTRLMASK: u32 = 0xf0000000; |
| 1317 | pub const NOTE_TRACK: u32 = 0x00000001; |
| 1318 | pub const NOTE_TRACKERR: u32 = 0x00000002; |
| 1319 | pub const NOTE_CHILD: u32 = 0x00000004; |
| 1320 | pub const NOTE_CHANGE: u32 = 0x00000001; |
| 1321 | |
| 1322 | pub const TMP_MAX: c_uint = 0x7fffffff; |
| 1323 | |
| 1324 | pub const AI_PASSIVE: c_int = 1; |
| 1325 | pub const AI_CANONNAME: c_int = 2; |
| 1326 | pub const AI_NUMERICHOST: c_int = 4; |
| 1327 | pub const AI_EXT: c_int = 8; |
| 1328 | pub const AI_NUMERICSERV: c_int = 16; |
| 1329 | pub const AI_FQDN: c_int = 32; |
| 1330 | pub const AI_ADDRCONFIG: c_int = 64; |
| 1331 | |
| 1332 | pub const NI_NUMERICHOST: c_int = 1; |
| 1333 | pub const NI_NUMERICSERV: c_int = 2; |
| 1334 | pub const NI_NOFQDN: c_int = 4; |
| 1335 | pub const NI_NAMEREQD: c_int = 8; |
| 1336 | pub const NI_DGRAM: c_int = 16; |
| 1337 | |
| 1338 | pub const NI_MAXHOST: size_t = 256; |
| 1339 | |
| 1340 | pub const RTLD_LOCAL: c_int = 0; |
| 1341 | |
| 1342 | pub const CTL_MAXNAME: c_int = 12; |
| 1343 | |
| 1344 | pub const CTLTYPE_NODE: c_int = 1; |
| 1345 | pub const CTLTYPE_INT: c_int = 2; |
| 1346 | pub const CTLTYPE_STRING: c_int = 3; |
| 1347 | pub const CTLTYPE_QUAD: c_int = 4; |
| 1348 | pub const CTLTYPE_STRUCT: c_int = 5; |
| 1349 | |
| 1350 | pub const CTL_UNSPEC: c_int = 0; |
| 1351 | pub const CTL_KERN: c_int = 1; |
| 1352 | pub const CTL_VM: c_int = 2; |
| 1353 | pub const CTL_FS: c_int = 3; |
| 1354 | pub const CTL_NET: c_int = 4; |
| 1355 | pub const CTL_DEBUG: c_int = 5; |
| 1356 | pub const CTL_HW: c_int = 6; |
| 1357 | pub const CTL_MACHDEP: c_int = 7; |
| 1358 | pub const CTL_DDB: c_int = 9; |
| 1359 | pub const CTL_VFS: c_int = 10; |
| 1360 | pub const CTL_MAXID: c_int = 11; |
| 1361 | |
| 1362 | pub const HW_NCPUONLINE: c_int = 25; |
| 1363 | |
| 1364 | pub const KERN_OSTYPE: c_int = 1; |
| 1365 | pub const KERN_OSRELEASE: c_int = 2; |
| 1366 | pub const KERN_OSREV: c_int = 3; |
| 1367 | pub const KERN_VERSION: c_int = 4; |
| 1368 | pub const KERN_MAXVNODES: c_int = 5; |
| 1369 | pub const KERN_MAXPROC: c_int = 6; |
| 1370 | pub const KERN_MAXFILES: c_int = 7; |
| 1371 | pub const KERN_ARGMAX: c_int = 8; |
| 1372 | pub const KERN_SECURELVL: c_int = 9; |
| 1373 | pub const KERN_HOSTNAME: c_int = 10; |
| 1374 | pub const KERN_HOSTID: c_int = 11; |
| 1375 | pub const KERN_CLOCKRATE: c_int = 12; |
| 1376 | pub const KERN_PROF: c_int = 16; |
| 1377 | pub const KERN_POSIX1: c_int = 17; |
| 1378 | pub const KERN_NGROUPS: c_int = 18; |
| 1379 | pub const KERN_JOB_CONTROL: c_int = 19; |
| 1380 | pub const KERN_SAVED_IDS: c_int = 20; |
| 1381 | pub const KERN_BOOTTIME: c_int = 21; |
| 1382 | pub const KERN_DOMAINNAME: c_int = 22; |
| 1383 | pub const KERN_MAXPARTITIONS: c_int = 23; |
| 1384 | pub const KERN_RAWPARTITION: c_int = 24; |
| 1385 | pub const KERN_MAXTHREAD: c_int = 25; |
| 1386 | pub const KERN_NTHREADS: c_int = 26; |
| 1387 | pub const KERN_OSVERSION: c_int = 27; |
| 1388 | pub const KERN_SOMAXCONN: c_int = 28; |
| 1389 | pub const KERN_SOMINCONN: c_int = 29; |
| 1390 | #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] |
| 1391 | pub const KERN_USERMOUNT: c_int = 30; |
| 1392 | pub const KERN_NOSUIDCOREDUMP: c_int = 32; |
| 1393 | pub const KERN_FSYNC: c_int = 33; |
| 1394 | pub const KERN_SYSVMSG: c_int = 34; |
| 1395 | pub const KERN_SYSVSEM: c_int = 35; |
| 1396 | pub const KERN_SYSVSHM: c_int = 36; |
| 1397 | #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] |
| 1398 | pub const KERN_ARND: c_int = 37; |
| 1399 | pub const KERN_MSGBUFSIZE: c_int = 38; |
| 1400 | pub const KERN_MALLOCSTATS: c_int = 39; |
| 1401 | pub const KERN_CPTIME: c_int = 40; |
| 1402 | pub const KERN_NCHSTATS: c_int = 41; |
| 1403 | pub const KERN_FORKSTAT: c_int = 42; |
| 1404 | pub const KERN_NSELCOLL: c_int = 43; |
| 1405 | pub const KERN_TTY: c_int = 44; |
| 1406 | pub const KERN_CCPU: c_int = 45; |
| 1407 | pub const KERN_FSCALE: c_int = 46; |
| 1408 | pub const KERN_NPROCS: c_int = 47; |
| 1409 | pub const KERN_MSGBUF: c_int = 48; |
| 1410 | pub const KERN_POOL: c_int = 49; |
| 1411 | pub const KERN_STACKGAPRANDOM: c_int = 50; |
| 1412 | pub const KERN_SYSVIPC_INFO: c_int = 51; |
| 1413 | pub const KERN_SPLASSERT: c_int = 54; |
| 1414 | pub const KERN_PROC_ARGS: c_int = 55; |
| 1415 | pub const KERN_NFILES: c_int = 56; |
| 1416 | pub const KERN_TTYCOUNT: c_int = 57; |
| 1417 | pub const KERN_NUMVNODES: c_int = 58; |
| 1418 | pub const KERN_MBSTAT: c_int = 59; |
| 1419 | pub const KERN_SEMINFO: c_int = 61; |
| 1420 | pub const KERN_SHMINFO: c_int = 62; |
| 1421 | pub const KERN_INTRCNT: c_int = 63; |
| 1422 | pub const KERN_WATCHDOG: c_int = 64; |
| 1423 | pub const KERN_PROC: c_int = 66; |
| 1424 | pub const KERN_MAXCLUSTERS: c_int = 67; |
| 1425 | pub const KERN_EVCOUNT: c_int = 68; |
| 1426 | pub const KERN_TIMECOUNTER: c_int = 69; |
| 1427 | pub const KERN_MAXLOCKSPERUID: c_int = 70; |
| 1428 | pub const KERN_CPTIME2: c_int = 71; |
| 1429 | pub const KERN_CACHEPCT: c_int = 72; |
| 1430 | pub const KERN_FILE: c_int = 73; |
| 1431 | pub const KERN_CONSDEV: c_int = 75; |
| 1432 | pub const KERN_NETLIVELOCKS: c_int = 76; |
| 1433 | pub const KERN_POOL_DEBUG: c_int = 77; |
| 1434 | pub const KERN_PROC_CWD: c_int = 78; |
| 1435 | pub const KERN_PROC_NOBROADCASTKILL: c_int = 79; |
| 1436 | pub const KERN_PROC_VMMAP: c_int = 80; |
| 1437 | pub const KERN_GLOBAL_PTRACE: c_int = 81; |
| 1438 | pub const KERN_CONSBUFSIZE: c_int = 82; |
| 1439 | pub const KERN_CONSBUF: c_int = 83; |
| 1440 | pub const KERN_AUDIO: c_int = 84; |
| 1441 | pub const KERN_CPUSTATS: c_int = 85; |
| 1442 | pub const KERN_PFSTATUS: c_int = 86; |
| 1443 | pub const KERN_TIMEOUT_STATS: c_int = 87; |
| 1444 | #[deprecated( |
| 1445 | since = "0.2.95", |
| 1446 | note = "Possibly increasing over the releases and might not be so used in the field" |
| 1447 | )] |
| 1448 | pub const KERN_MAXID: c_int = 88; |
| 1449 | |
| 1450 | pub const KERN_PROC_ALL: c_int = 0; |
| 1451 | pub const KERN_PROC_PID: c_int = 1; |
| 1452 | pub const KERN_PROC_PGRP: c_int = 2; |
| 1453 | pub const KERN_PROC_SESSION: c_int = 3; |
| 1454 | pub const KERN_PROC_TTY: c_int = 4; |
| 1455 | pub const KERN_PROC_UID: c_int = 5; |
| 1456 | pub const KERN_PROC_RUID: c_int = 6; |
| 1457 | pub const KERN_PROC_KTHREAD: c_int = 7; |
| 1458 | pub const KERN_PROC_SHOW_THREADS: c_int = 0x40000000; |
| 1459 | |
| 1460 | pub const KERN_SYSVIPC_MSG_INFO: c_int = 1; |
| 1461 | pub const KERN_SYSVIPC_SEM_INFO: c_int = 2; |
| 1462 | pub const KERN_SYSVIPC_SHM_INFO: c_int = 3; |
| 1463 | |
| 1464 | pub const KERN_PROC_ARGV: c_int = 1; |
| 1465 | pub const KERN_PROC_NARGV: c_int = 2; |
| 1466 | pub const KERN_PROC_ENV: c_int = 3; |
| 1467 | pub const KERN_PROC_NENV: c_int = 4; |
| 1468 | |
| 1469 | pub const KI_NGROUPS: c_int = 16; |
| 1470 | pub const KI_MAXCOMLEN: c_int = 24; |
| 1471 | pub const KI_WMESGLEN: c_int = 8; |
| 1472 | pub const KI_MAXLOGNAME: c_int = 32; |
| 1473 | pub const KI_EMULNAMELEN: c_int = 8; |
| 1474 | |
| 1475 | pub const KVE_ET_OBJ: c_int = 0x00000001; |
| 1476 | pub const KVE_ET_SUBMAP: c_int = 0x00000002; |
| 1477 | pub const KVE_ET_COPYONWRITE: c_int = 0x00000004; |
| 1478 | pub const KVE_ET_NEEDSCOPY: c_int = 0x00000008; |
| 1479 | pub const KVE_ET_HOLE: c_int = 0x00000010; |
| 1480 | pub const KVE_ET_NOFAULT: c_int = 0x00000020; |
| 1481 | pub const KVE_ET_STACK: c_int = 0x00000040; |
| 1482 | pub const KVE_ET_WC: c_int = 0x000000080; |
| 1483 | pub const KVE_ET_CONCEAL: c_int = 0x000000100; |
| 1484 | pub const KVE_ET_SYSCALL: c_int = 0x000000200; |
| 1485 | pub const KVE_ET_FREEMAPPED: c_int = 0x000000800; |
| 1486 | |
| 1487 | pub const KVE_PROT_NONE: c_int = 0x00000000; |
| 1488 | pub const KVE_PROT_READ: c_int = 0x00000001; |
| 1489 | pub const KVE_PROT_WRITE: c_int = 0x00000002; |
| 1490 | pub const KVE_PROT_EXEC: c_int = 0x00000004; |
| 1491 | |
| 1492 | pub const KVE_ADV_NORMAL: c_int = 0x00000000; |
| 1493 | pub const KVE_ADV_RANDOM: c_int = 0x00000001; |
| 1494 | pub const KVE_ADV_SEQUENTIAL: c_int = 0x00000002; |
| 1495 | |
| 1496 | pub const KVE_INH_SHARE: c_int = 0x00000000; |
| 1497 | pub const KVE_INH_COPY: c_int = 0x00000010; |
| 1498 | pub const KVE_INH_NONE: c_int = 0x00000020; |
| 1499 | pub const KVE_INH_ZERO: c_int = 0x00000030; |
| 1500 | |
| 1501 | pub const KVE_F_STATIC: c_int = 0x1; |
| 1502 | pub const KVE_F_KMEM: c_int = 0x2; |
| 1503 | |
| 1504 | pub const KERN_FILE_BYFILE: c_int = 1; |
| 1505 | pub const KERN_FILE_BYPID: c_int = 2; |
| 1506 | pub const KERN_FILE_BYUID: c_int = 3; |
| 1507 | pub const KERN_FILESLOP: c_int = 10; |
| 1508 | |
| 1509 | pub const KERN_FILE_TEXT: c_int = -1; |
| 1510 | pub const KERN_FILE_CDIR: c_int = -2; |
| 1511 | pub const KERN_FILE_RDIR: c_int = -3; |
| 1512 | pub const KERN_FILE_TRACE: c_int = -4; |
| 1513 | |
| 1514 | pub const KI_MNAMELEN: c_int = 96; |
| 1515 | pub const KI_UNPPATHLEN: c_int = 104; |
| 1516 | |
| 1517 | pub const CHWFLOW: crate::tcflag_t = crate::MDMBUF | crate::CRTSCTS; |
| 1518 | pub const OLCUC: crate::tcflag_t = 0x20; |
| 1519 | pub const ONOCR: crate::tcflag_t = 0x40; |
| 1520 | pub const ONLRET: crate::tcflag_t = 0x80; |
| 1521 | |
| 1522 | //https://github.com/openbsd/src/blob/HEAD/sys/sys/mount.h |
| 1523 | pub const ISOFSMNT_NORRIP: c_int = 0x1; // disable Rock Ridge Ext |
| 1524 | pub const ISOFSMNT_GENS: c_int = 0x2; // enable generation numbers |
| 1525 | pub const ISOFSMNT_EXTATT: c_int = 0x4; // enable extended attr |
| 1526 | pub const ISOFSMNT_NOJOLIET: c_int = 0x8; // disable Joliet Ext |
| 1527 | pub const ISOFSMNT_SESS: c_int = 0x10; // use iso_args.sess |
| 1528 | |
| 1529 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1530 | /// for details. |
| 1531 | pub const NFS_ARGSVERSION: c_int = 4; // change when nfs_args changes |
| 1532 | |
| 1533 | pub const NFSMNT_RESVPORT: c_int = 0; // always use reserved ports |
| 1534 | pub const NFSMNT_SOFT: c_int = 0x1; // soft mount (hard is default) |
| 1535 | pub const NFSMNT_WSIZE: c_int = 0x2; // set write size |
| 1536 | pub const NFSMNT_RSIZE: c_int = 0x4; // set read size |
| 1537 | pub const NFSMNT_TIMEO: c_int = 0x8; // set initial timeout |
| 1538 | pub const NFSMNT_RETRANS: c_int = 0x10; // set number of request retries |
| 1539 | pub const NFSMNT_MAXGRPS: c_int = 0x20; // set maximum grouplist size |
| 1540 | pub const NFSMNT_INT: c_int = 0x40; // allow interrupts on hard mount |
| 1541 | pub const NFSMNT_NOCONN: c_int = 0x80; // Don't Connect the socket |
| 1542 | pub const NFSMNT_NQNFS: c_int = 0x100; // Use Nqnfs protocol |
| 1543 | pub const NFSMNT_NFSV3: c_int = 0x200; // Use NFS Version 3 protocol |
| 1544 | pub const NFSMNT_KERB: c_int = 0x400; // Use Kerberos authentication |
| 1545 | pub const NFSMNT_DUMBTIMR: c_int = 0x800; // Don't estimate rtt dynamically |
| 1546 | pub const NFSMNT_LEASETERM: c_int = 0x1000; // set lease term (nqnfs) |
| 1547 | pub const NFSMNT_READAHEAD: c_int = 0x2000; // set read ahead |
| 1548 | pub const NFSMNT_DEADTHRESH: c_int = 0x4000; // set dead server retry thresh |
| 1549 | pub const NFSMNT_NOAC: c_int = 0x8000; // disable attribute cache |
| 1550 | pub const NFSMNT_RDIRPLUS: c_int = 0x10000; // Use Readdirplus for V3 |
| 1551 | pub const NFSMNT_READDIRSIZE: c_int = 0x20000; // Set readdir size |
| 1552 | |
| 1553 | /* Flags valid only in mount syscall arguments */ |
| 1554 | pub const NFSMNT_ACREGMIN: c_int = 0x40000; // acregmin field valid |
| 1555 | pub const NFSMNT_ACREGMAX: c_int = 0x80000; // acregmax field valid |
| 1556 | pub const NFSMNT_ACDIRMIN: c_int = 0x100000; // acdirmin field valid |
| 1557 | pub const NFSMNT_ACDIRMAX: c_int = 0x200000; // acdirmax field valid |
| 1558 | |
| 1559 | /* Flags valid only in kernel */ |
| 1560 | pub const NFSMNT_INTERNAL: c_int = u32_cast_int(0xfffc0000); // Bits set internally |
| 1561 | pub const NFSMNT_HASWRITEVERF: c_int = 0x40000; // Has write verifier for V3 |
| 1562 | pub const NFSMNT_GOTPATHCONF: c_int = 0x80000; // Got the V3 pathconf info |
| 1563 | pub const NFSMNT_GOTFSINFO: c_int = 0x100000; // Got the V3 fsinfo |
| 1564 | pub const NFSMNT_MNTD: c_int = 0x200000; // Mnt server for mnt point |
| 1565 | pub const NFSMNT_DISMINPROG: c_int = 0x400000; // Dismount in progress |
| 1566 | pub const NFSMNT_DISMNT: c_int = 0x800000; // Dismounted |
| 1567 | pub const NFSMNT_SNDLOCK: c_int = 0x1000000; // Send socket lock |
| 1568 | pub const NFSMNT_WANTSND: c_int = 0x2000000; // Want above |
| 1569 | pub const NFSMNT_RCVLOCK: c_int = 0x4000000; // Rcv socket lock |
| 1570 | pub const NFSMNT_WANTRCV: c_int = 0x8000000; // Want above |
| 1571 | pub const NFSMNT_WAITAUTH: c_int = 0x10000000; // Wait for authentication |
| 1572 | pub const NFSMNT_HASAUTH: c_int = 0x20000000; // Has authenticator |
| 1573 | pub const NFSMNT_WANTAUTH: c_int = 0x40000000; // Wants an authenticator |
| 1574 | pub const NFSMNT_AUTHERR: c_int = u32_cast_int(0x80000000); // Authentication error |
| 1575 | |
| 1576 | pub const MSDOSFSMNT_SHORTNAME: c_int = 0x1; // Force old DOS short names only |
| 1577 | pub const MSDOSFSMNT_LONGNAME: c_int = 0x2; // Force Win'95 long names |
| 1578 | pub const MSDOSFSMNT_NOWIN95: c_int = 0x4; // Completely ignore Win95 entries |
| 1579 | |
| 1580 | pub const NTFS_MFLAG_CASEINS: c_int = 0x1; |
| 1581 | pub const NTFS_MFLAG_ALLNAMES: c_int = 0x2; |
| 1582 | |
| 1583 | pub const TMPFS_ARGS_VERSION: c_int = 1; |
| 1584 | |
| 1585 | const SI_MAXSZ: size_t = 128; |
| 1586 | const SI_PAD: size_t = (SI_MAXSZ / size_of::<c_int>()) - 3; |
| 1587 | |
| 1588 | pub const MAP_STACK: c_int = 0x4000; |
| 1589 | pub const MAP_CONCEAL: c_int = 0x8000; |
| 1590 | |
| 1591 | // https://github.com/openbsd/src/blob/f8a2f73b6503213f5eb24ca315ac7e1f9421c0c9/sys/net/if.h#L135 |
| 1592 | pub const LINK_STATE_UNKNOWN: c_int = 0; // link unknown |
| 1593 | pub const LINK_STATE_INVALID: c_int = 1; // link invalid |
| 1594 | pub const LINK_STATE_DOWN: c_int = 2; // link is down |
| 1595 | pub const LINK_STATE_KALIVE_DOWN: c_int = 3; // keepalive reports down |
| 1596 | pub const LINK_STATE_UP: c_int = 4; // link is up |
| 1597 | pub const LINK_STATE_HALF_DUPLEX: c_int = 5; // link is up and half duplex |
| 1598 | pub const LINK_STATE_FULL_DUPLEX: c_int = 6; // link is up and full duplex |
| 1599 | |
| 1600 | // https://github.com/openbsd/src/blob/HEAD/sys/net/if.h#L187 |
| 1601 | pub const IFF_UP: c_int = 0x1; // interface is up |
| 1602 | pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid |
| 1603 | pub const IFF_DEBUG: c_int = 0x4; // turn on debugging |
| 1604 | pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net |
| 1605 | pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link |
| 1606 | pub const IFF_STATICARP: c_int = 0x20; // only static ARP |
| 1607 | pub const IFF_RUNNING: c_int = 0x40; // resources allocated |
| 1608 | pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol |
| 1609 | pub const IFF_PROMISC: c_int = 0x100; // receive all packets |
| 1610 | pub const IFF_ALLMULTI: c_int = 0x200; // receive all multicast packets |
| 1611 | pub const IFF_OACTIVE: c_int = 0x400; // transmission in progress |
| 1612 | pub const IFF_SIMPLEX: c_int = 0x800; // can't hear own transmissions |
| 1613 | pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit |
| 1614 | pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit |
| 1615 | pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit |
| 1616 | pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast |
| 1617 | |
| 1618 | pub const PTHREAD_STACK_MIN: size_t = 1_usize << _MAX_PAGE_SHIFT; |
| 1619 | pub const MINSIGSTKSZ: size_t = 3_usize << _MAX_PAGE_SHIFT; |
| 1620 | pub const SIGSTKSZ: size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4; |
| 1621 | |
| 1622 | pub const PT_SET_EVENT_MASK: c_int = 12; |
| 1623 | pub const PT_GET_EVENT_MASK: c_int = 13; |
| 1624 | pub const PT_GET_PROCESS_STATE: c_int = 14; |
| 1625 | pub const PT_GET_THREAD_FIRST: c_int = 15; |
| 1626 | pub const PT_GET_THREAD_NEXT: c_int = 16; |
| 1627 | pub const PT_FIRSTMACH: c_int = 32; |
| 1628 | |
| 1629 | pub const PT_PTS_NAMELEN: c_int = 32; |
| 1630 | |
| 1631 | pub const SOCK_CLOEXEC: c_int = 0x8000; |
| 1632 | pub const SOCK_NONBLOCK: c_int = 0x4000; |
| 1633 | pub const SOCK_DNS: c_int = 0x1000; |
| 1634 | |
| 1635 | pub const BIOCGRSIG: c_ulong = 0x40044273; |
| 1636 | pub const BIOCSRSIG: c_ulong = 0x80044272; |
| 1637 | pub const BIOCSDLT: c_ulong = 0x8004427a; |
| 1638 | |
| 1639 | pub const PTRACE_FORK: c_int = 0x0002; |
| 1640 | |
| 1641 | pub const WCONTINUED: c_int = 0x08; |
| 1642 | pub const WEXITED: c_int = 0x04; |
| 1643 | pub const WSTOPPED: c_int = 0x02; // same as WUNTRACED |
| 1644 | pub const WNOWAIT: c_int = 0x10; |
| 1645 | pub const WTRAPPED: c_int = 0x20; |
| 1646 | |
| 1647 | pub const P_ALL: crate::idtype_t = 0; |
| 1648 | pub const P_PGID: crate::idtype_t = 1; |
| 1649 | pub const P_PID: crate::idtype_t = 2; |
| 1650 | |
| 1651 | // search.h |
| 1652 | pub const FIND: crate::ACTION = 0; |
| 1653 | pub const ENTER: crate::ACTION = 1; |
| 1654 | |
| 1655 | // futex.h |
| 1656 | pub const FUTEX_WAIT: c_int = 1; |
| 1657 | pub const FUTEX_WAKE: c_int = 2; |
| 1658 | pub const FUTEX_REQUEUE: c_int = 3; |
| 1659 | pub const FUTEX_PRIVATE_FLAG: c_int = 128; |
| 1660 | |
| 1661 | // sys/file.h |
| 1662 | pub const DTYPE_VNODE: c_int = 1; |
| 1663 | pub const DTYPE_SOCKET: c_int = 2; |
| 1664 | pub const DTYPE_PIPE: c_int = 3; |
| 1665 | pub const DTYPE_KQUEUE: c_int = 4; |
| 1666 | pub const DTYPE_DMABUF: c_int = 5; |
| 1667 | pub const DTYPE_SYNC: c_int = 6; |
| 1668 | |
| 1669 | // sysctl.h, kinfo_proc p_eflag constants |
| 1670 | pub const EPROC_CTTY: i32 = 0x01; // controlling tty vnode active |
| 1671 | pub const EPROC_SLEADER: i32 = 0x02; // session leader |
| 1672 | pub const EPROC_UNVEIL: i32 = 0x04; // has unveil settings |
| 1673 | pub const EPROC_LKUNVEIL: i32 = 0x08; // unveil is locked |
| 1674 | |
| 1675 | // Flags for chflags(2) |
| 1676 | pub const UF_SETTABLE: c_uint = 0x0000ffff; |
| 1677 | pub const UF_NODUMP: c_uint = 0x00000001; |
| 1678 | pub const UF_IMMUTABLE: c_uint = 0x00000002; |
| 1679 | pub const UF_APPEND: c_uint = 0x00000004; |
| 1680 | pub const UF_OPAQUE: c_uint = 0x00000008; |
| 1681 | pub const SF_SETTABLE: c_uint = 0xffff0000; |
| 1682 | pub const SF_ARCHIVED: c_uint = 0x00010000; |
| 1683 | pub const SF_IMMUTABLE: c_uint = 0x00020000; |
| 1684 | pub const SF_APPEND: c_uint = 0x00040000; |
| 1685 | |
| 1686 | // sys/exec_elf.h - Legal values for p_type (segment type). |
| 1687 | pub const PT_NULL: u32 = 0; |
| 1688 | pub const PT_LOAD: u32 = 1; |
| 1689 | pub const PT_DYNAMIC: u32 = 2; |
| 1690 | pub const PT_INTERP: u32 = 3; |
| 1691 | pub const PT_NOTE: u32 = 4; |
| 1692 | pub const PT_SHLIB: u32 = 5; |
| 1693 | pub const PT_PHDR: u32 = 6; |
| 1694 | pub const PT_TLS: u32 = 7; |
| 1695 | pub const PT_LOOS: u32 = 0x60000000; |
| 1696 | pub const PT_HIOS: u32 = 0x6fffffff; |
| 1697 | pub const PT_LOPROC: u32 = 0x70000000; |
| 1698 | pub const PT_HIPROC: u32 = 0x7fffffff; |
| 1699 | |
| 1700 | pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; |
| 1701 | pub const PT_GNU_RELRO: u32 = 0x6474e552; |
| 1702 | |
| 1703 | // sys/exec_elf.h - Legal values for p_flags (segment flags). |
| 1704 | pub const PF_X: u32 = 0x1; |
| 1705 | pub const PF_W: u32 = 0x2; |
| 1706 | pub const PF_R: u32 = 0x4; |
| 1707 | pub const PF_MASKOS: u32 = 0x0ff00000; |
| 1708 | pub const PF_MASKPROC: u32 = 0xf0000000; |
| 1709 | |
| 1710 | // sys/ioccom.h |
| 1711 | pub const fn IOCPARM_LEN(x: u32) -> u32 { |
| 1712 | (x >> 16) & crate::IOCPARM_MASK |
| 1713 | } |
| 1714 | |
| 1715 | pub const fn IOCBASECMD(x: u32) -> u32 { |
| 1716 | x & (!(crate::IOCPARM_MASK << 16)) |
| 1717 | } |
| 1718 | |
| 1719 | pub const fn IOCGROUP(x: u32) -> u32 { |
| 1720 | (x >> 8) & 0xff |
| 1721 | } |
| 1722 | |
| 1723 | pub const fn _IOC(inout: c_ulong, group: c_ulong, num: c_ulong, len: c_ulong) -> c_ulong { |
| 1724 | (inout) | (((len) & crate::IOCPARM_MASK as c_ulong) << 16) | ((group) << 8) | (num) |
| 1725 | } |
| 1726 | |
| 1727 | // sys/mount.h |
| 1728 | pub const MNT_NOPERM: c_int = 0x00000020; |
| 1729 | pub const MNT_WXALLOWED: c_int = 0x00000800; |
| 1730 | pub const MNT_EXRDONLY: c_int = 0x00000080; |
| 1731 | pub const MNT_DEFEXPORTED: c_int = 0x00000200; |
| 1732 | pub const MNT_EXPORTANON: c_int = 0x00000400; |
| 1733 | pub const MNT_ROOTFS: c_int = 0x00004000; |
| 1734 | pub const MNT_NOATIME: c_int = 0x00008000; |
| 1735 | pub const MNT_DELEXPORT: c_int = 0x00020000; |
| 1736 | pub const MNT_STALLED: c_int = 0x00100000; |
| 1737 | pub const MNT_SWAPPABLE: c_int = 0x00200000; |
| 1738 | pub const MNT_WANTRDWR: c_int = 0x02000000; |
| 1739 | pub const MNT_SOFTDEP: c_int = 0x04000000; |
| 1740 | pub const MNT_DOOMED: c_int = 0x08000000; |
| 1741 | |
| 1742 | // For use with vfs_fsync and getfsstat |
| 1743 | pub const MNT_WAIT: c_int = 1; |
| 1744 | pub const MNT_NOWAIT: c_int = 2; |
| 1745 | pub const MNT_LAZY: c_int = 3; |
| 1746 | |
| 1747 | // sys/_time.h |
| 1748 | pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2; |
| 1749 | pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4; |
| 1750 | pub const CLOCK_UPTIME: crate::clockid_t = 5; |
| 1751 | pub const CLOCK_BOOTTIME: crate::clockid_t = 6; |
| 1752 | |
| 1753 | pub const LC_COLLATE_MASK: c_int = 1 << crate::LC_COLLATE; |
| 1754 | pub const LC_CTYPE_MASK: c_int = 1 << crate::LC_CTYPE; |
| 1755 | pub const LC_MONETARY_MASK: c_int = 1 << crate::LC_MONETARY; |
| 1756 | pub const LC_NUMERIC_MASK: c_int = 1 << crate::LC_NUMERIC; |
| 1757 | pub const LC_TIME_MASK: c_int = 1 << crate::LC_TIME; |
| 1758 | pub const LC_MESSAGES_MASK: c_int = 1 << crate::LC_MESSAGES; |
| 1759 | |
| 1760 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1761 | /// for details. |
| 1762 | const _LC_LAST: c_int = 7; |
| 1763 | |
| 1764 | pub const LC_ALL_MASK: c_int = (1 << _LC_LAST) - 2; |
| 1765 | |
| 1766 | pub const LC_GLOBAL_LOCALE: crate::locale_t = -1isize as crate::locale_t; |
| 1767 | |
| 1768 | // sys/reboot.h |
| 1769 | pub const RB_ASKNAME: c_int = 0x00001; |
| 1770 | pub const RB_SINGLE: c_int = 0x00002; |
| 1771 | pub const RB_NOSYNC: c_int = 0x00004; |
| 1772 | pub const RB_HALT: c_int = 0x00008; |
| 1773 | pub const RB_INITNAME: c_int = 0x00010; |
| 1774 | pub const RB_KDB: c_int = 0x00040; |
| 1775 | pub const RB_RDONLY: c_int = 0x00080; |
| 1776 | pub const RB_DUMP: c_int = 0x00100; |
| 1777 | pub const RB_MINIROOT: c_int = 0x00200; |
| 1778 | pub const RB_CONFIG: c_int = 0x00400; |
| 1779 | pub const RB_TIMEBAD: c_int = 0x00800; |
| 1780 | pub const RB_POWERDOWN: c_int = 0x01000; |
| 1781 | pub const RB_SERCONS: c_int = 0x02000; |
| 1782 | pub const RB_USERREQ: c_int = 0x04000; |
| 1783 | pub const RB_RESET: c_int = 0x08000; |
| 1784 | pub const RB_GOODRANDOM: c_int = 0x10000; |
| 1785 | pub const RB_UNHIBERNATE: c_int = 0x20000; |
| 1786 | |
| 1787 | // net/route.h |
| 1788 | pub const RTF_CLONING: c_int = 0x100; |
| 1789 | pub const RTF_MULTICAST: c_int = 0x200; |
| 1790 | pub const RTF_LLINFO: c_int = 0x400; |
| 1791 | pub const RTF_PROTO3: c_int = 0x2000; |
| 1792 | pub const RTF_ANNOUNCE: c_int = crate::RTF_PROTO2; |
| 1793 | |
| 1794 | pub const RTF_CLONED: c_int = 0x10000; |
| 1795 | pub const RTF_CACHED: c_int = 0x20000; |
| 1796 | pub const RTF_MPATH: c_int = 0x40000; |
| 1797 | pub const RTF_MPLS: c_int = 0x100000; |
| 1798 | pub const RTF_LOCAL: c_int = 0x200000; |
| 1799 | pub const RTF_BROADCAST: c_int = 0x400000; |
| 1800 | pub const RTF_CONNECTED: c_int = 0x800000; |
| 1801 | pub const RTF_BFD: c_int = 0x1000000; |
| 1802 | pub const RTF_FMASK: c_int = crate::RTF_LLINFO |
| 1803 | | crate::RTF_PROTO1 |
| 1804 | | crate::RTF_PROTO2 |
| 1805 | | crate::RTF_PROTO3 |
| 1806 | | crate::RTF_BLACKHOLE |
| 1807 | | crate::RTF_REJECT |
| 1808 | | crate::RTF_STATIC |
| 1809 | | crate::RTF_MPLS |
| 1810 | | crate::RTF_BFD; |
| 1811 | |
| 1812 | pub const RTM_VERSION: c_int = 5; |
| 1813 | pub const RTM_RESOLVE: c_int = 0xb; |
| 1814 | pub const RTM_NEWADDR: c_int = 0xc; |
| 1815 | pub const RTM_DELADDR: c_int = 0xd; |
| 1816 | pub const RTM_IFINFO: c_int = 0xe; |
| 1817 | pub const RTM_IFANNOUNCE: c_int = 0xf; |
| 1818 | pub const RTM_DESYNC: c_int = 0x10; |
| 1819 | pub const RTM_INVALIDATE: c_int = 0x11; |
| 1820 | pub const RTM_BFD: c_int = 0x12; |
| 1821 | pub const RTM_PROPOSAL: c_int = 0x13; |
| 1822 | pub const RTM_CHGADDRATTR: c_int = 0x14; |
| 1823 | pub const RTM_80211INFO: c_int = 0x15; |
| 1824 | pub const RTM_SOURCE: c_int = 0x16; |
| 1825 | |
| 1826 | pub const RTA_SRC: c_int = 0x100; |
| 1827 | pub const RTA_SRCMASK: c_int = 0x200; |
| 1828 | pub const RTA_LABEL: c_int = 0x400; |
| 1829 | pub const RTA_BFD: c_int = 0x800; |
| 1830 | pub const RTA_DNS: c_int = 0x1000; |
| 1831 | pub const RTA_STATIC: c_int = 0x2000; |
| 1832 | pub const RTA_SEARCH: c_int = 0x4000; |
| 1833 | |
| 1834 | pub const RTAX_SRC: c_int = 8; |
| 1835 | pub const RTAX_SRCMASK: c_int = 9; |
| 1836 | pub const RTAX_LABEL: c_int = 10; |
| 1837 | pub const RTAX_BFD: c_int = 11; |
| 1838 | pub const RTAX_DNS: c_int = 12; |
| 1839 | pub const RTAX_STATIC: c_int = 13; |
| 1840 | pub const RTAX_SEARCH: c_int = 14; |
| 1841 | |
| 1842 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1843 | /// for details. |
| 1844 | pub const RTAX_MAX: c_int = 15; |
| 1845 | |
| 1846 | const fn _ALIGN(p: usize) -> usize { |
| 1847 | (p + _ALIGNBYTES) & !_ALIGNBYTES |
| 1848 | } |
| 1849 | |
| 1850 | f! { |
| 1851 | pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { |
| 1852 | (cmsg as *mut c_uchar).offset(_ALIGN(size_of::<cmsghdr>()) as isize) |
| 1853 | } |
| 1854 | |
| 1855 | pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint { |
| 1856 | _ALIGN(size_of::<cmsghdr>()) as c_uint + length |
| 1857 | } |
| 1858 | |
| 1859 | pub unsafe fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { |
| 1860 | if cmsg.is_null() { |
| 1861 | return crate::CMSG_FIRSTHDR(mhdr); |
| 1862 | } |
| 1863 | let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(size_of::<cmsghdr>()); |
| 1864 | let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1865 | if next > max { |
| 1866 | ptr::null_mut() |
| 1867 | } else { |
| 1868 | (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr |
| 1869 | } |
| 1870 | } |
| 1871 | |
| 1872 | pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { |
| 1873 | (_ALIGN(size_of::<cmsghdr>()) + _ALIGN(length as usize)) as c_uint |
| 1874 | } |
| 1875 | } |
| 1876 | |
| 1877 | safe_f! { |
| 1878 | pub const safe fn WSTOPSIG(status: c_int) -> c_int { |
| 1879 | status >> 8 |
| 1880 | } |
| 1881 | |
| 1882 | pub const safe fn WIFSIGNALED(status: c_int) -> bool { |
| 1883 | (status & 0o177) != 0o177 && (status & 0o177) != 0 |
| 1884 | } |
| 1885 | |
| 1886 | pub const safe fn WIFSTOPPED(status: c_int) -> bool { |
| 1887 | (status & 0xff) == 0o177 |
| 1888 | } |
| 1889 | |
| 1890 | pub const safe fn WIFCONTINUED(status: c_int) -> bool { |
| 1891 | (status & 0o177777) == 0o177777 |
| 1892 | } |
| 1893 | |
| 1894 | pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { |
| 1895 | let major = major as crate::dev_t; |
| 1896 | let minor = minor as crate::dev_t; |
| 1897 | let mut dev = 0; |
| 1898 | dev |= (major & 0xff) << 8; |
| 1899 | dev |= minor & 0xff; |
| 1900 | dev |= (minor & 0xffff00) << 8; |
| 1901 | dev |
| 1902 | } |
| 1903 | |
| 1904 | pub const safe fn major(dev: crate::dev_t) -> c_uint { |
| 1905 | ((dev as c_uint) >> 8) & 0xff |
| 1906 | } |
| 1907 | |
| 1908 | pub const safe fn minor(dev: crate::dev_t) -> c_uint { |
| 1909 | let dev = dev as c_uint; |
| 1910 | let mut res = 0; |
| 1911 | res |= (dev) & 0xff; |
| 1912 | res |= ((dev) & 0xffff0000) >> 8; |
| 1913 | res |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1917 | extern "C" { |
| 1918 | pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int; |
| 1919 | pub fn settimeofday(tp: *const crate::timeval, tz: *const crate::timezone) -> c_int; |
| 1920 | pub fn pledge(promises: *const c_char, execpromises: *const c_char) -> c_int; |
| 1921 | pub fn unveil(path: *const c_char, permissions: *const c_char) -> c_int; |
| 1922 | pub fn strtonum( |
| 1923 | nptr: *const c_char, |
| 1924 | minval: c_longlong, |
| 1925 | maxval: c_longlong, |
| 1926 | errstr: *mut *const c_char, |
| 1927 | ) -> c_longlong; |
| 1928 | pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int; |
| 1929 | pub fn chflags(path: *const c_char, flags: c_uint) -> c_int; |
| 1930 | pub fn fchflags(fd: c_int, flags: c_uint) -> c_int; |
| 1931 | pub fn chflagsat(fd: c_int, path: *const c_char, flags: c_uint, atflag: c_int) -> c_int; |
| 1932 | pub fn dirfd(dirp: *mut crate::DIR) -> c_int; |
| 1933 | pub fn getnameinfo( |
| 1934 | sa: *const crate::sockaddr, |
| 1935 | salen: crate::socklen_t, |
| 1936 | host: *mut c_char, |
| 1937 | hostlen: size_t, |
| 1938 | serv: *mut c_char, |
| 1939 | servlen: size_t, |
| 1940 | flags: c_int, |
| 1941 | ) -> c_int; |
| 1942 | pub fn getresgid( |
| 1943 | rgid: *mut crate::gid_t, |
| 1944 | egid: *mut crate::gid_t, |
| 1945 | sgid: *mut crate::gid_t, |
| 1946 | ) -> c_int; |
| 1947 | pub fn getresuid( |
| 1948 | ruid: *mut crate::uid_t, |
| 1949 | euid: *mut crate::uid_t, |
| 1950 | suid: *mut crate::uid_t, |
| 1951 | ) -> c_int; |
| 1952 | pub fn kevent( |
| 1953 | kq: c_int, |
| 1954 | changelist: *const crate::kevent, |
| 1955 | nchanges: c_int, |
| 1956 | eventlist: *mut crate::kevent, |
| 1957 | nevents: c_int, |
| 1958 | timeout: *const crate::timespec, |
| 1959 | ) -> c_int; |
| 1960 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1961 | pub fn getthrid() -> crate::pid_t; |
| 1962 | pub fn pthread_attr_getguardsize( |
| 1963 | attr: *const crate::pthread_attr_t, |
| 1964 | guardsize: *mut size_t, |
| 1965 | ) -> c_int; |
| 1966 | pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int; |
| 1967 | pub fn pthread_attr_getstack( |
| 1968 | attr: *const crate::pthread_attr_t, |
| 1969 | stackaddr: *mut *mut c_void, |
| 1970 | stacksize: *mut size_t, |
| 1971 | ) -> c_int; |
| 1972 | pub fn pthread_main_np() -> c_int; |
| 1973 | pub fn pthread_get_name_np(tid: crate::pthread_t, name: *mut c_char, len: size_t); |
| 1974 | pub fn pthread_set_name_np(tid: crate::pthread_t, name: *const c_char); |
| 1975 | pub fn pthread_stackseg_np(thread: crate::pthread_t, sinfo: *mut crate::stack_t) -> c_int; |
| 1976 | |
| 1977 | pub fn openpty( |
| 1978 | amaster: *mut c_int, |
| 1979 | aslave: *mut c_int, |
| 1980 | name: *mut c_char, |
| 1981 | termp: *const crate::termios, |
| 1982 | winp: *const crate::winsize, |
| 1983 | ) -> c_int; |
| 1984 | pub fn forkpty( |
| 1985 | amaster: *mut c_int, |
| 1986 | name: *mut c_char, |
| 1987 | termp: *const crate::termios, |
| 1988 | winp: *const crate::winsize, |
| 1989 | ) -> crate::pid_t; |
| 1990 | |
| 1991 | pub fn sysctl( |
| 1992 | name: *const c_int, |
| 1993 | namelen: c_uint, |
| 1994 | oldp: *mut c_void, |
| 1995 | oldlenp: *mut size_t, |
| 1996 | newp: *mut c_void, |
| 1997 | newlen: size_t, |
| 1998 | ) -> c_int; |
| 1999 | pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int; |
| 2000 | pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int; |
| 2001 | pub fn ptrace(request: c_int, pid: crate::pid_t, addr: caddr_t, data: c_int) -> c_int; |
| 2002 | pub fn utrace(label: *const c_char, addr: *const c_void, len: size_t) -> c_int; |
| 2003 | pub fn memmem( |
| 2004 | haystack: *const c_void, |
| 2005 | haystacklen: size_t, |
| 2006 | needle: *const c_void, |
| 2007 | needlelen: size_t, |
| 2008 | ) -> *mut c_void; |
| 2009 | // #include <link.h> |
| 2010 | pub fn dl_iterate_phdr( |
| 2011 | callback: Option< |
| 2012 | unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int, |
| 2013 | >, |
| 2014 | data: *mut c_void, |
| 2015 | ) -> c_int; |
| 2016 | pub fn uselocale(loc: crate::locale_t) -> crate::locale_t; |
| 2017 | pub fn freelocale(loc: crate::locale_t); |
| 2018 | pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t; |
| 2019 | pub fn duplocale(base: crate::locale_t) -> crate::locale_t; |
| 2020 | |
| 2021 | // Added in `OpenBSD` 5.5 |
| 2022 | pub fn explicit_bzero(s: *mut c_void, len: size_t); |
| 2023 | |
| 2024 | pub fn setproctitle(fmt: *const c_char, ...); |
| 2025 | |
| 2026 | pub fn freezero(ptr: *mut c_void, size: size_t); |
| 2027 | pub fn malloc_conceal(size: size_t) -> *mut c_void; |
| 2028 | pub fn calloc_conceal(nmemb: size_t, size: size_t) -> *mut c_void; |
| 2029 | |
| 2030 | pub fn srand48_deterministic(seed: c_long); |
| 2031 | pub fn seed48_deterministic(xseed: *mut c_ushort) -> *mut c_ushort; |
| 2032 | pub fn lcong48_deterministic(p: *mut c_ushort); |
| 2033 | |
| 2034 | pub fn lsearch( |
| 2035 | key: *const c_void, |
| 2036 | base: *mut c_void, |
| 2037 | nelp: *mut size_t, |
| 2038 | width: size_t, |
| 2039 | compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
| 2040 | ) -> *mut c_void; |
| 2041 | pub fn lfind( |
| 2042 | key: *const c_void, |
| 2043 | base: *const c_void, |
| 2044 | nelp: *mut size_t, |
| 2045 | width: size_t, |
| 2046 | compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
| 2047 | ) -> *mut c_void; |
| 2048 | pub fn hcreate(nelt: size_t) -> c_int; |
| 2049 | pub fn hdestroy(); |
| 2050 | pub fn hsearch(entry: crate::ENTRY, action: crate::ACTION) -> *mut crate::ENTRY; |
| 2051 | |
| 2052 | // futex.h |
| 2053 | pub fn futex( |
| 2054 | uaddr: *mut u32, |
| 2055 | op: c_int, |
| 2056 | val: c_int, |
| 2057 | timeout: *const crate::timespec, |
| 2058 | uaddr2: *mut u32, |
| 2059 | ) -> c_int; |
| 2060 | |
| 2061 | pub fn mimmutable(addr: *mut c_void, len: size_t) -> c_int; |
| 2062 | |
| 2063 | pub fn reboot(mode: c_int) -> c_int; |
| 2064 | |
| 2065 | pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; |
| 2066 | pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; |
| 2067 | pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, flags: c_int) -> c_int; |
| 2068 | pub fn getfsstat(buf: *mut statfs, bufsize: size_t, flags: c_int) -> c_int; |
| 2069 | |
| 2070 | pub fn elf_aux_info(aux: c_int, buf: *mut c_void, buflen: c_int) -> c_int; |
| 2071 | } |
| 2072 | |
| 2073 | #[link(name = "execinfo")] |
| 2074 | extern "C" { |
| 2075 | pub fn backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t; |
| 2076 | pub fn backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char; |
| 2077 | pub fn backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int; |
| 2078 | pub fn backtrace_symbols_fmt( |
| 2079 | addrlist: *const *mut c_void, |
| 2080 | len: size_t, |
| 2081 | fmt: *const c_char, |
| 2082 | ) -> *mut *mut c_char; |
| 2083 | } |
| 2084 | |
| 2085 | cfg_if! { |
| 2086 | if #[cfg(target_arch = "aarch64")] { |
| 2087 | mod aarch64; |
| 2088 | pub use self::aarch64::*; |
| 2089 | } else if #[cfg(target_arch = "arm")] { |
| 2090 | mod arm; |
| 2091 | pub use self::arm::*; |
| 2092 | } else if #[cfg(target_arch = "mips64")] { |
| 2093 | mod mips64; |
| 2094 | pub use self::mips64::*; |
| 2095 | } else if #[cfg(target_arch = "powerpc")] { |
| 2096 | mod powerpc; |
| 2097 | pub use self::powerpc::*; |
| 2098 | } else if #[cfg(target_arch = "powerpc64")] { |
| 2099 | mod powerpc64; |
| 2100 | pub use self::powerpc64::*; |
| 2101 | } else if #[cfg(target_arch = "riscv64")] { |
| 2102 | mod riscv64; |
| 2103 | pub use self::riscv64::*; |
| 2104 | } else if #[cfg(target_arch = "sparc64")] { |
| 2105 | mod sparc64; |
| 2106 | pub use self::sparc64::*; |
| 2107 | } else if #[cfg(target_arch = "x86")] { |
| 2108 | mod x86; |
| 2109 | pub use self::x86::*; |
| 2110 | } else if #[cfg(target_arch = "x86_64")] { |
| 2111 | mod x86_64; |
| 2112 | pub use self::x86_64::*; |
| 2113 | } else { |
| 2114 | // Unknown target_arch |
| 2115 | } |
| 2116 | } |