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 / linux_like / linux_l4re_shared.rs
| 1 | use crate::prelude::*; |
| 2 | |
| 3 | pub type Elf32_Half = u16; |
| 4 | pub type Elf32_Word = u32; |
| 5 | pub type Elf32_Off = u32; |
| 6 | pub type Elf32_Addr = u32; |
| 7 | pub type Elf32_Xword = u64; |
| 8 | pub type Elf32_Sword = i32; |
| 9 | |
| 10 | pub type Elf64_Half = u16; |
| 11 | pub type Elf64_Word = u32; |
| 12 | pub type Elf64_Off = u64; |
| 13 | pub type Elf64_Addr = u64; |
| 14 | pub type Elf64_Xword = u64; |
| 15 | pub type Elf64_Sxword = i64; |
| 16 | pub type Elf64_Sword = i32; |
| 17 | |
| 18 | pub type Elf32_Section = u16; |
| 19 | pub type Elf64_Section = u16; |
| 20 | |
| 21 | pub type Elf32_Relr = Elf32_Word; |
| 22 | pub type Elf64_Relr = Elf32_Xword; |
| 23 | pub type Elf32_Rel = __c_anonymous_elf32_rel; |
| 24 | pub type Elf64_Rel = __c_anonymous_elf64_rel; |
| 25 | |
| 26 | cfg_if! { |
| 27 | if #[cfg(not(target_arch = "sparc64"))] { |
| 28 | pub type Elf32_Rela = __c_anonymous_elf32_rela; |
| 29 | pub type Elf64_Rela = __c_anonymous_elf64_rela; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | pub type iconv_t = *mut c_void; |
| 34 | |
| 35 | s! { |
| 36 | pub struct glob_t { |
| 37 | pub gl_pathc: size_t, |
| 38 | pub gl_pathv: *mut *mut c_char, |
| 39 | pub gl_offs: size_t, |
| 40 | pub gl_flags: c_int, |
| 41 | |
| 42 | __unused1: Padding<*mut c_void>, |
| 43 | __unused2: Padding<*mut c_void>, |
| 44 | __unused3: Padding<*mut c_void>, |
| 45 | __unused4: Padding<*mut c_void>, |
| 46 | __unused5: Padding<*mut c_void>, |
| 47 | } |
| 48 | |
| 49 | pub struct passwd { |
| 50 | pub pw_name: *mut c_char, |
| 51 | pub pw_passwd: *mut c_char, |
| 52 | pub pw_uid: crate::uid_t, |
| 53 | pub pw_gid: crate::gid_t, |
| 54 | pub pw_gecos: *mut c_char, |
| 55 | pub pw_dir: *mut c_char, |
| 56 | pub pw_shell: *mut c_char, |
| 57 | } |
| 58 | |
| 59 | pub struct spwd { |
| 60 | pub sp_namp: *mut c_char, |
| 61 | pub sp_pwdp: *mut c_char, |
| 62 | pub sp_lstchg: c_long, |
| 63 | pub sp_min: c_long, |
| 64 | pub sp_max: c_long, |
| 65 | pub sp_warn: c_long, |
| 66 | pub sp_inact: c_long, |
| 67 | pub sp_expire: c_long, |
| 68 | pub sp_flag: c_ulong, |
| 69 | } |
| 70 | |
| 71 | pub struct itimerspec { |
| 72 | pub it_interval: crate::timespec, |
| 73 | pub it_value: crate::timespec, |
| 74 | } |
| 75 | |
| 76 | pub struct fsid_t { |
| 77 | __val: [c_int; 2], |
| 78 | } |
| 79 | |
| 80 | pub struct cpu_set_t { |
| 81 | #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] |
| 82 | bits: [u32; 32], |
| 83 | #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] |
| 84 | bits: [u64; 16], |
| 85 | } |
| 86 | |
| 87 | pub struct sembuf { |
| 88 | pub sem_num: c_ushort, |
| 89 | pub sem_op: c_short, |
| 90 | pub sem_flg: c_short, |
| 91 | } |
| 92 | |
| 93 | pub struct dl_phdr_info { |
| 94 | #[cfg(target_pointer_width = "64")] |
| 95 | pub dlpi_addr: Elf64_Addr, |
| 96 | #[cfg(target_pointer_width = "32")] |
| 97 | pub dlpi_addr: Elf32_Addr, |
| 98 | |
| 99 | pub dlpi_name: *const c_char, |
| 100 | |
| 101 | #[cfg(target_pointer_width = "64")] |
| 102 | pub dlpi_phdr: *const Elf64_Phdr, |
| 103 | #[cfg(target_pointer_width = "32")] |
| 104 | pub dlpi_phdr: *const Elf32_Phdr, |
| 105 | |
| 106 | #[cfg(target_pointer_width = "64")] |
| 107 | pub dlpi_phnum: Elf64_Half, |
| 108 | #[cfg(target_pointer_width = "32")] |
| 109 | pub dlpi_phnum: Elf32_Half, |
| 110 | |
| 111 | // As of uClibc 1.0.36, the following fields are |
| 112 | // gated behind a "#if 0" block which always evaluates |
| 113 | // to false. So I'm just removing these, and if uClibc changes |
| 114 | // the #if block in the future to include the following fields, these |
| 115 | // will probably need including here. tsidea, skrap |
| 116 | // QNX (NTO) platform does not define these fields |
| 117 | #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] |
| 118 | pub dlpi_adds: c_ulonglong, |
| 119 | #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] |
| 120 | pub dlpi_subs: c_ulonglong, |
| 121 | #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] |
| 122 | pub dlpi_tls_modid: size_t, |
| 123 | #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] |
| 124 | pub dlpi_tls_data: *mut c_void, |
| 125 | } |
| 126 | |
| 127 | pub struct Elf32_Ehdr { |
| 128 | pub e_ident: [c_uchar; 16], |
| 129 | pub e_type: Elf32_Half, |
| 130 | pub e_machine: Elf32_Half, |
| 131 | pub e_version: Elf32_Word, |
| 132 | pub e_entry: Elf32_Addr, |
| 133 | pub e_phoff: Elf32_Off, |
| 134 | pub e_shoff: Elf32_Off, |
| 135 | pub e_flags: Elf32_Word, |
| 136 | pub e_ehsize: Elf32_Half, |
| 137 | pub e_phentsize: Elf32_Half, |
| 138 | pub e_phnum: Elf32_Half, |
| 139 | pub e_shentsize: Elf32_Half, |
| 140 | pub e_shnum: Elf32_Half, |
| 141 | pub e_shstrndx: Elf32_Half, |
| 142 | } |
| 143 | |
| 144 | pub struct Elf64_Ehdr { |
| 145 | pub e_ident: [c_uchar; 16], |
| 146 | pub e_type: Elf64_Half, |
| 147 | pub e_machine: Elf64_Half, |
| 148 | pub e_version: Elf64_Word, |
| 149 | pub e_entry: Elf64_Addr, |
| 150 | pub e_phoff: Elf64_Off, |
| 151 | pub e_shoff: Elf64_Off, |
| 152 | pub e_flags: Elf64_Word, |
| 153 | pub e_ehsize: Elf64_Half, |
| 154 | pub e_phentsize: Elf64_Half, |
| 155 | pub e_phnum: Elf64_Half, |
| 156 | pub e_shentsize: Elf64_Half, |
| 157 | pub e_shnum: Elf64_Half, |
| 158 | pub e_shstrndx: Elf64_Half, |
| 159 | } |
| 160 | |
| 161 | pub struct Elf32_Sym { |
| 162 | pub st_name: Elf32_Word, |
| 163 | pub st_value: Elf32_Addr, |
| 164 | pub st_size: Elf32_Word, |
| 165 | pub st_info: c_uchar, |
| 166 | pub st_other: c_uchar, |
| 167 | pub st_shndx: Elf32_Section, |
| 168 | } |
| 169 | |
| 170 | pub struct Elf64_Sym { |
| 171 | pub st_name: Elf64_Word, |
| 172 | pub st_info: c_uchar, |
| 173 | pub st_other: c_uchar, |
| 174 | pub st_shndx: Elf64_Section, |
| 175 | pub st_value: Elf64_Addr, |
| 176 | pub st_size: Elf64_Xword, |
| 177 | } |
| 178 | |
| 179 | pub struct Elf32_Phdr { |
| 180 | pub p_type: Elf32_Word, |
| 181 | pub p_offset: Elf32_Off, |
| 182 | pub p_vaddr: Elf32_Addr, |
| 183 | pub p_paddr: Elf32_Addr, |
| 184 | pub p_filesz: Elf32_Word, |
| 185 | pub p_memsz: Elf32_Word, |
| 186 | pub p_flags: Elf32_Word, |
| 187 | pub p_align: Elf32_Word, |
| 188 | } |
| 189 | |
| 190 | pub struct Elf64_Phdr { |
| 191 | pub p_type: Elf64_Word, |
| 192 | pub p_flags: Elf64_Word, |
| 193 | pub p_offset: Elf64_Off, |
| 194 | pub p_vaddr: Elf64_Addr, |
| 195 | pub p_paddr: Elf64_Addr, |
| 196 | pub p_filesz: Elf64_Xword, |
| 197 | pub p_memsz: Elf64_Xword, |
| 198 | pub p_align: Elf64_Xword, |
| 199 | } |
| 200 | |
| 201 | pub struct Elf32_Shdr { |
| 202 | pub sh_name: Elf32_Word, |
| 203 | pub sh_type: Elf32_Word, |
| 204 | pub sh_flags: Elf32_Word, |
| 205 | pub sh_addr: Elf32_Addr, |
| 206 | pub sh_offset: Elf32_Off, |
| 207 | pub sh_size: Elf32_Word, |
| 208 | pub sh_link: Elf32_Word, |
| 209 | pub sh_info: Elf32_Word, |
| 210 | pub sh_addralign: Elf32_Word, |
| 211 | pub sh_entsize: Elf32_Word, |
| 212 | } |
| 213 | |
| 214 | pub struct Elf64_Shdr { |
| 215 | pub sh_name: Elf64_Word, |
| 216 | pub sh_type: Elf64_Word, |
| 217 | pub sh_flags: Elf64_Xword, |
| 218 | pub sh_addr: Elf64_Addr, |
| 219 | pub sh_offset: Elf64_Off, |
| 220 | pub sh_size: Elf64_Xword, |
| 221 | pub sh_link: Elf64_Word, |
| 222 | pub sh_info: Elf64_Word, |
| 223 | pub sh_addralign: Elf64_Xword, |
| 224 | pub sh_entsize: Elf64_Xword, |
| 225 | } |
| 226 | |
| 227 | pub struct __c_anonymous_elf32_rel { |
| 228 | pub r_offset: Elf32_Addr, |
| 229 | pub r_info: Elf32_Word, |
| 230 | } |
| 231 | |
| 232 | pub struct __c_anonymous_elf64_rel { |
| 233 | pub r_offset: Elf64_Addr, |
| 234 | pub r_info: Elf64_Xword, |
| 235 | } |
| 236 | |
| 237 | pub struct ucred { |
| 238 | pub pid: crate::pid_t, |
| 239 | pub uid: crate::uid_t, |
| 240 | pub gid: crate::gid_t, |
| 241 | } |
| 242 | |
| 243 | pub struct mntent { |
| 244 | pub mnt_fsname: *mut c_char, |
| 245 | pub mnt_dir: *mut c_char, |
| 246 | pub mnt_type: *mut c_char, |
| 247 | pub mnt_opts: *mut c_char, |
| 248 | pub mnt_freq: c_int, |
| 249 | pub mnt_passno: c_int, |
| 250 | } |
| 251 | |
| 252 | pub struct in6_pktinfo { |
| 253 | pub ipi6_addr: crate::in6_addr, |
| 254 | pub ipi6_ifindex: c_uint, |
| 255 | } |
| 256 | |
| 257 | pub struct arpd_request { |
| 258 | pub req: c_ushort, |
| 259 | pub ip: u32, |
| 260 | pub dev: c_ulong, |
| 261 | pub stamp: c_ulong, |
| 262 | pub updated: c_ulong, |
| 263 | pub ha: [c_uchar; crate::MAX_ADDR_LEN], |
| 264 | } |
| 265 | |
| 266 | pub struct regmatch_t { |
| 267 | pub rm_so: crate::regoff_t, |
| 268 | pub rm_eo: crate::regoff_t, |
| 269 | } |
| 270 | |
| 271 | pub struct option { |
| 272 | pub name: *const c_char, |
| 273 | pub has_arg: c_int, |
| 274 | pub flag: *mut c_int, |
| 275 | pub val: c_int, |
| 276 | } |
| 277 | |
| 278 | pub struct rlimit64 { |
| 279 | pub rlim_cur: crate::rlim64_t, |
| 280 | pub rlim_max: crate::rlim64_t, |
| 281 | } |
| 282 | |
| 283 | pub struct __c_anonymous_ifru_map { |
| 284 | pub mem_start: c_ulong, |
| 285 | pub mem_end: c_ulong, |
| 286 | pub base_addr: c_ushort, |
| 287 | pub irq: c_uchar, |
| 288 | pub dma: c_uchar, |
| 289 | pub port: c_uchar, |
| 290 | } |
| 291 | |
| 292 | pub struct dirent { |
| 293 | pub d_ino: crate::ino_t, |
| 294 | pub d_off: crate::off_t, |
| 295 | pub d_reclen: c_ushort, |
| 296 | pub d_type: c_uchar, |
| 297 | pub d_name: [c_char; 256], |
| 298 | } |
| 299 | |
| 300 | pub struct dirent64 { |
| 301 | pub d_ino: crate::ino64_t, |
| 302 | pub d_off: crate::off64_t, |
| 303 | pub d_reclen: c_ushort, |
| 304 | pub d_type: c_uchar, |
| 305 | pub d_name: [c_char; 256], |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | cfg_if! { |
| 310 | if #[cfg(not(target_arch = "sparc64"))] { |
| 311 | s! { |
| 312 | pub struct __c_anonymous_elf32_rela { |
| 313 | pub r_offset: crate::Elf32_Addr, |
| 314 | pub r_info: crate::Elf32_Word, |
| 315 | pub r_addend: crate::Elf32_Sword, |
| 316 | } |
| 317 | |
| 318 | pub struct __c_anonymous_elf64_rela { |
| 319 | pub r_offset: crate::Elf64_Addr, |
| 320 | pub r_info: crate::Elf64_Xword, |
| 321 | pub r_addend: crate::Elf64_Sxword, |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | s_no_extra_traits! { |
| 328 | pub union __c_anonymous_ifr_ifru { |
| 329 | pub ifru_addr: crate::sockaddr, |
| 330 | pub ifru_dstaddr: crate::sockaddr, |
| 331 | pub ifru_broadaddr: crate::sockaddr, |
| 332 | pub ifru_netmask: crate::sockaddr, |
| 333 | pub ifru_hwaddr: crate::sockaddr, |
| 334 | pub ifru_flags: c_short, |
| 335 | pub ifru_ifindex: c_int, |
| 336 | pub ifru_metric: c_int, |
| 337 | pub ifru_mtu: c_int, |
| 338 | pub ifru_map: __c_anonymous_ifru_map, |
| 339 | pub ifru_slave: [c_char; crate::IFNAMSIZ], |
| 340 | pub ifru_newname: [c_char; crate::IFNAMSIZ], |
| 341 | pub ifru_data: *mut c_char, |
| 342 | } |
| 343 | |
| 344 | pub struct ifreq { |
| 345 | /// interface name, e.g. "en0" |
| 346 | pub ifr_name: [c_char; crate::IFNAMSIZ], |
| 347 | pub ifr_ifru: __c_anonymous_ifr_ifru, |
| 348 | } |
| 349 | |
| 350 | pub union __c_anonymous_ifc_ifcu { |
| 351 | pub ifcu_buf: *mut c_char, |
| 352 | pub ifcu_req: *mut crate::ifreq, |
| 353 | } |
| 354 | |
| 355 | /// Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for |
| 356 | /// machine (useful for programs which must know all networks accessible). |
| 357 | pub struct ifconf { |
| 358 | /// Size of buffer |
| 359 | pub ifc_len: c_int, |
| 360 | pub ifc_ifcu: __c_anonymous_ifc_ifcu, |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | cfg_if! { |
| 365 | if #[cfg(not(target_env = "uclibc"))] { |
| 366 | const DATE_BASE: crate::nl_item = 0x20000; |
| 367 | } else { |
| 368 | const DATE_BASE: crate::nl_item = 768; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | pub const ABDAY_1: crate::nl_item = DATE_BASE; |
| 373 | pub const ABDAY_2: crate::nl_item = DATE_BASE + 0x1; |
| 374 | pub const ABDAY_3: crate::nl_item = DATE_BASE + 0x2; |
| 375 | pub const ABDAY_4: crate::nl_item = DATE_BASE + 0x3; |
| 376 | pub const ABDAY_5: crate::nl_item = DATE_BASE + 0x4; |
| 377 | pub const ABDAY_6: crate::nl_item = DATE_BASE + 0x5; |
| 378 | pub const ABDAY_7: crate::nl_item = DATE_BASE + 0x6; |
| 379 | |
| 380 | pub const DAY_1: crate::nl_item = DATE_BASE + 0x7; |
| 381 | pub const DAY_2: crate::nl_item = DATE_BASE + 0x8; |
| 382 | pub const DAY_3: crate::nl_item = DATE_BASE + 0x9; |
| 383 | pub const DAY_4: crate::nl_item = DATE_BASE + 0xA; |
| 384 | pub const DAY_5: crate::nl_item = DATE_BASE + 0xB; |
| 385 | pub const DAY_6: crate::nl_item = DATE_BASE + 0xC; |
| 386 | pub const DAY_7: crate::nl_item = DATE_BASE + 0xD; |
| 387 | |
| 388 | pub const ABMON_1: crate::nl_item = DATE_BASE + 0xE; |
| 389 | pub const ABMON_2: crate::nl_item = DATE_BASE + 0xF; |
| 390 | pub const ABMON_3: crate::nl_item = DATE_BASE + 0x10; |
| 391 | pub const ABMON_4: crate::nl_item = DATE_BASE + 0x11; |
| 392 | pub const ABMON_5: crate::nl_item = DATE_BASE + 0x12; |
| 393 | pub const ABMON_6: crate::nl_item = DATE_BASE + 0x13; |
| 394 | pub const ABMON_7: crate::nl_item = DATE_BASE + 0x14; |
| 395 | pub const ABMON_8: crate::nl_item = DATE_BASE + 0x15; |
| 396 | pub const ABMON_9: crate::nl_item = DATE_BASE + 0x16; |
| 397 | pub const ABMON_10: crate::nl_item = DATE_BASE + 0x17; |
| 398 | pub const ABMON_11: crate::nl_item = DATE_BASE + 0x18; |
| 399 | pub const ABMON_12: crate::nl_item = DATE_BASE + 0x19; |
| 400 | |
| 401 | pub const MON_1: crate::nl_item = DATE_BASE + 0x1A; |
| 402 | pub const MON_2: crate::nl_item = DATE_BASE + 0x1B; |
| 403 | pub const MON_3: crate::nl_item = DATE_BASE + 0x1C; |
| 404 | pub const MON_4: crate::nl_item = DATE_BASE + 0x1D; |
| 405 | pub const MON_5: crate::nl_item = DATE_BASE + 0x1E; |
| 406 | pub const MON_6: crate::nl_item = DATE_BASE + 0x1F; |
| 407 | pub const MON_7: crate::nl_item = DATE_BASE + 0x20; |
| 408 | pub const MON_8: crate::nl_item = DATE_BASE + 0x21; |
| 409 | pub const MON_9: crate::nl_item = DATE_BASE + 0x22; |
| 410 | pub const MON_10: crate::nl_item = DATE_BASE + 0x23; |
| 411 | pub const MON_11: crate::nl_item = DATE_BASE + 0x24; |
| 412 | pub const MON_12: crate::nl_item = DATE_BASE + 0x25; |
| 413 | |
| 414 | pub const AM_STR: crate::nl_item = DATE_BASE + 0x26; |
| 415 | pub const PM_STR: crate::nl_item = DATE_BASE + 0x27; |
| 416 | |
| 417 | pub const D_T_FMT: crate::nl_item = DATE_BASE + 0x28; |
| 418 | pub const D_FMT: crate::nl_item = DATE_BASE + 0x29; |
| 419 | pub const T_FMT: crate::nl_item = DATE_BASE + 0x2A; |
| 420 | pub const T_FMT_AMPM: crate::nl_item = DATE_BASE + 0x2B; |
| 421 | |
| 422 | pub const ERA: crate::nl_item = DATE_BASE + 0x2C; |
| 423 | pub const ERA_D_FMT: crate::nl_item = DATE_BASE + 0x2E; |
| 424 | pub const ALT_DIGITS: crate::nl_item = DATE_BASE + 0x2F; |
| 425 | pub const ERA_D_T_FMT: crate::nl_item = DATE_BASE + 0x30; |
| 426 | pub const ERA_T_FMT: crate::nl_item = DATE_BASE + 0x31; |
| 427 | |
| 428 | cfg_if! { |
| 429 | if #[cfg(any( |
| 430 | target_env = "gnu", |
| 431 | target_env = "musl", |
| 432 | target_env = "ohos" |
| 433 | ))] { |
| 434 | pub const CODESET: crate::nl_item = 14; |
| 435 | pub const CRNCYSTR: crate::nl_item = 0x4000F; |
| 436 | pub const RADIXCHAR: crate::nl_item = 0x10000; |
| 437 | pub const THOUSEP: crate::nl_item = 0x10001; |
| 438 | pub const YESEXPR: crate::nl_item = 0x50000; |
| 439 | pub const NOEXPR: crate::nl_item = 0x50001; |
| 440 | pub const YESSTR: crate::nl_item = 0x50002; |
| 441 | pub const NOSTR: crate::nl_item = 0x50003; |
| 442 | } else if #[cfg(target_env = "uclibc")] { |
| 443 | pub const CODESET: crate::nl_item = 10; |
| 444 | pub const CRNCYSTR: crate::nl_item = 0x215; |
| 445 | pub const RADIXCHAR: crate::nl_item = 0x100; |
| 446 | pub const THOUSEP: crate::nl_item = 0x101; |
| 447 | pub const YESEXPR: crate::nl_item = 0x500; |
| 448 | pub const NOEXPR: crate::nl_item = 0x501; |
| 449 | pub const YESSTR: crate::nl_item = 0x502; |
| 450 | pub const NOSTR: crate::nl_item = 0x503; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | pub const RUSAGE_CHILDREN: c_int = -1; |
| 455 | |
| 456 | pub const L_tmpnam: c_uint = 20; |
| 457 | pub const _PC_LINK_MAX: c_int = 0; |
| 458 | pub const _PC_MAX_CANON: c_int = 1; |
| 459 | pub const _PC_MAX_INPUT: c_int = 2; |
| 460 | pub const _PC_NAME_MAX: c_int = 3; |
| 461 | pub const _PC_PATH_MAX: c_int = 4; |
| 462 | pub const _PC_PIPE_BUF: c_int = 5; |
| 463 | pub const _PC_CHOWN_RESTRICTED: c_int = 6; |
| 464 | pub const _PC_NO_TRUNC: c_int = 7; |
| 465 | pub const _PC_VDISABLE: c_int = 8; |
| 466 | pub const _PC_SYNC_IO: c_int = 9; |
| 467 | pub const _PC_ASYNC_IO: c_int = 10; |
| 468 | pub const _PC_PRIO_IO: c_int = 11; |
| 469 | pub const _PC_SOCK_MAXBUF: c_int = 12; |
| 470 | pub const _PC_FILESIZEBITS: c_int = 13; |
| 471 | pub const _PC_REC_INCR_XFER_SIZE: c_int = 14; |
| 472 | pub const _PC_REC_MAX_XFER_SIZE: c_int = 15; |
| 473 | pub const _PC_REC_MIN_XFER_SIZE: c_int = 16; |
| 474 | pub const _PC_REC_XFER_ALIGN: c_int = 17; |
| 475 | pub const _PC_ALLOC_SIZE_MIN: c_int = 18; |
| 476 | pub const _PC_SYMLINK_MAX: c_int = 19; |
| 477 | pub const _PC_2_SYMLINKS: c_int = 20; |
| 478 | |
| 479 | pub const _SC_ARG_MAX: c_int = 0; |
| 480 | pub const _SC_CHILD_MAX: c_int = 1; |
| 481 | pub const _SC_CLK_TCK: c_int = 2; |
| 482 | pub const _SC_NGROUPS_MAX: c_int = 3; |
| 483 | pub const _SC_OPEN_MAX: c_int = 4; |
| 484 | pub const _SC_STREAM_MAX: c_int = 5; |
| 485 | pub const _SC_TZNAME_MAX: c_int = 6; |
| 486 | pub const _SC_JOB_CONTROL: c_int = 7; |
| 487 | pub const _SC_SAVED_IDS: c_int = 8; |
| 488 | pub const _SC_REALTIME_SIGNALS: c_int = 9; |
| 489 | pub const _SC_PRIORITY_SCHEDULING: c_int = 10; |
| 490 | pub const _SC_TIMERS: c_int = 11; |
| 491 | pub const _SC_ASYNCHRONOUS_IO: c_int = 12; |
| 492 | pub const _SC_PRIORITIZED_IO: c_int = 13; |
| 493 | pub const _SC_SYNCHRONIZED_IO: c_int = 14; |
| 494 | pub const _SC_FSYNC: c_int = 15; |
| 495 | pub const _SC_MAPPED_FILES: c_int = 16; |
| 496 | pub const _SC_MEMLOCK: c_int = 17; |
| 497 | pub const _SC_MEMLOCK_RANGE: c_int = 18; |
| 498 | pub const _SC_MEMORY_PROTECTION: c_int = 19; |
| 499 | pub const _SC_MESSAGE_PASSING: c_int = 20; |
| 500 | pub const _SC_SEMAPHORES: c_int = 21; |
| 501 | pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22; |
| 502 | pub const _SC_AIO_LISTIO_MAX: c_int = 23; |
| 503 | pub const _SC_AIO_MAX: c_int = 24; |
| 504 | pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25; |
| 505 | pub const _SC_DELAYTIMER_MAX: c_int = 26; |
| 506 | pub const _SC_MQ_OPEN_MAX: c_int = 27; |
| 507 | pub const _SC_MQ_PRIO_MAX: c_int = 28; |
| 508 | pub const _SC_VERSION: c_int = 29; |
| 509 | pub const _SC_PAGESIZE: c_int = 30; |
| 510 | pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE; |
| 511 | pub const _SC_RTSIG_MAX: c_int = 31; |
| 512 | pub const _SC_SEM_NSEMS_MAX: c_int = 32; |
| 513 | pub const _SC_SEM_VALUE_MAX: c_int = 33; |
| 514 | pub const _SC_SIGQUEUE_MAX: c_int = 34; |
| 515 | pub const _SC_TIMER_MAX: c_int = 35; |
| 516 | pub const _SC_BC_BASE_MAX: c_int = 36; |
| 517 | pub const _SC_BC_DIM_MAX: c_int = 37; |
| 518 | pub const _SC_BC_SCALE_MAX: c_int = 38; |
| 519 | pub const _SC_BC_STRING_MAX: c_int = 39; |
| 520 | pub const _SC_COLL_WEIGHTS_MAX: c_int = 40; |
| 521 | pub const _SC_EXPR_NEST_MAX: c_int = 42; |
| 522 | pub const _SC_LINE_MAX: c_int = 43; |
| 523 | pub const _SC_RE_DUP_MAX: c_int = 44; |
| 524 | pub const _SC_2_VERSION: c_int = 46; |
| 525 | pub const _SC_2_C_BIND: c_int = 47; |
| 526 | pub const _SC_2_C_DEV: c_int = 48; |
| 527 | pub const _SC_2_FORT_DEV: c_int = 49; |
| 528 | pub const _SC_2_FORT_RUN: c_int = 50; |
| 529 | pub const _SC_2_SW_DEV: c_int = 51; |
| 530 | pub const _SC_2_LOCALEDEF: c_int = 52; |
| 531 | pub const _SC_UIO_MAXIOV: c_int = 60; |
| 532 | pub const _SC_IOV_MAX: c_int = 60; |
| 533 | pub const _SC_THREADS: c_int = 67; |
| 534 | pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68; |
| 535 | pub const _SC_GETGR_R_SIZE_MAX: c_int = 69; |
| 536 | pub const _SC_GETPW_R_SIZE_MAX: c_int = 70; |
| 537 | pub const _SC_LOGIN_NAME_MAX: c_int = 71; |
| 538 | pub const _SC_TTY_NAME_MAX: c_int = 72; |
| 539 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73; |
| 540 | pub const _SC_THREAD_KEYS_MAX: c_int = 74; |
| 541 | pub const _SC_THREAD_STACK_MIN: c_int = 75; |
| 542 | pub const _SC_THREAD_THREADS_MAX: c_int = 76; |
| 543 | pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77; |
| 544 | pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78; |
| 545 | pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79; |
| 546 | pub const _SC_THREAD_PRIO_INHERIT: c_int = 80; |
| 547 | pub const _SC_THREAD_PRIO_PROTECT: c_int = 81; |
| 548 | pub const _SC_THREAD_PROCESS_SHARED: c_int = 82; |
| 549 | pub const _SC_NPROCESSORS_CONF: c_int = 83; |
| 550 | pub const _SC_NPROCESSORS_ONLN: c_int = 84; |
| 551 | pub const _SC_PHYS_PAGES: c_int = 85; |
| 552 | pub const _SC_AVPHYS_PAGES: c_int = 86; |
| 553 | pub const _SC_ATEXIT_MAX: c_int = 87; |
| 554 | pub const _SC_PASS_MAX: c_int = 88; |
| 555 | pub const _SC_XOPEN_VERSION: c_int = 89; |
| 556 | pub const _SC_XOPEN_XCU_VERSION: c_int = 90; |
| 557 | pub const _SC_XOPEN_UNIX: c_int = 91; |
| 558 | pub const _SC_XOPEN_CRYPT: c_int = 92; |
| 559 | pub const _SC_XOPEN_ENH_I18N: c_int = 93; |
| 560 | pub const _SC_XOPEN_SHM: c_int = 94; |
| 561 | pub const _SC_2_CHAR_TERM: c_int = 95; |
| 562 | pub const _SC_2_UPE: c_int = 97; |
| 563 | pub const _SC_XOPEN_XPG2: c_int = 98; |
| 564 | pub const _SC_XOPEN_XPG3: c_int = 99; |
| 565 | pub const _SC_XOPEN_XPG4: c_int = 100; |
| 566 | pub const _SC_NZERO: c_int = 109; |
| 567 | pub const _SC_XBS5_ILP32_OFF32: c_int = 125; |
| 568 | pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126; |
| 569 | pub const _SC_XBS5_LP64_OFF64: c_int = 127; |
| 570 | pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128; |
| 571 | pub const _SC_XOPEN_LEGACY: c_int = 129; |
| 572 | pub const _SC_XOPEN_REALTIME: c_int = 130; |
| 573 | pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131; |
| 574 | pub const _SC_ADVISORY_INFO: c_int = 132; |
| 575 | pub const _SC_BARRIERS: c_int = 133; |
| 576 | pub const _SC_CLOCK_SELECTION: c_int = 137; |
| 577 | pub const _SC_CPUTIME: c_int = 138; |
| 578 | pub const _SC_THREAD_CPUTIME: c_int = 139; |
| 579 | pub const _SC_MONOTONIC_CLOCK: c_int = 149; |
| 580 | pub const _SC_READER_WRITER_LOCKS: c_int = 153; |
| 581 | pub const _SC_SPIN_LOCKS: c_int = 154; |
| 582 | pub const _SC_REGEXP: c_int = 155; |
| 583 | pub const _SC_SHELL: c_int = 157; |
| 584 | pub const _SC_SPAWN: c_int = 159; |
| 585 | pub const _SC_SPORADIC_SERVER: c_int = 160; |
| 586 | pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161; |
| 587 | pub const _SC_TIMEOUTS: c_int = 164; |
| 588 | pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165; |
| 589 | pub const _SC_2_PBS: c_int = 168; |
| 590 | pub const _SC_2_PBS_ACCOUNTING: c_int = 169; |
| 591 | pub const _SC_2_PBS_LOCATE: c_int = 170; |
| 592 | pub const _SC_2_PBS_MESSAGE: c_int = 171; |
| 593 | pub const _SC_2_PBS_TRACK: c_int = 172; |
| 594 | pub const _SC_SYMLOOP_MAX: c_int = 173; |
| 595 | pub const _SC_STREAMS: c_int = 174; |
| 596 | pub const _SC_2_PBS_CHECKPOINT: c_int = 175; |
| 597 | pub const _SC_V6_ILP32_OFF32: c_int = 176; |
| 598 | pub const _SC_V6_ILP32_OFFBIG: c_int = 177; |
| 599 | pub const _SC_V6_LP64_OFF64: c_int = 178; |
| 600 | pub const _SC_V6_LPBIG_OFFBIG: c_int = 179; |
| 601 | pub const _SC_HOST_NAME_MAX: c_int = 180; |
| 602 | pub const _SC_TRACE: c_int = 181; |
| 603 | pub const _SC_TRACE_EVENT_FILTER: c_int = 182; |
| 604 | pub const _SC_TRACE_INHERIT: c_int = 183; |
| 605 | pub const _SC_TRACE_LOG: c_int = 184; |
| 606 | pub const _SC_IPV6: c_int = 235; |
| 607 | pub const _SC_RAW_SOCKETS: c_int = 236; |
| 608 | pub const _SC_V7_ILP32_OFF32: c_int = 237; |
| 609 | pub const _SC_V7_ILP32_OFFBIG: c_int = 238; |
| 610 | pub const _SC_V7_LP64_OFF64: c_int = 239; |
| 611 | pub const _SC_V7_LPBIG_OFFBIG: c_int = 240; |
| 612 | pub const _SC_SS_REPL_MAX: c_int = 241; |
| 613 | pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242; |
| 614 | pub const _SC_TRACE_NAME_MAX: c_int = 243; |
| 615 | pub const _SC_TRACE_SYS_MAX: c_int = 244; |
| 616 | pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245; |
| 617 | pub const _SC_XOPEN_STREAMS: c_int = 246; |
| 618 | pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247; |
| 619 | pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248; |
| 620 | |
| 621 | pub const _CS_PATH: c_int = 0; |
| 622 | pub const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: c_int = 1; |
| 623 | pub const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS: c_int = 4; |
| 624 | pub const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: c_int = 5; |
| 625 | pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: c_int = 1116; |
| 626 | pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: c_int = 1117; |
| 627 | pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: c_int = 1118; |
| 628 | pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: c_int = 1119; |
| 629 | pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: c_int = 1120; |
| 630 | pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: c_int = 1121; |
| 631 | pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: c_int = 1122; |
| 632 | pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: c_int = 1123; |
| 633 | pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: c_int = 1124; |
| 634 | pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: c_int = 1125; |
| 635 | pub const _CS_POSIX_V6_LP64_OFF64_LIBS: c_int = 1126; |
| 636 | pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: c_int = 1127; |
| 637 | pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: c_int = 1128; |
| 638 | pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: c_int = 1129; |
| 639 | pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: c_int = 1130; |
| 640 | pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: c_int = 1131; |
| 641 | pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: c_int = 1132; |
| 642 | pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: c_int = 1133; |
| 643 | pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: c_int = 1134; |
| 644 | pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: c_int = 1135; |
| 645 | pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: c_int = 1136; |
| 646 | pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: c_int = 1137; |
| 647 | pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: c_int = 1138; |
| 648 | pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: c_int = 1139; |
| 649 | pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: c_int = 1140; |
| 650 | pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: c_int = 1141; |
| 651 | pub const _CS_POSIX_V7_LP64_OFF64_LIBS: c_int = 1142; |
| 652 | pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: c_int = 1143; |
| 653 | pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: c_int = 1144; |
| 654 | pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: c_int = 1145; |
| 655 | pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: c_int = 1146; |
| 656 | pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: c_int = 1147; |
| 657 | |
| 658 | pub const RLIM_SAVED_MAX: crate::rlim_t = crate::RLIM_INFINITY; |
| 659 | pub const RLIM_SAVED_CUR: crate::rlim_t = crate::RLIM_INFINITY; |
| 660 | |
| 661 | // elf.h - Fields in the e_ident array. |
| 662 | pub const EI_NIDENT: usize = 16; |
| 663 | |
| 664 | pub const EI_MAG0: usize = 0; |
| 665 | pub const ELFMAG0: u8 = 0x7f; |
| 666 | pub const EI_MAG1: usize = 1; |
| 667 | pub const ELFMAG1: u8 = b'E'; |
| 668 | pub const EI_MAG2: usize = 2; |
| 669 | pub const ELFMAG2: u8 = b'L'; |
| 670 | pub const EI_MAG3: usize = 3; |
| 671 | pub const ELFMAG3: u8 = b'F'; |
| 672 | pub const SELFMAG: usize = 4; |
| 673 | |
| 674 | pub const EI_CLASS: usize = 4; |
| 675 | pub const ELFCLASSNONE: u8 = 0; |
| 676 | pub const ELFCLASS32: u8 = 1; |
| 677 | pub const ELFCLASS64: u8 = 2; |
| 678 | |
| 679 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 680 | /// for details. |
| 681 | pub const ELFCLASSNUM: usize = 3; |
| 682 | |
| 683 | pub const EI_DATA: usize = 5; |
| 684 | pub const ELFDATANONE: u8 = 0; |
| 685 | pub const ELFDATA2LSB: u8 = 1; |
| 686 | pub const ELFDATA2MSB: u8 = 2; |
| 687 | pub const ELFDATANUM: usize = 3; |
| 688 | |
| 689 | pub const EI_VERSION: usize = 6; |
| 690 | |
| 691 | pub const EI_OSABI: usize = 7; |
| 692 | pub const ELFOSABI_NONE: u8 = 0; |
| 693 | pub const ELFOSABI_SYSV: u8 = 0; |
| 694 | pub const ELFOSABI_HPUX: u8 = 1; |
| 695 | pub const ELFOSABI_NETBSD: u8 = 2; |
| 696 | pub const ELFOSABI_GNU: u8 = 3; |
| 697 | pub const ELFOSABI_LINUX: u8 = ELFOSABI_GNU; |
| 698 | pub const ELFOSABI_SOLARIS: u8 = 6; |
| 699 | pub const ELFOSABI_AIX: u8 = 7; |
| 700 | pub const ELFOSABI_IRIX: u8 = 8; |
| 701 | pub const ELFOSABI_FREEBSD: u8 = 9; |
| 702 | pub const ELFOSABI_TRU64: u8 = 10; |
| 703 | pub const ELFOSABI_MODESTO: u8 = 11; |
| 704 | pub const ELFOSABI_OPENBSD: u8 = 12; |
| 705 | pub const ELFOSABI_ARM: u8 = 97; |
| 706 | pub const ELFOSABI_STANDALONE: u8 = 255; |
| 707 | |
| 708 | pub const EI_ABIVERSION: usize = 8; |
| 709 | |
| 710 | pub const EI_PAD: usize = 9; |
| 711 | |
| 712 | // elf.h - Legal values for e_type (object file type). |
| 713 | pub const ET_NONE: u16 = 0; |
| 714 | pub const ET_REL: u16 = 1; |
| 715 | pub const ET_EXEC: u16 = 2; |
| 716 | pub const ET_DYN: u16 = 3; |
| 717 | pub const ET_CORE: u16 = 4; |
| 718 | pub const ET_NUM: u16 = 5; |
| 719 | pub const ET_LOOS: u16 = 0xfe00; |
| 720 | pub const ET_HIOS: u16 = 0xfeff; |
| 721 | pub const ET_LOPROC: u16 = 0xff00; |
| 722 | pub const ET_HIPROC: u16 = 0xffff; |
| 723 | |
| 724 | // elf.h - Legal values for e_machine (architecture). |
| 725 | pub const EM_NONE: u16 = 0; |
| 726 | pub const EM_M32: u16 = 1; |
| 727 | pub const EM_SPARC: u16 = 2; |
| 728 | pub const EM_386: u16 = 3; |
| 729 | pub const EM_68K: u16 = 4; |
| 730 | pub const EM_88K: u16 = 5; |
| 731 | pub const EM_860: u16 = 7; |
| 732 | pub const EM_MIPS: u16 = 8; |
| 733 | pub const EM_S370: u16 = 9; |
| 734 | pub const EM_MIPS_RS3_LE: u16 = 10; |
| 735 | pub const EM_PARISC: u16 = 15; |
| 736 | pub const EM_VPP500: u16 = 17; |
| 737 | pub const EM_SPARC32PLUS: u16 = 18; |
| 738 | pub const EM_960: u16 = 19; |
| 739 | pub const EM_PPC: u16 = 20; |
| 740 | pub const EM_PPC64: u16 = 21; |
| 741 | pub const EM_S390: u16 = 22; |
| 742 | pub const EM_V800: u16 = 36; |
| 743 | pub const EM_FR20: u16 = 37; |
| 744 | pub const EM_RH32: u16 = 38; |
| 745 | pub const EM_RCE: u16 = 39; |
| 746 | pub const EM_ARM: u16 = 40; |
| 747 | pub const EM_FAKE_ALPHA: u16 = 41; |
| 748 | pub const EM_SH: u16 = 42; |
| 749 | pub const EM_SPARCV9: u16 = 43; |
| 750 | pub const EM_TRICORE: u16 = 44; |
| 751 | pub const EM_ARC: u16 = 45; |
| 752 | pub const EM_H8_300: u16 = 46; |
| 753 | pub const EM_H8_300H: u16 = 47; |
| 754 | pub const EM_H8S: u16 = 48; |
| 755 | pub const EM_H8_500: u16 = 49; |
| 756 | pub const EM_IA_64: u16 = 50; |
| 757 | pub const EM_MIPS_X: u16 = 51; |
| 758 | pub const EM_COLDFIRE: u16 = 52; |
| 759 | pub const EM_68HC12: u16 = 53; |
| 760 | pub const EM_MMA: u16 = 54; |
| 761 | pub const EM_PCP: u16 = 55; |
| 762 | pub const EM_NCPU: u16 = 56; |
| 763 | pub const EM_NDR1: u16 = 57; |
| 764 | pub const EM_STARCORE: u16 = 58; |
| 765 | pub const EM_ME16: u16 = 59; |
| 766 | pub const EM_ST100: u16 = 60; |
| 767 | pub const EM_TINYJ: u16 = 61; |
| 768 | pub const EM_X86_64: u16 = 62; |
| 769 | pub const EM_PDSP: u16 = 63; |
| 770 | pub const EM_FX66: u16 = 66; |
| 771 | pub const EM_ST9PLUS: u16 = 67; |
| 772 | pub const EM_ST7: u16 = 68; |
| 773 | pub const EM_68HC16: u16 = 69; |
| 774 | pub const EM_68HC11: u16 = 70; |
| 775 | pub const EM_68HC08: u16 = 71; |
| 776 | pub const EM_68HC05: u16 = 72; |
| 777 | pub const EM_SVX: u16 = 73; |
| 778 | pub const EM_ST19: u16 = 74; |
| 779 | pub const EM_VAX: u16 = 75; |
| 780 | pub const EM_CRIS: u16 = 76; |
| 781 | pub const EM_JAVELIN: u16 = 77; |
| 782 | pub const EM_FIREPATH: u16 = 78; |
| 783 | pub const EM_ZSP: u16 = 79; |
| 784 | pub const EM_MMIX: u16 = 80; |
| 785 | pub const EM_HUANY: u16 = 81; |
| 786 | pub const EM_PRISM: u16 = 82; |
| 787 | pub const EM_AVR: u16 = 83; |
| 788 | pub const EM_FR30: u16 = 84; |
| 789 | pub const EM_D10V: u16 = 85; |
| 790 | pub const EM_D30V: u16 = 86; |
| 791 | pub const EM_V850: u16 = 87; |
| 792 | pub const EM_M32R: u16 = 88; |
| 793 | pub const EM_MN10300: u16 = 89; |
| 794 | pub const EM_MN10200: u16 = 90; |
| 795 | pub const EM_PJ: u16 = 91; |
| 796 | #[cfg(not(target_env = "uclibc"))] |
| 797 | pub const EM_OPENRISC: u16 = 92; |
| 798 | #[cfg(target_env = "uclibc")] |
| 799 | pub const EM_OR1K: u16 = 92; |
| 800 | pub const EM_ARC_A5: u16 = 93; |
| 801 | pub const EM_XTENSA: u16 = 94; |
| 802 | pub const EM_AARCH64: u16 = 183; |
| 803 | pub const EM_TILEPRO: u16 = 188; |
| 804 | pub const EM_TILEGX: u16 = 191; |
| 805 | pub const EM_RISCV: u16 = 243; |
| 806 | pub const EM_ALPHA: u16 = 0x9026; |
| 807 | |
| 808 | // elf.h - Legal values for e_version (version). |
| 809 | pub const EV_NONE: u32 = 0; |
| 810 | pub const EV_CURRENT: u32 = 1; |
| 811 | |
| 812 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 813 | /// for details. |
| 814 | pub const EV_NUM: u32 = 2; |
| 815 | |
| 816 | // elf.h - Legal values for p_type (segment type). |
| 817 | pub const PT_NULL: u32 = 0; |
| 818 | pub const PT_LOAD: u32 = 1; |
| 819 | pub const PT_DYNAMIC: u32 = 2; |
| 820 | pub const PT_INTERP: u32 = 3; |
| 821 | pub const PT_NOTE: u32 = 4; |
| 822 | pub const PT_SHLIB: u32 = 5; |
| 823 | pub const PT_PHDR: u32 = 6; |
| 824 | pub const PT_TLS: u32 = 7; |
| 825 | pub const PT_NUM: u32 = 8; |
| 826 | pub const PT_LOOS: u32 = 0x60000000; |
| 827 | pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; |
| 828 | pub const PT_GNU_STACK: u32 = 0x6474e551; |
| 829 | pub const PT_GNU_RELRO: u32 = 0x6474e552; |
| 830 | pub const PT_LOSUNW: u32 = 0x6ffffffa; |
| 831 | pub const PT_SUNWBSS: u32 = 0x6ffffffa; |
| 832 | pub const PT_SUNWSTACK: u32 = 0x6ffffffb; |
| 833 | pub const PT_HISUNW: u32 = 0x6fffffff; |
| 834 | pub const PT_HIOS: u32 = 0x6fffffff; |
| 835 | pub const PT_LOPROC: u32 = 0x70000000; |
| 836 | pub const PT_HIPROC: u32 = 0x7fffffff; |
| 837 | |
| 838 | // Legal values for p_flags (segment flags). |
| 839 | pub const PF_X: u32 = 1 << 0; |
| 840 | pub const PF_W: u32 = 1 << 1; |
| 841 | pub const PF_R: u32 = 1 << 2; |
| 842 | pub const PF_MASKOS: u32 = 0x0ff00000; |
| 843 | pub const PF_MASKPROC: u32 = 0xf0000000; |
| 844 | |
| 845 | // elf.h - Legal values for a_type (entry type). |
| 846 | pub const AT_NULL: c_ulong = 0; |
| 847 | pub const AT_IGNORE: c_ulong = 1; |
| 848 | pub const AT_EXECFD: c_ulong = 2; |
| 849 | pub const AT_PHDR: c_ulong = 3; |
| 850 | pub const AT_PHENT: c_ulong = 4; |
| 851 | pub const AT_PHNUM: c_ulong = 5; |
| 852 | pub const AT_PAGESZ: c_ulong = 6; |
| 853 | pub const AT_BASE: c_ulong = 7; |
| 854 | pub const AT_FLAGS: c_ulong = 8; |
| 855 | pub const AT_ENTRY: c_ulong = 9; |
| 856 | pub const AT_NOTELF: c_ulong = 10; |
| 857 | pub const AT_UID: c_ulong = 11; |
| 858 | pub const AT_EUID: c_ulong = 12; |
| 859 | pub const AT_GID: c_ulong = 13; |
| 860 | pub const AT_EGID: c_ulong = 14; |
| 861 | pub const AT_PLATFORM: c_ulong = 15; |
| 862 | pub const AT_HWCAP: c_ulong = 16; |
| 863 | pub const AT_CLKTCK: c_ulong = 17; |
| 864 | |
| 865 | pub const AT_SECURE: c_ulong = 23; |
| 866 | pub const AT_BASE_PLATFORM: c_ulong = 24; |
| 867 | pub const AT_RANDOM: c_ulong = 25; |
| 868 | pub const AT_HWCAP2: c_ulong = 26; |
| 869 | |
| 870 | pub const AT_HWCAP3: c_ulong = 29; |
| 871 | pub const AT_HWCAP4: c_ulong = 30; |
| 872 | pub const AT_EXECFN: c_ulong = 31; |
| 873 | |
| 874 | // defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value |
| 875 | // wherever it is defined. |
| 876 | pub const AT_SYSINFO_EHDR: c_ulong = 33; |
| 877 | #[cfg(not(target_env = "uclibc"))] |
| 878 | pub const AT_MINSIGSTKSZ: c_ulong = 51; |
| 879 | |
| 880 | pub const GLOB_ERR: c_int = 1 << 0; |
| 881 | pub const GLOB_MARK: c_int = 1 << 1; |
| 882 | pub const GLOB_NOSORT: c_int = 1 << 2; |
| 883 | pub const GLOB_DOOFFS: c_int = 1 << 3; |
| 884 | pub const GLOB_NOCHECK: c_int = 1 << 4; |
| 885 | pub const GLOB_APPEND: c_int = 1 << 5; |
| 886 | pub const GLOB_NOESCAPE: c_int = 1 << 6; |
| 887 | |
| 888 | pub const GLOB_NOSPACE: c_int = 1; |
| 889 | pub const GLOB_ABORTED: c_int = 2; |
| 890 | pub const GLOB_NOMATCH: c_int = 3; |
| 891 | |
| 892 | pub const POSIX_MADV_NORMAL: c_int = 0; |
| 893 | pub const POSIX_MADV_RANDOM: c_int = 1; |
| 894 | pub const POSIX_MADV_SEQUENTIAL: c_int = 2; |
| 895 | pub const POSIX_MADV_WILLNEED: c_int = 3; |
| 896 | pub const POSIX_MADV_DONTNEED: c_int = 4; |
| 897 | |
| 898 | pub const S_IEXEC: crate::mode_t = 0o0100; |
| 899 | pub const S_IWRITE: crate::mode_t = 0o0200; |
| 900 | pub const S_IREAD: crate::mode_t = 0o0400; |
| 901 | |
| 902 | pub const F_LOCK: c_int = 1; |
| 903 | pub const F_TEST: c_int = 3; |
| 904 | pub const F_TLOCK: c_int = 2; |
| 905 | pub const F_ULOCK: c_int = 0; |
| 906 | |
| 907 | pub const ST_RDONLY: c_ulong = 1; |
| 908 | pub const ST_NOSUID: c_ulong = 2; |
| 909 | pub const ST_NODEV: c_ulong = 4; |
| 910 | pub const ST_NOEXEC: c_ulong = 8; |
| 911 | pub const ST_SYNCHRONOUS: c_ulong = 16; |
| 912 | pub const ST_MANDLOCK: c_ulong = 64; |
| 913 | pub const ST_WRITE: c_ulong = 128; |
| 914 | pub const ST_APPEND: c_ulong = 256; |
| 915 | pub const ST_IMMUTABLE: c_ulong = 512; |
| 916 | pub const ST_NOATIME: c_ulong = 1024; |
| 917 | pub const ST_NODIRATIME: c_ulong = 2048; |
| 918 | |
| 919 | pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void; |
| 920 | pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); |
| 921 | pub const RTLD_NODELETE: c_int = 0x1000; |
| 922 | pub const RTLD_NOW: c_int = 0x2; |
| 923 | |
| 924 | pub const AT_EACCESS: c_int = 0x200; |
| 925 | |
| 926 | pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1; |
| 927 | pub const PTHREAD_ONCE_INIT: crate::pthread_once_t = 0; |
| 928 | pub const PTHREAD_MUTEX_NORMAL: c_int = 0; |
| 929 | pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1; |
| 930 | pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; |
| 931 | pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; |
| 932 | #[cfg(not(target_os = "l4re"))] |
| 933 | pub const PTHREAD_MUTEX_STALLED: c_int = 0; |
| 934 | #[cfg(not(target_os = "l4re"))] |
| 935 | pub const PTHREAD_MUTEX_ROBUST: c_int = 1; |
| 936 | pub const PTHREAD_PRIO_NONE: c_int = 0; |
| 937 | pub const PTHREAD_PRIO_INHERIT: c_int = 1; |
| 938 | pub const PTHREAD_PRIO_PROTECT: c_int = 2; |
| 939 | pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; |
| 940 | pub const PTHREAD_PROCESS_SHARED: c_int = 1; |
| 941 | pub const PTHREAD_INHERIT_SCHED: c_int = 0; |
| 942 | pub const PTHREAD_EXPLICIT_SCHED: c_int = 1; |
| 943 | #[cfg(not(target_os = "l4re"))] |
| 944 | pub const __SIZEOF_PTHREAD_COND_T: usize = 48; |
| 945 | |
| 946 | // netinet/in.h |
| 947 | // NOTE: These are in addition to the constants defined in src/unix/mod.rs |
| 948 | |
| 949 | #[deprecated( |
| 950 | since = "0.2.80", |
| 951 | note = "This value was increased in the newer kernel \ |
| 952 | and we'll change this following upstream in the future release. \ |
| 953 | See #1896 for more info." |
| 954 | )] |
| 955 | pub const IPPROTO_MAX: c_int = 256; |
| 956 | |
| 957 | // System V IPC |
| 958 | pub const IPC_PRIVATE: crate::key_t = 0; |
| 959 | |
| 960 | pub const IPC_CREAT: c_int = 0o1000; |
| 961 | pub const IPC_EXCL: c_int = 0o2000; |
| 962 | pub const IPC_NOWAIT: c_int = 0o4000; |
| 963 | |
| 964 | pub const IPC_RMID: c_int = 0; |
| 965 | pub const IPC_SET: c_int = 1; |
| 966 | pub const IPC_STAT: c_int = if cfg!(musl_redir_time64) { 0x102 } else { 2 }; |
| 967 | pub const IPC_INFO: c_int = 3; |
| 968 | |
| 969 | pub const SHM_R: c_int = 0o400; |
| 970 | pub const SHM_W: c_int = 0o200; |
| 971 | |
| 972 | pub const SHM_RDONLY: c_int = 0o10000; |
| 973 | pub const SHM_RND: c_int = 0o20000; |
| 974 | pub const SHM_REMAP: c_int = 0o40000; |
| 975 | pub const SHM_LOCK: c_int = 11; |
| 976 | pub const SHM_UNLOCK: c_int = 12; |
| 977 | pub const SHM_HUGETLB: c_int = 0o4000; |
| 978 | #[cfg(not(all(target_env = "uclibc", target_arch = "mips")))] |
| 979 | pub const SHM_NORESERVE: c_int = 0o10000; |
| 980 | |
| 981 | pub const LOG_NFACILITIES: c_int = 24; |
| 982 | |
| 983 | pub const SEM_FAILED: *mut crate::sem_t = ptr::null_mut(); |
| 984 | |
| 985 | pub const AI_PASSIVE: c_int = 0x0001; |
| 986 | pub const AI_CANONNAME: c_int = 0x0002; |
| 987 | pub const AI_NUMERICHOST: c_int = 0x0004; |
| 988 | pub const AI_V4MAPPED: c_int = 0x0008; |
| 989 | pub const AI_ALL: c_int = 0x0010; |
| 990 | pub const AI_ADDRCONFIG: c_int = 0x0020; |
| 991 | |
| 992 | pub const AI_NUMERICSERV: c_int = 0x0400; |
| 993 | |
| 994 | pub const EAI_BADFLAGS: c_int = -1; |
| 995 | pub const EAI_NONAME: c_int = -2; |
| 996 | pub const EAI_AGAIN: c_int = -3; |
| 997 | pub const EAI_FAIL: c_int = -4; |
| 998 | pub const EAI_NODATA: c_int = -5; |
| 999 | pub const EAI_FAMILY: c_int = -6; |
| 1000 | pub const EAI_SOCKTYPE: c_int = -7; |
| 1001 | pub const EAI_SERVICE: c_int = -8; |
| 1002 | pub const EAI_MEMORY: c_int = -10; |
| 1003 | pub const EAI_SYSTEM: c_int = -11; |
| 1004 | pub const EAI_OVERFLOW: c_int = -12; |
| 1005 | |
| 1006 | pub const NI_NUMERICHOST: c_int = 1; |
| 1007 | pub const NI_NUMERICSERV: c_int = 2; |
| 1008 | pub const NI_NOFQDN: c_int = 4; |
| 1009 | pub const NI_NAMEREQD: c_int = 8; |
| 1010 | pub const NI_DGRAM: c_int = 16; |
| 1011 | #[cfg(not(target_env = "uclibc"))] |
| 1012 | pub const NI_IDN: c_int = 32; |
| 1013 | |
| 1014 | cfg_if! { |
| 1015 | if #[cfg(not(target_env = "uclibc"))] { |
| 1016 | pub const AIO_CANCELED: c_int = 0; |
| 1017 | pub const AIO_NOTCANCELED: c_int = 1; |
| 1018 | pub const AIO_ALLDONE: c_int = 2; |
| 1019 | pub const LIO_READ: c_int = 0; |
| 1020 | pub const LIO_WRITE: c_int = 1; |
| 1021 | pub const LIO_NOP: c_int = 2; |
| 1022 | pub const LIO_WAIT: c_int = 0; |
| 1023 | pub const LIO_NOWAIT: c_int = 1; |
| 1024 | pub const RUSAGE_THREAD: c_int = 1; |
| 1025 | pub const MSG_COPY: c_int = 0o40000; |
| 1026 | pub const SHM_EXEC: c_int = 0o100000; |
| 1027 | pub const IPV6_MULTICAST_ALL: c_int = 29; |
| 1028 | pub const IPV6_ROUTER_ALERT_ISOLATE: c_int = 30; |
| 1029 | pub const PACKET_MR_UNICAST: c_int = 3; |
| 1030 | pub const PTRACE_EVENT_STOP: c_int = 128; |
| 1031 | pub const UDP_SEGMENT: c_int = 103; |
| 1032 | pub const UDP_GRO: c_int = 104; |
| 1033 | } |
| 1034 | } |
| 1035 | |
| 1036 | pub const PR_SET_PDEATHSIG: c_int = 1; |
| 1037 | pub const PR_GET_PDEATHSIG: c_int = 2; |
| 1038 | |
| 1039 | pub const PR_GET_DUMPABLE: c_int = 3; |
| 1040 | pub const PR_SET_DUMPABLE: c_int = 4; |
| 1041 | |
| 1042 | pub const PR_GET_UNALIGN: c_int = 5; |
| 1043 | pub const PR_SET_UNALIGN: c_int = 6; |
| 1044 | pub const PR_UNALIGN_NOPRINT: c_int = 1; |
| 1045 | pub const PR_UNALIGN_SIGBUS: c_int = 2; |
| 1046 | |
| 1047 | pub const PR_GET_KEEPCAPS: c_int = 7; |
| 1048 | pub const PR_SET_KEEPCAPS: c_int = 8; |
| 1049 | |
| 1050 | pub const PR_GET_FPEMU: c_int = 9; |
| 1051 | pub const PR_SET_FPEMU: c_int = 10; |
| 1052 | pub const PR_FPEMU_NOPRINT: c_int = 1; |
| 1053 | pub const PR_FPEMU_SIGFPE: c_int = 2; |
| 1054 | |
| 1055 | pub const PR_GET_FPEXC: c_int = 11; |
| 1056 | pub const PR_SET_FPEXC: c_int = 12; |
| 1057 | pub const PR_FP_EXC_SW_ENABLE: c_int = 0x80; |
| 1058 | pub const PR_FP_EXC_DIV: c_int = 0x010000; |
| 1059 | pub const PR_FP_EXC_OVF: c_int = 0x020000; |
| 1060 | pub const PR_FP_EXC_UND: c_int = 0x040000; |
| 1061 | pub const PR_FP_EXC_RES: c_int = 0x080000; |
| 1062 | pub const PR_FP_EXC_INV: c_int = 0x100000; |
| 1063 | pub const PR_FP_EXC_DISABLED: c_int = 0; |
| 1064 | pub const PR_FP_EXC_NONRECOV: c_int = 1; |
| 1065 | pub const PR_FP_EXC_ASYNC: c_int = 2; |
| 1066 | pub const PR_FP_EXC_PRECISE: c_int = 3; |
| 1067 | |
| 1068 | pub const PR_GET_TIMING: c_int = 13; |
| 1069 | pub const PR_SET_TIMING: c_int = 14; |
| 1070 | pub const PR_TIMING_STATISTICAL: c_int = 0; |
| 1071 | pub const PR_TIMING_TIMESTAMP: c_int = 1; |
| 1072 | |
| 1073 | pub const PR_SET_NAME: c_int = 15; |
| 1074 | pub const PR_GET_NAME: c_int = 16; |
| 1075 | |
| 1076 | pub const PR_GET_ENDIAN: c_int = 19; |
| 1077 | pub const PR_SET_ENDIAN: c_int = 20; |
| 1078 | pub const PR_ENDIAN_BIG: c_int = 0; |
| 1079 | pub const PR_ENDIAN_LITTLE: c_int = 1; |
| 1080 | pub const PR_ENDIAN_PPC_LITTLE: c_int = 2; |
| 1081 | |
| 1082 | pub const PR_GET_SECCOMP: c_int = 21; |
| 1083 | pub const PR_SET_SECCOMP: c_int = 22; |
| 1084 | |
| 1085 | pub const PR_CAPBSET_READ: c_int = 23; |
| 1086 | pub const PR_CAPBSET_DROP: c_int = 24; |
| 1087 | |
| 1088 | pub const PR_GET_TSC: c_int = 25; |
| 1089 | pub const PR_SET_TSC: c_int = 26; |
| 1090 | pub const PR_TSC_ENABLE: c_int = 1; |
| 1091 | pub const PR_TSC_SIGSEGV: c_int = 2; |
| 1092 | |
| 1093 | pub const PR_GET_SECUREBITS: c_int = 27; |
| 1094 | pub const PR_SET_SECUREBITS: c_int = 28; |
| 1095 | |
| 1096 | pub const PR_SET_TIMERSLACK: c_int = 29; |
| 1097 | pub const PR_GET_TIMERSLACK: c_int = 30; |
| 1098 | |
| 1099 | pub const PR_TASK_PERF_EVENTS_DISABLE: c_int = 31; |
| 1100 | pub const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32; |
| 1101 | |
| 1102 | pub const PR_MCE_KILL: c_int = 33; |
| 1103 | pub const PR_MCE_KILL_CLEAR: c_int = 0; |
| 1104 | pub const PR_MCE_KILL_SET: c_int = 1; |
| 1105 | |
| 1106 | pub const PR_MCE_KILL_LATE: c_int = 0; |
| 1107 | pub const PR_MCE_KILL_EARLY: c_int = 1; |
| 1108 | pub const PR_MCE_KILL_DEFAULT: c_int = 2; |
| 1109 | |
| 1110 | pub const PR_MCE_KILL_GET: c_int = 34; |
| 1111 | |
| 1112 | pub const PR_SET_MM: c_int = 35; |
| 1113 | pub const PR_SET_MM_START_CODE: c_int = 1; |
| 1114 | pub const PR_SET_MM_END_CODE: c_int = 2; |
| 1115 | pub const PR_SET_MM_START_DATA: c_int = 3; |
| 1116 | pub const PR_SET_MM_END_DATA: c_int = 4; |
| 1117 | pub const PR_SET_MM_START_STACK: c_int = 5; |
| 1118 | pub const PR_SET_MM_START_BRK: c_int = 6; |
| 1119 | pub const PR_SET_MM_BRK: c_int = 7; |
| 1120 | pub const PR_SET_MM_ARG_START: c_int = 8; |
| 1121 | pub const PR_SET_MM_ARG_END: c_int = 9; |
| 1122 | pub const PR_SET_MM_ENV_START: c_int = 10; |
| 1123 | pub const PR_SET_MM_ENV_END: c_int = 11; |
| 1124 | pub const PR_SET_MM_AUXV: c_int = 12; |
| 1125 | pub const PR_SET_MM_EXE_FILE: c_int = 13; |
| 1126 | pub const PR_SET_MM_MAP: c_int = 14; |
| 1127 | pub const PR_SET_MM_MAP_SIZE: c_int = 15; |
| 1128 | |
| 1129 | pub const PR_SET_PTRACER: c_int = 0x59616d61; |
| 1130 | pub const PR_SET_PTRACER_ANY: c_ulong = (-1 as c_long) as c_ulong; |
| 1131 | |
| 1132 | pub const PR_SET_CHILD_SUBREAPER: c_int = 36; |
| 1133 | pub const PR_GET_CHILD_SUBREAPER: c_int = 37; |
| 1134 | |
| 1135 | pub const PR_SET_NO_NEW_PRIVS: c_int = 38; |
| 1136 | pub const PR_GET_NO_NEW_PRIVS: c_int = 39; |
| 1137 | |
| 1138 | pub const PR_GET_TID_ADDRESS: c_int = 40; |
| 1139 | |
| 1140 | pub const PR_SET_THP_DISABLE: c_int = 41; |
| 1141 | pub const PR_GET_THP_DISABLE: c_int = 42; |
| 1142 | |
| 1143 | pub const PR_MPX_ENABLE_MANAGEMENT: c_int = 43; |
| 1144 | pub const PR_MPX_DISABLE_MANAGEMENT: c_int = 44; |
| 1145 | |
| 1146 | pub const PR_SET_FP_MODE: c_int = 45; |
| 1147 | pub const PR_GET_FP_MODE: c_int = 46; |
| 1148 | pub const PR_FP_MODE_FR: c_int = 1 << 0; |
| 1149 | pub const PR_FP_MODE_FRE: c_int = 1 << 1; |
| 1150 | |
| 1151 | pub const PR_CAP_AMBIENT: c_int = 47; |
| 1152 | pub const PR_CAP_AMBIENT_IS_SET: c_int = 1; |
| 1153 | pub const PR_CAP_AMBIENT_RAISE: c_int = 2; |
| 1154 | pub const PR_CAP_AMBIENT_LOWER: c_int = 3; |
| 1155 | pub const PR_CAP_AMBIENT_CLEAR_ALL: c_int = 4; |
| 1156 | |
| 1157 | pub const PR_SET_VMA: c_int = 0x53564d41; |
| 1158 | pub const PR_SET_VMA_ANON_NAME: c_int = 0; |
| 1159 | |
| 1160 | pub const PR_SCHED_CORE: c_int = 62; |
| 1161 | pub const PR_SCHED_CORE_GET: c_int = 0; |
| 1162 | pub const PR_SCHED_CORE_CREATE: c_int = 1; |
| 1163 | pub const PR_SCHED_CORE_SHARE_TO: c_int = 2; |
| 1164 | pub const PR_SCHED_CORE_SHARE_FROM: c_int = 3; |
| 1165 | |
| 1166 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1167 | /// for details. |
| 1168 | pub const PR_SCHED_CORE_MAX: c_int = 4; |
| 1169 | |
| 1170 | pub const PR_SCHED_CORE_SCOPE_THREAD: c_int = 0; |
| 1171 | pub const PR_SCHED_CORE_SCOPE_THREAD_GROUP: c_int = 1; |
| 1172 | pub const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: c_int = 2; |
| 1173 | |
| 1174 | pub const ITIMER_REAL: c_int = 0; |
| 1175 | pub const ITIMER_VIRTUAL: c_int = 1; |
| 1176 | pub const ITIMER_PROF: c_int = 2; |
| 1177 | |
| 1178 | pub const _POSIX_VDISABLE: crate::cc_t = 0; |
| 1179 | |
| 1180 | pub const IPV6_RTHDR_LOOSE: c_int = 0; |
| 1181 | pub const IPV6_RTHDR_STRICT: c_int = 1; |
| 1182 | |
| 1183 | pub const IUTF8: crate::tcflag_t = 0x00004000; |
| 1184 | #[cfg(not(all(target_env = "uclibc", target_arch = "mips")))] |
| 1185 | pub const CMSPAR: crate::tcflag_t = 0o10000000000; |
| 1186 | |
| 1187 | cfg_if! { |
| 1188 | if #[cfg(not(target_os = "l4re"))] { |
| 1189 | pub const MFD_CLOEXEC: c_uint = 0x0001; |
| 1190 | pub const MFD_ALLOW_SEALING: c_uint = 0x0002; |
| 1191 | pub const MFD_HUGETLB: c_uint = 0x0004; |
| 1192 | pub const MFD_NOEXEC_SEAL: c_uint = 0x0008; |
| 1193 | pub const MFD_EXEC: c_uint = 0x0010; |
| 1194 | pub const MFD_HUGE_64KB: c_uint = 0x40000000; |
| 1195 | pub const MFD_HUGE_512KB: c_uint = 0x4c000000; |
| 1196 | pub const MFD_HUGE_1MB: c_uint = 0x50000000; |
| 1197 | pub const MFD_HUGE_2MB: c_uint = 0x54000000; |
| 1198 | pub const MFD_HUGE_8MB: c_uint = 0x5c000000; |
| 1199 | pub const MFD_HUGE_16MB: c_uint = 0x60000000; |
| 1200 | pub const MFD_HUGE_32MB: c_uint = 0x64000000; |
| 1201 | pub const MFD_HUGE_256MB: c_uint = 0x70000000; |
| 1202 | pub const MFD_HUGE_512MB: c_uint = 0x74000000; |
| 1203 | pub const MFD_HUGE_1GB: c_uint = 0x78000000; |
| 1204 | pub const MFD_HUGE_2GB: c_uint = 0x7c000000; |
| 1205 | pub const MFD_HUGE_16GB: c_uint = 0x88000000; |
| 1206 | pub const MFD_HUGE_MASK: c_uint = 63; |
| 1207 | pub const MFD_HUGE_SHIFT: c_uint = 26; |
| 1208 | } |
| 1209 | } |
| 1210 | |
| 1211 | pub const SIOCADDRT: c_ulong = 0x0000890B; |
| 1212 | pub const SIOCDELRT: c_ulong = 0x0000890C; |
| 1213 | pub const SIOCGIFNAME: c_ulong = 0x00008910; |
| 1214 | pub const SIOCSIFLINK: c_ulong = 0x00008911; |
| 1215 | pub const SIOCGIFCONF: c_ulong = 0x00008912; |
| 1216 | pub const SIOCGIFFLAGS: c_ulong = 0x00008913; |
| 1217 | pub const SIOCSIFFLAGS: c_ulong = 0x00008914; |
| 1218 | pub const SIOCGIFADDR: c_ulong = 0x00008915; |
| 1219 | pub const SIOCSIFADDR: c_ulong = 0x00008916; |
| 1220 | pub const SIOCGIFDSTADDR: c_ulong = 0x00008917; |
| 1221 | pub const SIOCSIFDSTADDR: c_ulong = 0x00008918; |
| 1222 | pub const SIOCGIFBRDADDR: c_ulong = 0x00008919; |
| 1223 | pub const SIOCSIFBRDADDR: c_ulong = 0x0000891A; |
| 1224 | pub const SIOCGIFNETMASK: c_ulong = 0x0000891B; |
| 1225 | pub const SIOCSIFNETMASK: c_ulong = 0x0000891C; |
| 1226 | pub const SIOCGIFMETRIC: c_ulong = 0x0000891D; |
| 1227 | pub const SIOCSIFMETRIC: c_ulong = 0x0000891E; |
| 1228 | pub const SIOCGIFMEM: c_ulong = 0x0000891F; |
| 1229 | pub const SIOCSIFMEM: c_ulong = 0x00008920; |
| 1230 | pub const SIOCGIFMTU: c_ulong = 0x00008921; |
| 1231 | pub const SIOCSIFMTU: c_ulong = 0x00008922; |
| 1232 | pub const SIOCSIFNAME: c_ulong = 0x00008923; |
| 1233 | pub const SIOCSIFHWADDR: c_ulong = 0x00008924; |
| 1234 | pub const SIOCGIFENCAP: c_ulong = 0x00008925; |
| 1235 | pub const SIOCSIFENCAP: c_ulong = 0x00008926; |
| 1236 | pub const SIOCGIFHWADDR: c_ulong = 0x00008927; |
| 1237 | pub const SIOCGIFSLAVE: c_ulong = 0x00008929; |
| 1238 | pub const SIOCSIFSLAVE: c_ulong = 0x00008930; |
| 1239 | pub const SIOCADDMULTI: c_ulong = 0x00008931; |
| 1240 | pub const SIOCDELMULTI: c_ulong = 0x00008932; |
| 1241 | pub const SIOCGIFINDEX: c_ulong = 0x00008933; |
| 1242 | pub const SIOGIFINDEX: c_ulong = SIOCGIFINDEX; |
| 1243 | pub const SIOCSIFPFLAGS: c_ulong = 0x00008934; |
| 1244 | pub const SIOCGIFPFLAGS: c_ulong = 0x00008935; |
| 1245 | pub const SIOCDIFADDR: c_ulong = 0x00008936; |
| 1246 | pub const SIOCSIFHWBROADCAST: c_ulong = 0x00008937; |
| 1247 | pub const SIOCGIFCOUNT: c_ulong = 0x00008938; |
| 1248 | pub const SIOCGIFBR: c_ulong = 0x00008940; |
| 1249 | pub const SIOCSIFBR: c_ulong = 0x00008941; |
| 1250 | pub const SIOCGIFTXQLEN: c_ulong = 0x00008942; |
| 1251 | pub const SIOCSIFTXQLEN: c_ulong = 0x00008943; |
| 1252 | cfg_if! { |
| 1253 | if #[cfg(not(target_os = "l4re"))] { |
| 1254 | pub const SIOCETHTOOL: c_ulong = 0x00008946; |
| 1255 | pub const SIOCGMIIPHY: c_ulong = 0x00008947; |
| 1256 | pub const SIOCGMIIREG: c_ulong = 0x00008948; |
| 1257 | pub const SIOCSMIIREG: c_ulong = 0x00008949; |
| 1258 | pub const SIOCWANDEV: c_ulong = 0x0000894A; |
| 1259 | pub const SIOCOUTQNSD: c_ulong = 0x0000894B; |
| 1260 | pub const SIOCGSKNS: c_ulong = 0x0000894C; |
| 1261 | } |
| 1262 | } |
| 1263 | pub const SIOCDARP: c_ulong = 0x00008953; |
| 1264 | pub const SIOCGARP: c_ulong = 0x00008954; |
| 1265 | pub const SIOCSARP: c_ulong = 0x00008955; |
| 1266 | pub const SIOCDRARP: c_ulong = 0x00008960; |
| 1267 | pub const SIOCGRARP: c_ulong = 0x00008961; |
| 1268 | pub const SIOCSRARP: c_ulong = 0x00008962; |
| 1269 | pub const SIOCGIFMAP: c_ulong = 0x00008970; |
| 1270 | pub const SIOCSIFMAP: c_ulong = 0x00008971; |
| 1271 | |
| 1272 | pub const IPTOS_TOS_MASK: u8 = 0x1E; |
| 1273 | pub const IPTOS_PREC_MASK: u8 = 0xE0; |
| 1274 | |
| 1275 | pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; |
| 1276 | |
| 1277 | pub const RTF_UP: c_ushort = 0x0001; |
| 1278 | pub const RTF_GATEWAY: c_ushort = 0x0002; |
| 1279 | |
| 1280 | pub const RTF_HOST: c_ushort = 0x0004; |
| 1281 | pub const RTF_REINSTATE: c_ushort = 0x0008; |
| 1282 | pub const RTF_DYNAMIC: c_ushort = 0x0010; |
| 1283 | pub const RTF_MODIFIED: c_ushort = 0x0020; |
| 1284 | pub const RTF_MTU: c_ushort = 0x0040; |
| 1285 | pub const RTF_MSS: c_ushort = RTF_MTU; |
| 1286 | pub const RTF_WINDOW: c_ushort = 0x0080; |
| 1287 | pub const RTF_IRTT: c_ushort = 0x0100; |
| 1288 | pub const RTF_REJECT: c_ushort = 0x0200; |
| 1289 | pub const RTF_STATIC: c_ushort = 0x0400; |
| 1290 | pub const RTF_XRESOLVE: c_ushort = 0x0800; |
| 1291 | pub const RTF_NOFORWARD: c_ushort = 0x1000; |
| 1292 | pub const RTF_THROW: c_ushort = 0x2000; |
| 1293 | pub const RTF_NOPMTUDISC: c_ushort = 0x4000; |
| 1294 | |
| 1295 | pub const RTF_DEFAULT: u32 = 0x00010000; |
| 1296 | pub const RTF_ALLONLINK: u32 = 0x00020000; |
| 1297 | pub const RTF_ADDRCONF: u32 = 0x00040000; |
| 1298 | pub const RTF_LINKRT: u32 = 0x00100000; |
| 1299 | pub const RTF_NONEXTHOP: u32 = 0x00200000; |
| 1300 | pub const RTF_CACHE: u32 = 0x01000000; |
| 1301 | pub const RTF_FLOW: u32 = 0x02000000; |
| 1302 | pub const RTF_POLICY: u32 = 0x04000000; |
| 1303 | |
| 1304 | pub const RTCF_VALVE: u32 = 0x00200000; |
| 1305 | pub const RTCF_MASQ: u32 = 0x00400000; |
| 1306 | pub const RTCF_NAT: u32 = 0x00800000; |
| 1307 | pub const RTCF_DOREDIRECT: u32 = 0x01000000; |
| 1308 | pub const RTCF_LOG: u32 = 0x02000000; |
| 1309 | pub const RTCF_DIRECTSRC: u32 = 0x04000000; |
| 1310 | |
| 1311 | pub const RTF_LOCAL: u32 = 0x80000000; |
| 1312 | pub const RTF_INTERFACE: u32 = 0x40000000; |
| 1313 | pub const RTF_MULTICAST: u32 = 0x20000000; |
| 1314 | pub const RTF_BROADCAST: u32 = 0x10000000; |
| 1315 | pub const RTF_NAT: u32 = 0x08000000; |
| 1316 | pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000; |
| 1317 | |
| 1318 | pub const RT_CLASS_UNSPEC: u8 = 0; |
| 1319 | pub const RT_CLASS_DEFAULT: u8 = 253; |
| 1320 | pub const RT_CLASS_MAIN: u8 = 254; |
| 1321 | pub const RT_CLASS_LOCAL: u8 = 255; |
| 1322 | |
| 1323 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1324 | /// for details. |
| 1325 | pub const RT_CLASS_MAX: u8 = 255; |
| 1326 | |
| 1327 | pub const MAX_ADDR_LEN: usize = 7; |
| 1328 | pub const ARPD_UPDATE: c_ushort = 0x01; |
| 1329 | pub const ARPD_LOOKUP: c_ushort = 0x02; |
| 1330 | pub const ARPD_FLUSH: c_ushort = 0x03; |
| 1331 | pub const ATF_MAGIC: c_int = 0x80; |
| 1332 | |
| 1333 | // include/uapi/linux/udp.h |
| 1334 | pub const UDP_CORK: c_int = 1; |
| 1335 | pub const UDP_ENCAP: c_int = 100; |
| 1336 | pub const UDP_NO_CHECK6_TX: c_int = 101; |
| 1337 | pub const UDP_NO_CHECK6_RX: c_int = 102; |
| 1338 | |
| 1339 | // include/uapi/asm-generic/mman-common.h |
| 1340 | pub const MAP_FIXED_NOREPLACE: c_int = 0x100000; |
| 1341 | pub const MLOCK_ONFAULT: c_uint = 0x01; |
| 1342 | |
| 1343 | pub const REG_EXTENDED: c_int = 1; |
| 1344 | pub const REG_ICASE: c_int = 2; |
| 1345 | pub const REG_NEWLINE: c_int = 4; |
| 1346 | pub const REG_NOSUB: c_int = 8; |
| 1347 | |
| 1348 | pub const REG_NOTBOL: c_int = 1; |
| 1349 | pub const REG_NOTEOL: c_int = 2; |
| 1350 | |
| 1351 | pub const REG_ENOSYS: c_int = -1; |
| 1352 | pub const REG_NOMATCH: c_int = 1; |
| 1353 | pub const REG_BADPAT: c_int = 2; |
| 1354 | pub const REG_ECOLLATE: c_int = 3; |
| 1355 | pub const REG_ECTYPE: c_int = 4; |
| 1356 | pub const REG_EESCAPE: c_int = 5; |
| 1357 | pub const REG_ESUBREG: c_int = 6; |
| 1358 | pub const REG_EBRACK: c_int = 7; |
| 1359 | pub const REG_EPAREN: c_int = 8; |
| 1360 | pub const REG_EBRACE: c_int = 9; |
| 1361 | pub const REG_BADBR: c_int = 10; |
| 1362 | pub const REG_ERANGE: c_int = 11; |
| 1363 | pub const REG_ESPACE: c_int = 12; |
| 1364 | pub const REG_BADRPT: c_int = 13; |
| 1365 | |
| 1366 | // errno.h |
| 1367 | pub const EPERM: c_int = 1; |
| 1368 | pub const ENOENT: c_int = 2; |
| 1369 | pub const ESRCH: c_int = 3; |
| 1370 | pub const EINTR: c_int = 4; |
| 1371 | pub const EIO: c_int = 5; |
| 1372 | pub const ENXIO: c_int = 6; |
| 1373 | pub const E2BIG: c_int = 7; |
| 1374 | pub const ENOEXEC: c_int = 8; |
| 1375 | pub const EBADF: c_int = 9; |
| 1376 | pub const ECHILD: c_int = 10; |
| 1377 | pub const EAGAIN: c_int = 11; |
| 1378 | pub const ENOMEM: c_int = 12; |
| 1379 | pub const EACCES: c_int = 13; |
| 1380 | pub const EFAULT: c_int = 14; |
| 1381 | pub const ENOTBLK: c_int = 15; |
| 1382 | pub const EBUSY: c_int = 16; |
| 1383 | pub const EEXIST: c_int = 17; |
| 1384 | pub const EXDEV: c_int = 18; |
| 1385 | pub const ENODEV: c_int = 19; |
| 1386 | pub const ENOTDIR: c_int = 20; |
| 1387 | pub const EISDIR: c_int = 21; |
| 1388 | pub const EINVAL: c_int = 22; |
| 1389 | pub const ENFILE: c_int = 23; |
| 1390 | pub const EMFILE: c_int = 24; |
| 1391 | pub const ENOTTY: c_int = 25; |
| 1392 | pub const ETXTBSY: c_int = 26; |
| 1393 | pub const EFBIG: c_int = 27; |
| 1394 | pub const ENOSPC: c_int = 28; |
| 1395 | pub const ESPIPE: c_int = 29; |
| 1396 | pub const EROFS: c_int = 30; |
| 1397 | pub const EMLINK: c_int = 31; |
| 1398 | pub const EPIPE: c_int = 32; |
| 1399 | pub const EDOM: c_int = 33; |
| 1400 | pub const ERANGE: c_int = 34; |
| 1401 | pub const EWOULDBLOCK: c_int = EAGAIN; |
| 1402 | |
| 1403 | pub const CSIGNAL: c_int = 0x000000ff; |
| 1404 | |
| 1405 | #[cfg(not(target_os = "l4re"))] |
| 1406 | pub const SCHED_NORMAL: c_int = 0; |
| 1407 | pub const SCHED_OTHER: c_int = 0; |
| 1408 | pub const SCHED_FIFO: c_int = 1; |
| 1409 | pub const SCHED_RR: c_int = 2; |
| 1410 | pub const SCHED_BATCH: c_int = 3; |
| 1411 | pub const SCHED_IDLE: c_int = 5; |
| 1412 | pub const SCHED_DEADLINE: c_int = 6; |
| 1413 | |
| 1414 | pub const SCHED_RESET_ON_FORK: c_int = 0x40000000; |
| 1415 | |
| 1416 | // elf.h |
| 1417 | pub const NT_PRSTATUS: c_int = 1; |
| 1418 | #[cfg(not(target_os = "l4re"))] |
| 1419 | pub const NT_PRFPREG: c_int = 2; |
| 1420 | pub const NT_FPREGSET: c_int = 2; |
| 1421 | pub const NT_PRPSINFO: c_int = 3; |
| 1422 | #[cfg(not(target_os = "l4re"))] |
| 1423 | pub const NT_PRXREG: c_int = 4; |
| 1424 | pub const NT_TASKSTRUCT: c_int = 4; |
| 1425 | pub const NT_PLATFORM: c_int = 5; |
| 1426 | pub const NT_AUXV: c_int = 6; |
| 1427 | pub const NT_GWINDOWS: c_int = 7; |
| 1428 | pub const NT_ASRS: c_int = 8; |
| 1429 | pub const NT_PSTATUS: c_int = 10; |
| 1430 | pub const NT_PSINFO: c_int = 13; |
| 1431 | pub const NT_PRCRED: c_int = 14; |
| 1432 | pub const NT_UTSNAME: c_int = 15; |
| 1433 | pub const NT_LWPSTATUS: c_int = 16; |
| 1434 | pub const NT_LWPSINFO: c_int = 17; |
| 1435 | pub const NT_PRFPXREG: c_int = 20; |
| 1436 | |
| 1437 | // FIXME(1.0): C uses an unsigned int here. |
| 1438 | pub const MS_NOUSER: c_ulong = 1 << 31; |
| 1439 | |
| 1440 | f! { |
| 1441 | pub unsafe fn CMSG_NXTHDR( |
| 1442 | mhdr: *const crate::msghdr, |
| 1443 | cmsg: *const crate::cmsghdr, |
| 1444 | ) -> *mut crate::cmsghdr { |
| 1445 | if ((*cmsg).cmsg_len as usize) < size_of::<crate::cmsghdr>() { |
| 1446 | return ptr::null_mut(); |
| 1447 | } |
| 1448 | |
| 1449 | // FIXME(msrv): `.wrapping_byte_add()` stabilized in 1.75 |
| 1450 | let next_cmsg = cmsg |
| 1451 | .cast::<u8>() |
| 1452 | .wrapping_add(super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) |
| 1453 | .cast::<crate::cmsghdr>(); |
| 1454 | |
| 1455 | // In case the addition wrapped. `next_addr > max_addr` |
| 1456 | // would otherwise not work as intended. |
| 1457 | if (next_cmsg as usize) < (cmsg as usize) { |
| 1458 | return ptr::null_mut(); |
| 1459 | } |
| 1460 | |
| 1461 | let mut max_addr = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1462 | |
| 1463 | if cfg!(any(target_env = "musl", target_env = "ohos")) { |
| 1464 | // musl and some of its descendants do `>= max_addr` |
| 1465 | // comparisons in the if statement below. |
| 1466 | // https://www.openwall.com/lists/musl/2025/12/27/1 |
| 1467 | max_addr -= 1; |
| 1468 | } |
| 1469 | |
| 1470 | if next_cmsg as usize + size_of::<crate::cmsghdr>() > max_addr { |
| 1471 | ptr::null_mut() |
| 1472 | } else { |
| 1473 | next_cmsg as *mut crate::cmsghdr |
| 1474 | } |
| 1475 | } |
| 1476 | |
| 1477 | pub unsafe fn CPU_ALLOC_SIZE(count: c_int) -> size_t { |
| 1478 | let _dummy: cpu_set_t = mem::zeroed(); |
| 1479 | let size_in_bits = 8 * size_of_val(&_dummy.bits[0]); |
| 1480 | ((count as size_t + size_in_bits - 1) / 8) as size_t |
| 1481 | } |
| 1482 | |
| 1483 | pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { |
| 1484 | cpuset.bits.fill(0); |
| 1485 | } |
| 1486 | |
| 1487 | pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1488 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 1489 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1490 | cpuset.bits[idx] |= 1 << offset; |
| 1491 | } |
| 1492 | |
| 1493 | pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1494 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 1495 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1496 | cpuset.bits[idx] &= !(1 << offset); |
| 1497 | } |
| 1498 | |
| 1499 | pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { |
| 1500 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); |
| 1501 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1502 | 0 != (cpuset.bits[idx] & (1 << offset)) |
| 1503 | } |
| 1504 | |
| 1505 | pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { |
| 1506 | let mut s: u32 = 0; |
| 1507 | let size_of_mask = size_of_val(&cpuset.bits[0]); |
| 1508 | for i in &cpuset.bits[..(size / size_of_mask)] { |
| 1509 | s += i.count_ones(); |
| 1510 | } |
| 1511 | s as c_int |
| 1512 | } |
| 1513 | |
| 1514 | pub unsafe fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int { |
| 1515 | CPU_COUNT_S(size_of::<cpu_set_t>(), cpuset) |
| 1516 | } |
| 1517 | |
| 1518 | pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { |
| 1519 | set1.bits == set2.bits |
| 1520 | } |
| 1521 | |
| 1522 | pub unsafe fn IPTOS_TOS(tos: u8) -> u8 { |
| 1523 | tos & IPTOS_TOS_MASK |
| 1524 | } |
| 1525 | |
| 1526 | pub unsafe fn IPTOS_PREC(tos: u8) -> u8 { |
| 1527 | tos & IPTOS_PREC_MASK |
| 1528 | } |
| 1529 | |
| 1530 | pub unsafe fn RT_TOS(tos: u8) -> u8 { |
| 1531 | tos & crate::IPTOS_TOS_MASK |
| 1532 | } |
| 1533 | |
| 1534 | pub unsafe fn RT_ADDRCLASS(flags: u32) -> u32 { |
| 1535 | flags >> 23 |
| 1536 | } |
| 1537 | |
| 1538 | pub unsafe fn RT_LOCALADDR(flags: u32) -> bool { |
| 1539 | (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE) |
| 1540 | } |
| 1541 | |
| 1542 | pub unsafe fn ELF32_R_SYM(val: Elf32_Word) -> Elf32_Word { |
| 1543 | val >> 8 |
| 1544 | } |
| 1545 | |
| 1546 | pub unsafe fn ELF32_R_TYPE(val: Elf32_Word) -> Elf32_Word { |
| 1547 | val & 0xff |
| 1548 | } |
| 1549 | |
| 1550 | pub unsafe fn ELF32_R_INFO(sym: Elf32_Word, t: Elf32_Word) -> Elf32_Word { |
| 1551 | sym << (8 + t) & 0xff |
| 1552 | } |
| 1553 | |
| 1554 | pub unsafe fn ELF64_R_SYM(val: Elf64_Xword) -> Elf64_Xword { |
| 1555 | val >> 32 |
| 1556 | } |
| 1557 | |
| 1558 | pub unsafe fn ELF64_R_TYPE(val: Elf64_Xword) -> Elf64_Xword { |
| 1559 | val & 0xffffffff |
| 1560 | } |
| 1561 | |
| 1562 | pub unsafe fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword { |
| 1563 | sym << (32 + t) |
| 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | safe_f! { |
| 1568 | pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { |
| 1569 | let major = major as crate::dev_t; |
| 1570 | let minor = minor as crate::dev_t; |
| 1571 | let mut dev = 0; |
| 1572 | dev |= (major & 0x00000fff) << 8; |
| 1573 | dev |= (major & 0xfffff000) << 32; |
| 1574 | dev |= (minor & 0x000000ff) << 0; |
| 1575 | dev |= (minor & 0xffffff00) << 12; |
| 1576 | dev |
| 1577 | } |
| 1578 | |
| 1579 | pub const safe fn major(dev: crate::dev_t) -> c_uint { |
| 1580 | let mut major = 0; |
| 1581 | major |= (dev & 0x00000000000fff00) >> 8; |
| 1582 | major |= (dev & 0xfffff00000000000) >> 32; |
| 1583 | major as c_uint |
| 1584 | } |
| 1585 | |
| 1586 | pub const safe fn minor(dev: crate::dev_t) -> c_uint { |
| 1587 | let mut minor = 0; |
| 1588 | minor |= (dev & 0x00000000000000ff) >> 0; |
| 1589 | minor |= (dev & 0x00000ffffff00000) >> 12; |
| 1590 | minor as c_uint |
| 1591 | } |
| 1592 | } |
| 1593 | |
| 1594 | cfg_if! { |
| 1595 | if #[cfg(all( |
| 1596 | any(target_env = "gnu", target_env = "musl", target_env = "ohos"), |
| 1597 | any(target_arch = "x86_64", target_arch = "x86") |
| 1598 | ))] { |
| 1599 | extern "C" { |
| 1600 | pub fn iopl(level: c_int) -> c_int; |
| 1601 | pub fn ioperm(from: c_ulong, num: c_ulong, turn_on: c_int) -> c_int; |
| 1602 | } |
| 1603 | } |
| 1604 | } |
| 1605 | |
| 1606 | cfg_if! { |
| 1607 | if #[cfg(all(not(target_env = "uclibc"), not(target_env = "ohos")))] { |
| 1608 | extern "C" { |
| 1609 | #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_read64")] |
| 1610 | pub fn aio_read(aiocbp: *mut crate::aiocb) -> c_int; |
| 1611 | #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_write64")] |
| 1612 | pub fn aio_write(aiocbp: *mut crate::aiocb) -> c_int; |
| 1613 | pub fn aio_fsync(op: c_int, aiocbp: *mut crate::aiocb) -> c_int; |
| 1614 | #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_error64")] |
| 1615 | pub fn aio_error(aiocbp: *const crate::aiocb) -> c_int; |
| 1616 | #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_return64")] |
| 1617 | pub fn aio_return(aiocbp: *mut crate::aiocb) -> ssize_t; |
| 1618 | #[cfg_attr( |
| 1619 | any(musl_redir_time64, gnu_time_bits64), |
| 1620 | link_name = "__aio_suspend_time64" |
| 1621 | )] |
| 1622 | pub fn aio_suspend( |
| 1623 | aiocb_list: *const *const crate::aiocb, |
| 1624 | nitems: c_int, |
| 1625 | timeout: *const crate::timespec, |
| 1626 | ) -> c_int; |
| 1627 | #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_cancel64")] |
| 1628 | pub fn aio_cancel(fd: c_int, aiocbp: *mut crate::aiocb) -> c_int; |
| 1629 | #[cfg_attr(gnu_file_offset_bits64, link_name = "lio_listio64")] |
| 1630 | pub fn lio_listio( |
| 1631 | mode: c_int, |
| 1632 | aiocb_list: *const *mut crate::aiocb, |
| 1633 | nitems: c_int, |
| 1634 | sevp: *mut crate::sigevent, |
| 1635 | ) -> c_int; |
| 1636 | } |
| 1637 | } |
| 1638 | } |
| 1639 | |
| 1640 | cfg_if! { |
| 1641 | if #[cfg(not(target_env = "uclibc"))] { |
| 1642 | extern "C" { |
| 1643 | #[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64")] |
| 1644 | pub fn pwritev( |
| 1645 | fd: c_int, |
| 1646 | iov: *const crate::iovec, |
| 1647 | iovcnt: c_int, |
| 1648 | offset: crate::off_t, |
| 1649 | ) -> ssize_t; |
| 1650 | #[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64")] |
| 1651 | pub fn preadv( |
| 1652 | fd: c_int, |
| 1653 | iov: *const crate::iovec, |
| 1654 | iovcnt: c_int, |
| 1655 | offset: crate::off_t, |
| 1656 | ) -> ssize_t; |
| 1657 | pub fn getnameinfo( |
| 1658 | sa: *const crate::sockaddr, |
| 1659 | salen: crate::socklen_t, |
| 1660 | host: *mut c_char, |
| 1661 | hostlen: crate::socklen_t, |
| 1662 | serv: *mut c_char, |
| 1663 | servlen: crate::socklen_t, |
| 1664 | flags: c_int, |
| 1665 | ) -> c_int; |
| 1666 | pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int; |
| 1667 | pub fn process_vm_readv( |
| 1668 | pid: crate::pid_t, |
| 1669 | local_iov: *const crate::iovec, |
| 1670 | liovcnt: c_ulong, |
| 1671 | remote_iov: *const crate::iovec, |
| 1672 | riovcnt: c_ulong, |
| 1673 | flags: c_ulong, |
| 1674 | ) -> isize; |
| 1675 | pub fn process_vm_writev( |
| 1676 | pid: crate::pid_t, |
| 1677 | local_iov: *const crate::iovec, |
| 1678 | liovcnt: c_ulong, |
| 1679 | remote_iov: *const crate::iovec, |
| 1680 | riovcnt: c_ulong, |
| 1681 | flags: c_ulong, |
| 1682 | ) -> isize; |
| 1683 | #[cfg_attr(gnu_time_bits64, link_name = "__futimes64")] |
| 1684 | #[cfg_attr(musl_redir_time64, link_name = "__futimes_time64")] |
| 1685 | pub fn futimes(fd: c_int, times: *const crate::timeval) -> c_int; |
| 1686 | } |
| 1687 | } |
| 1688 | } |
| 1689 | |
| 1690 | extern "C" { |
| 1691 | #[cfg_attr( |
| 1692 | not(any(target_env = "musl", target_env = "ohos")), |
| 1693 | link_name = "__xpg_strerror_r" |
| 1694 | )] |
| 1695 | pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; |
| 1696 | |
| 1697 | pub fn abs(i: c_int) -> c_int; |
| 1698 | pub fn labs(i: c_long) -> c_long; |
| 1699 | pub fn rand() -> c_int; |
| 1700 | pub fn srand(seed: c_uint); |
| 1701 | |
| 1702 | pub fn drand48() -> c_double; |
| 1703 | pub fn erand48(xseed: *mut c_ushort) -> c_double; |
| 1704 | pub fn lrand48() -> c_long; |
| 1705 | pub fn nrand48(xseed: *mut c_ushort) -> c_long; |
| 1706 | pub fn jrand48(xseed: *mut c_ushort) -> c_long; |
| 1707 | pub fn srand48(seed: c_long); |
| 1708 | |
| 1709 | pub fn setpwent(); |
| 1710 | pub fn endpwent(); |
| 1711 | pub fn getpwent() -> *mut passwd; |
| 1712 | pub fn setgrent(); |
| 1713 | pub fn endgrent(); |
| 1714 | pub fn getgrent() -> *mut crate::group; |
| 1715 | #[cfg(not(target_os = "l4re"))] |
| 1716 | pub fn setspent(); |
| 1717 | #[cfg(not(target_os = "l4re"))] |
| 1718 | pub fn endspent(); |
| 1719 | #[cfg(not(target_os = "l4re"))] |
| 1720 | pub fn getspent() -> *mut spwd; |
| 1721 | |
| 1722 | pub fn getspnam(name: *const c_char) -> *mut spwd; |
| 1723 | |
| 1724 | // System V IPC |
| 1725 | pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int; |
| 1726 | pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void; |
| 1727 | pub fn shmdt(shmaddr: *const c_void) -> c_int; |
| 1728 | #[cfg_attr(gnu_time_bits64, link_name = "__shmctl64")] |
| 1729 | pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int; |
| 1730 | |
| 1731 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1732 | pub fn __errno_location() -> *mut c_int; |
| 1733 | |
| 1734 | #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")] |
| 1735 | #[cfg_attr( |
| 1736 | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
| 1737 | link_name = "glob64" |
| 1738 | )] |
| 1739 | pub fn glob( |
| 1740 | pattern: *const c_char, |
| 1741 | flags: c_int, |
| 1742 | errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, |
| 1743 | pglob: *mut crate::glob_t, |
| 1744 | ) -> c_int; |
| 1745 | #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")] |
| 1746 | #[cfg_attr( |
| 1747 | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
| 1748 | link_name = "globfree64" |
| 1749 | )] |
| 1750 | pub fn globfree(pglob: *mut crate::glob_t); |
| 1751 | |
| 1752 | pub fn seekdir(dirp: *mut crate::DIR, loc: c_long); |
| 1753 | |
| 1754 | pub fn telldir(dirp: *mut crate::DIR) -> c_long; |
| 1755 | pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; |
| 1756 | |
| 1757 | pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; |
| 1758 | pub fn recvfrom( |
| 1759 | socket: c_int, |
| 1760 | buf: *mut c_void, |
| 1761 | len: size_t, |
| 1762 | flags: c_int, |
| 1763 | addr: *mut crate::sockaddr, |
| 1764 | addrlen: *mut crate::socklen_t, |
| 1765 | ) -> ssize_t; |
| 1766 | |
| 1767 | pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char; |
| 1768 | pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char; |
| 1769 | |
| 1770 | pub fn sched_getaffinity( |
| 1771 | pid: crate::pid_t, |
| 1772 | cpusetsize: size_t, |
| 1773 | cpuset: *mut cpu_set_t, |
| 1774 | ) -> c_int; |
| 1775 | pub fn sched_get_priority_max(policy: c_int) -> c_int; |
| 1776 | #[cfg_attr(gnu_time_bits64, link_name = "__settimeofday64")] |
| 1777 | #[cfg_attr(musl_redir_time64, link_name = "__settimeofday_time64")] |
| 1778 | pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int; |
| 1779 | #[cfg_attr(gnu_time_bits64, link_name = "__sem_timedwait64")] |
| 1780 | #[cfg_attr(musl_redir_time64, link_name = "__sem_timedwait_time64")] |
| 1781 | pub fn sem_timedwait(sem: *mut crate::sem_t, abstime: *const crate::timespec) -> c_int; |
| 1782 | pub fn sem_getvalue(sem: *mut crate::sem_t, sval: *mut c_int) -> c_int; |
| 1783 | pub fn mount( |
| 1784 | src: *const c_char, |
| 1785 | target: *const c_char, |
| 1786 | fstype: *const c_char, |
| 1787 | flags: c_ulong, |
| 1788 | data: *const c_void, |
| 1789 | ) -> c_int; |
| 1790 | #[cfg_attr(gnu_time_bits64, link_name = "__prctl_time64")] |
| 1791 | pub fn prctl(option: c_int, ...) -> c_int; |
| 1792 | #[cfg_attr(gnu_time_bits64, link_name = "__ppoll64")] |
| 1793 | #[cfg_attr(musl_redir_time64, link_name = "__ppoll_time64")] |
| 1794 | pub fn ppoll( |
| 1795 | fds: *mut crate::pollfd, |
| 1796 | nfds: crate::nfds_t, |
| 1797 | timeout: *const crate::timespec, |
| 1798 | sigmask: *const crate::sigset_t, |
| 1799 | ) -> c_int; |
| 1800 | pub fn sethostname(name: *const c_char, len: size_t) -> c_int; |
| 1801 | pub fn sched_get_priority_min(policy: c_int) -> c_int; |
| 1802 | pub fn sysinfo(info: *mut crate::sysinfo) -> c_int; |
| 1803 | pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int; |
| 1804 | pub fn getgrgid_r( |
| 1805 | gid: crate::gid_t, |
| 1806 | grp: *mut crate::group, |
| 1807 | buf: *mut c_char, |
| 1808 | buflen: size_t, |
| 1809 | result: *mut *mut crate::group, |
| 1810 | ) -> c_int; |
| 1811 | pub fn sem_close(sem: *mut crate::sem_t) -> c_int; |
| 1812 | pub fn getgrnam_r( |
| 1813 | name: *const c_char, |
| 1814 | grp: *mut crate::group, |
| 1815 | buf: *mut c_char, |
| 1816 | buflen: size_t, |
| 1817 | result: *mut *mut crate::group, |
| 1818 | ) -> c_int; |
| 1819 | pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int; |
| 1820 | pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut crate::sem_t; |
| 1821 | pub fn getgrnam(name: *const c_char) -> *mut crate::group; |
| 1822 | pub fn sem_unlink(name: *const c_char) -> c_int; |
| 1823 | pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int; |
| 1824 | pub fn sigwait(set: *const crate::sigset_t, sig: *mut c_int) -> c_int; |
| 1825 | pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group; |
| 1826 | pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE; |
| 1827 | pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; |
| 1828 | pub fn dl_iterate_phdr( |
| 1829 | callback: Option< |
| 1830 | unsafe extern "C" fn( |
| 1831 | info: *mut crate::dl_phdr_info, |
| 1832 | size: size_t, |
| 1833 | data: *mut c_void, |
| 1834 | ) -> c_int, |
| 1835 | >, |
| 1836 | data: *mut c_void, |
| 1837 | ) -> c_int; |
| 1838 | |
| 1839 | pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE; |
| 1840 | pub fn getmntent(stream: *mut crate::FILE) -> *mut crate::mntent; |
| 1841 | pub fn addmntent(stream: *mut crate::FILE, mnt: *const crate::mntent) -> c_int; |
| 1842 | pub fn endmntent(streamp: *mut crate::FILE) -> c_int; |
| 1843 | pub fn hasmntopt(mnt: *const crate::mntent, opt: *const c_char) -> *mut c_char; |
| 1844 | |
| 1845 | pub fn regcomp(preg: *mut crate::regex_t, pattern: *const c_char, cflags: c_int) -> c_int; |
| 1846 | |
| 1847 | pub fn regexec( |
| 1848 | preg: *const crate::regex_t, |
| 1849 | input: *const c_char, |
| 1850 | nmatch: size_t, |
| 1851 | pmatch: *mut regmatch_t, |
| 1852 | eflags: c_int, |
| 1853 | ) -> c_int; |
| 1854 | |
| 1855 | pub fn regerror( |
| 1856 | errcode: c_int, |
| 1857 | preg: *const crate::regex_t, |
| 1858 | errbuf: *mut c_char, |
| 1859 | errbuf_size: size_t, |
| 1860 | ) -> size_t; |
| 1861 | |
| 1862 | pub fn regfree(preg: *mut crate::regex_t); |
| 1863 | |
| 1864 | pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t; |
| 1865 | pub fn iconv( |
| 1866 | cd: iconv_t, |
| 1867 | inbuf: *mut *mut c_char, |
| 1868 | inbytesleft: *mut size_t, |
| 1869 | outbuf: *mut *mut c_char, |
| 1870 | outbytesleft: *mut size_t, |
| 1871 | ) -> size_t; |
| 1872 | pub fn iconv_close(cd: iconv_t) -> c_int; |
| 1873 | |
| 1874 | pub fn gettid() -> crate::pid_t; |
| 1875 | |
| 1876 | pub fn timer_create( |
| 1877 | clockid: crate::clockid_t, |
| 1878 | sevp: *mut crate::sigevent, |
| 1879 | timerid: *mut crate::timer_t, |
| 1880 | ) -> c_int; |
| 1881 | pub fn timer_delete(timerid: crate::timer_t) -> c_int; |
| 1882 | #[cfg(not(target_os = "l4re"))] |
| 1883 | pub fn timer_getoverrun(timerid: crate::timer_t) -> c_int; |
| 1884 | #[cfg_attr( |
| 1885 | any(gnu_time_bits64, musl_redir_time64), |
| 1886 | link_name = "__timer_gettime64" |
| 1887 | )] |
| 1888 | pub fn timer_gettime(timerid: crate::timer_t, curr_value: *mut crate::itimerspec) -> c_int; |
| 1889 | #[cfg_attr( |
| 1890 | any(gnu_time_bits64, musl_redir_time64), |
| 1891 | link_name = "__timer_settime64" |
| 1892 | )] |
| 1893 | pub fn timer_settime( |
| 1894 | timerid: crate::timer_t, |
| 1895 | flags: c_int, |
| 1896 | new_value: *const crate::itimerspec, |
| 1897 | old_value: *mut crate::itimerspec, |
| 1898 | ) -> c_int; |
| 1899 | |
| 1900 | pub fn memmem( |
| 1901 | haystack: *const c_void, |
| 1902 | haystacklen: size_t, |
| 1903 | needle: *const c_void, |
| 1904 | needlelen: size_t, |
| 1905 | ) -> *mut c_void; |
| 1906 | pub fn sched_getcpu() -> c_int; |
| 1907 | |
| 1908 | pub fn getopt_long( |
| 1909 | argc: c_int, |
| 1910 | argv: *const *mut c_char, |
| 1911 | optstring: *const c_char, |
| 1912 | longopts: *const option, |
| 1913 | longindex: *mut c_int, |
| 1914 | ) -> c_int; |
| 1915 | |
| 1916 | #[cfg(not(target_env = "uclibc"))] |
| 1917 | pub fn copy_file_range( |
| 1918 | fd_in: c_int, |
| 1919 | off_in: *mut crate::off64_t, |
| 1920 | fd_out: c_int, |
| 1921 | off_out: *mut crate::off64_t, |
| 1922 | len: size_t, |
| 1923 | flags: c_uint, |
| 1924 | ) -> ssize_t; |
| 1925 | } |
| 1926 | |
| 1927 | cfg_if! { |
| 1928 | if #[cfg(not(any(target_env = "musl", target_env = "ohos")))] { |
| 1929 | extern "C" { |
| 1930 | pub fn freopen64( |
| 1931 | filename: *const c_char, |
| 1932 | mode: *const c_char, |
| 1933 | file: *mut crate::FILE, |
| 1934 | ) -> *mut crate::FILE; |
| 1935 | pub fn fseeko64( |
| 1936 | stream: *mut crate::FILE, |
| 1937 | offset: crate::off64_t, |
| 1938 | whence: c_int, |
| 1939 | ) -> c_int; |
| 1940 | pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const crate::fpos64_t) -> c_int; |
| 1941 | pub fn ftello64(stream: *mut crate::FILE) -> crate::off64_t; |
| 1942 | } |
| 1943 | } |
| 1944 | } |