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