]> git.proxmox.com Git - rustc.git/blob - vendor/libc/src/unix/linux_like/linux/gnu/mod.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / vendor / libc / src / unix / linux_like / linux / gnu / mod.rs
1 pub type pthread_t = c_ulong;
2 pub type __priority_which_t = ::c_uint;
3 pub type __rlimit_resource_t = ::c_uint;
4 pub type Lmid_t = ::c_long;
5 pub type regoff_t = ::c_int;
6
7 s! {
8 pub struct statx {
9 pub stx_mask: u32,
10 pub stx_blksize: u32,
11 pub stx_attributes: u64,
12 pub stx_nlink: u32,
13 pub stx_uid: u32,
14 pub stx_gid: u32,
15 pub stx_mode: u16,
16 __statx_pad1: [u16; 1],
17 pub stx_ino: u64,
18 pub stx_size: u64,
19 pub stx_blocks: u64,
20 pub stx_attributes_mask: u64,
21 pub stx_atime: ::statx_timestamp,
22 pub stx_btime: ::statx_timestamp,
23 pub stx_ctime: ::statx_timestamp,
24 pub stx_mtime: ::statx_timestamp,
25 pub stx_rdev_major: u32,
26 pub stx_rdev_minor: u32,
27 pub stx_dev_major: u32,
28 pub stx_dev_minor: u32,
29 pub stx_mnt_id: u64,
30 __statx_pad2: u64,
31 __statx_pad3: [u64; 12],
32 }
33
34 pub struct statx_timestamp {
35 pub tv_sec: i64,
36 pub tv_nsec: u32,
37 pub __statx_timestamp_pad1: [i32; 1],
38 }
39
40 pub struct aiocb {
41 pub aio_fildes: ::c_int,
42 pub aio_lio_opcode: ::c_int,
43 pub aio_reqprio: ::c_int,
44 pub aio_buf: *mut ::c_void,
45 pub aio_nbytes: ::size_t,
46 pub aio_sigevent: ::sigevent,
47 __next_prio: *mut aiocb,
48 __abs_prio: ::c_int,
49 __policy: ::c_int,
50 __error_code: ::c_int,
51 __return_value: ::ssize_t,
52 pub aio_offset: off_t,
53 #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))]
54 __unused1: [::c_char; 4],
55 __glibc_reserved: [::c_char; 32]
56 }
57
58 pub struct __exit_status {
59 pub e_termination: ::c_short,
60 pub e_exit: ::c_short,
61 }
62
63 pub struct __timeval {
64 pub tv_sec: i32,
65 pub tv_usec: i32,
66 }
67
68 pub struct glob64_t {
69 pub gl_pathc: ::size_t,
70 pub gl_pathv: *mut *mut ::c_char,
71 pub gl_offs: ::size_t,
72 pub gl_flags: ::c_int,
73
74 __unused1: *mut ::c_void,
75 __unused2: *mut ::c_void,
76 __unused3: *mut ::c_void,
77 __unused4: *mut ::c_void,
78 __unused5: *mut ::c_void,
79 }
80
81 pub struct msghdr {
82 pub msg_name: *mut ::c_void,
83 pub msg_namelen: ::socklen_t,
84 pub msg_iov: *mut ::iovec,
85 pub msg_iovlen: ::size_t,
86 pub msg_control: *mut ::c_void,
87 pub msg_controllen: ::size_t,
88 pub msg_flags: ::c_int,
89 }
90
91 pub struct cmsghdr {
92 pub cmsg_len: ::size_t,
93 pub cmsg_level: ::c_int,
94 pub cmsg_type: ::c_int,
95 }
96
97 pub struct termios {
98 pub c_iflag: ::tcflag_t,
99 pub c_oflag: ::tcflag_t,
100 pub c_cflag: ::tcflag_t,
101 pub c_lflag: ::tcflag_t,
102 pub c_line: ::cc_t,
103 pub c_cc: [::cc_t; ::NCCS],
104 #[cfg(not(any(
105 target_arch = "sparc",
106 target_arch = "sparc64",
107 target_arch = "mips",
108 target_arch = "mips64")))]
109 pub c_ispeed: ::speed_t,
110 #[cfg(not(any(
111 target_arch = "sparc",
112 target_arch = "sparc64",
113 target_arch = "mips",
114 target_arch = "mips64")))]
115 pub c_ospeed: ::speed_t,
116 }
117
118 pub struct mallinfo {
119 pub arena: ::c_int,
120 pub ordblks: ::c_int,
121 pub smblks: ::c_int,
122 pub hblks: ::c_int,
123 pub hblkhd: ::c_int,
124 pub usmblks: ::c_int,
125 pub fsmblks: ::c_int,
126 pub uordblks: ::c_int,
127 pub fordblks: ::c_int,
128 pub keepcost: ::c_int,
129 }
130
131 pub struct mallinfo2 {
132 pub arena: ::size_t,
133 pub ordblks: ::size_t,
134 pub smblks: ::size_t,
135 pub hblks: ::size_t,
136 pub hblkhd: ::size_t,
137 pub usmblks: ::size_t,
138 pub fsmblks: ::size_t,
139 pub uordblks: ::size_t,
140 pub fordblks: ::size_t,
141 pub keepcost: ::size_t,
142 }
143
144 pub struct nlmsghdr {
145 pub nlmsg_len: u32,
146 pub nlmsg_type: u16,
147 pub nlmsg_flags: u16,
148 pub nlmsg_seq: u32,
149 pub nlmsg_pid: u32,
150 }
151
152 pub struct nlmsgerr {
153 pub error: ::c_int,
154 pub msg: nlmsghdr,
155 }
156
157 pub struct nl_pktinfo {
158 pub group: u32,
159 }
160
161 pub struct nl_mmap_req {
162 pub nm_block_size: ::c_uint,
163 pub nm_block_nr: ::c_uint,
164 pub nm_frame_size: ::c_uint,
165 pub nm_frame_nr: ::c_uint,
166 }
167
168 pub struct nl_mmap_hdr {
169 pub nm_status: ::c_uint,
170 pub nm_len: ::c_uint,
171 pub nm_group: u32,
172 pub nm_pid: u32,
173 pub nm_uid: u32,
174 pub nm_gid: u32,
175 }
176
177 pub struct nlattr {
178 pub nla_len: u16,
179 pub nla_type: u16,
180 }
181
182 pub struct rtentry {
183 pub rt_pad1: ::c_ulong,
184 pub rt_dst: ::sockaddr,
185 pub rt_gateway: ::sockaddr,
186 pub rt_genmask: ::sockaddr,
187 pub rt_flags: ::c_ushort,
188 pub rt_pad2: ::c_short,
189 pub rt_pad3: ::c_ulong,
190 pub rt_tos: ::c_uchar,
191 pub rt_class: ::c_uchar,
192 #[cfg(target_pointer_width = "64")]
193 pub rt_pad4: [::c_short; 3usize],
194 #[cfg(not(target_pointer_width = "64"))]
195 pub rt_pad4: ::c_short,
196 pub rt_metric: ::c_short,
197 pub rt_dev: *mut ::c_char,
198 pub rt_mtu: ::c_ulong,
199 pub rt_window: ::c_ulong,
200 pub rt_irtt: ::c_ushort,
201 }
202
203 pub struct timex {
204 pub modes: ::c_uint,
205 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
206 pub offset: i64,
207 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
208 pub offset: ::c_long,
209 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
210 pub freq: i64,
211 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
212 pub freq: ::c_long,
213 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
214 pub maxerror: i64,
215 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
216 pub maxerror: ::c_long,
217 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
218 pub esterror: i64,
219 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
220 pub esterror: ::c_long,
221 pub status: ::c_int,
222 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
223 pub constant: i64,
224 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
225 pub constant: ::c_long,
226 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
227 pub precision: i64,
228 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
229 pub precision: ::c_long,
230 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
231 pub tolerance: i64,
232 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
233 pub tolerance: ::c_long,
234 pub time: ::timeval,
235 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
236 pub tick: i64,
237 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
238 pub tick: ::c_long,
239 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
240 pub ppsfreq: i64,
241 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
242 pub ppsfreq: ::c_long,
243 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
244 pub jitter: i64,
245 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
246 pub jitter: ::c_long,
247 pub shift: ::c_int,
248 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
249 pub stabil: i64,
250 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
251 pub stabil: ::c_long,
252 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
253 pub jitcnt: i64,
254 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
255 pub jitcnt: ::c_long,
256 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
257 pub calcnt: i64,
258 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
259 pub calcnt: ::c_long,
260 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
261 pub errcnt: i64,
262 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
263 pub errcnt: ::c_long,
264 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
265 pub stbcnt: i64,
266 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
267 pub stbcnt: ::c_long,
268 pub tai: ::c_int,
269 pub __unused1: i32,
270 pub __unused2: i32,
271 pub __unused3: i32,
272 pub __unused4: i32,
273 pub __unused5: i32,
274 pub __unused6: i32,
275 pub __unused7: i32,
276 pub __unused8: i32,
277 pub __unused9: i32,
278 pub __unused10: i32,
279 pub __unused11: i32,
280 }
281
282 pub struct ntptimeval {
283 pub time: ::timeval,
284 pub maxerror: ::c_long,
285 pub esterror: ::c_long,
286 pub tai: ::c_long,
287 pub __glibc_reserved1: ::c_long,
288 pub __glibc_reserved2: ::c_long,
289 pub __glibc_reserved3: ::c_long,
290 pub __glibc_reserved4: ::c_long,
291 }
292
293 pub struct regex_t {
294 __buffer: *mut ::c_void,
295 __allocated: ::size_t,
296 __used: ::size_t,
297 __syntax: ::c_ulong,
298 __fastmap: *mut ::c_char,
299 __translate: *mut ::c_char,
300 __re_nsub: ::size_t,
301 __bitfield: u8,
302 }
303
304 pub struct Elf64_Chdr {
305 pub ch_type: ::Elf64_Word,
306 pub ch_reserved: ::Elf64_Word,
307 pub ch_size: ::Elf64_Xword,
308 pub ch_addralign: ::Elf64_Xword,
309 }
310
311 pub struct Elf32_Chdr {
312 pub ch_type: ::Elf32_Word,
313 pub ch_size: ::Elf32_Word,
314 pub ch_addralign: ::Elf32_Word,
315 }
316
317 pub struct seminfo {
318 pub semmap: ::c_int,
319 pub semmni: ::c_int,
320 pub semmns: ::c_int,
321 pub semmnu: ::c_int,
322 pub semmsl: ::c_int,
323 pub semopm: ::c_int,
324 pub semume: ::c_int,
325 pub semusz: ::c_int,
326 pub semvmx: ::c_int,
327 pub semaem: ::c_int,
328 }
329 }
330
331 impl siginfo_t {
332 pub unsafe fn si_addr(&self) -> *mut ::c_void {
333 #[repr(C)]
334 struct siginfo_sigfault {
335 _si_signo: ::c_int,
336 _si_errno: ::c_int,
337 _si_code: ::c_int,
338 si_addr: *mut ::c_void,
339 }
340 (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
341 }
342
343 pub unsafe fn si_value(&self) -> ::sigval {
344 #[repr(C)]
345 struct siginfo_timer {
346 _si_signo: ::c_int,
347 _si_errno: ::c_int,
348 _si_code: ::c_int,
349 _si_tid: ::c_int,
350 _si_overrun: ::c_int,
351 si_sigval: ::sigval,
352 }
353 (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval
354 }
355 }
356
357 cfg_if! {
358 if #[cfg(libc_union)] {
359 // Internal, for casts to access union fields
360 #[repr(C)]
361 struct sifields_sigchld {
362 si_pid: ::pid_t,
363 si_uid: ::uid_t,
364 si_status: ::c_int,
365 si_utime: ::c_long,
366 si_stime: ::c_long,
367 }
368 impl ::Copy for sifields_sigchld {}
369 impl ::Clone for sifields_sigchld {
370 fn clone(&self) -> sifields_sigchld {
371 *self
372 }
373 }
374
375 // Internal, for casts to access union fields
376 #[repr(C)]
377 union sifields {
378 _align_pointer: *mut ::c_void,
379 sigchld: sifields_sigchld,
380 }
381
382 // Internal, for casts to access union fields. Note that some variants
383 // of sifields start with a pointer, which makes the alignment of
384 // sifields vary on 32-bit and 64-bit architectures.
385 #[repr(C)]
386 struct siginfo_f {
387 _siginfo_base: [::c_int; 3],
388 sifields: sifields,
389 }
390
391 impl siginfo_t {
392 unsafe fn sifields(&self) -> &sifields {
393 &(*(self as *const siginfo_t as *const siginfo_f)).sifields
394 }
395
396 pub unsafe fn si_pid(&self) -> ::pid_t {
397 self.sifields().sigchld.si_pid
398 }
399
400 pub unsafe fn si_uid(&self) -> ::uid_t {
401 self.sifields().sigchld.si_uid
402 }
403
404 pub unsafe fn si_status(&self) -> ::c_int {
405 self.sifields().sigchld.si_status
406 }
407
408 pub unsafe fn si_utime(&self) -> ::c_long {
409 self.sifields().sigchld.si_utime
410 }
411
412 pub unsafe fn si_stime(&self) -> ::c_long {
413 self.sifields().sigchld.si_stime
414 }
415 }
416 }
417 }
418
419 s_no_extra_traits! {
420 pub struct utmpx {
421 pub ut_type: ::c_short,
422 pub ut_pid: ::pid_t,
423 pub ut_line: [::c_char; __UT_LINESIZE],
424 pub ut_id: [::c_char; 4],
425
426 pub ut_user: [::c_char; __UT_NAMESIZE],
427 pub ut_host: [::c_char; __UT_HOSTSIZE],
428 pub ut_exit: __exit_status,
429
430 #[cfg(any(target_arch = "aarch64",
431 target_arch = "s390x",
432 all(target_pointer_width = "32",
433 not(target_arch = "x86_64"))))]
434 pub ut_session: ::c_long,
435 #[cfg(any(target_arch = "aarch64",
436 target_arch = "s390x",
437 all(target_pointer_width = "32",
438 not(target_arch = "x86_64"))))]
439 pub ut_tv: ::timeval,
440
441 #[cfg(not(any(target_arch = "aarch64",
442 target_arch = "s390x",
443 all(target_pointer_width = "32",
444 not(target_arch = "x86_64")))))]
445 pub ut_session: i32,
446 #[cfg(not(any(target_arch = "aarch64",
447 target_arch = "s390x",
448 all(target_pointer_width = "32",
449 not(target_arch = "x86_64")))))]
450 pub ut_tv: __timeval,
451
452 pub ut_addr_v6: [i32; 4],
453 __glibc_reserved: [::c_char; 20],
454 }
455 }
456
457 cfg_if! {
458 if #[cfg(feature = "extra_traits")] {
459 impl PartialEq for utmpx {
460 fn eq(&self, other: &utmpx) -> bool {
461 self.ut_type == other.ut_type
462 && self.ut_pid == other.ut_pid
463 && self.ut_line == other.ut_line
464 && self.ut_id == other.ut_id
465 && self.ut_user == other.ut_user
466 && self
467 .ut_host
468 .iter()
469 .zip(other.ut_host.iter())
470 .all(|(a,b)| a == b)
471 && self.ut_exit == other.ut_exit
472 && self.ut_session == other.ut_session
473 && self.ut_tv == other.ut_tv
474 && self.ut_addr_v6 == other.ut_addr_v6
475 && self.__glibc_reserved == other.__glibc_reserved
476 }
477 }
478
479 impl Eq for utmpx {}
480
481 impl ::fmt::Debug for utmpx {
482 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
483 f.debug_struct("utmpx")
484 .field("ut_type", &self.ut_type)
485 .field("ut_pid", &self.ut_pid)
486 .field("ut_line", &self.ut_line)
487 .field("ut_id", &self.ut_id)
488 .field("ut_user", &self.ut_user)
489 // FIXME: .field("ut_host", &self.ut_host)
490 .field("ut_exit", &self.ut_exit)
491 .field("ut_session", &self.ut_session)
492 .field("ut_tv", &self.ut_tv)
493 .field("ut_addr_v6", &self.ut_addr_v6)
494 .field("__glibc_reserved", &self.__glibc_reserved)
495 .finish()
496 }
497 }
498
499 impl ::hash::Hash for utmpx {
500 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
501 self.ut_type.hash(state);
502 self.ut_pid.hash(state);
503 self.ut_line.hash(state);
504 self.ut_id.hash(state);
505 self.ut_user.hash(state);
506 self.ut_host.hash(state);
507 self.ut_exit.hash(state);
508 self.ut_session.hash(state);
509 self.ut_tv.hash(state);
510 self.ut_addr_v6.hash(state);
511 self.__glibc_reserved.hash(state);
512 }
513 }
514 }
515 }
516
517 // include/uapi/asm-generic/hugetlb_encode.h
518 pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26;
519 pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f;
520
521 pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT;
522 pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT;
523 pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT;
524 pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT;
525 pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT;
526 pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT;
527 pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT;
528 pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT;
529 pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT;
530 pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT;
531 pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT;
532 pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT;
533
534 // include/uapi/linux/mman.h
535 /*
536 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
537 * size other than the default is desired. See hugetlb_encode.h.
538 * All known huge page size encodings are provided here. It is the
539 * responsibility of the application to know which sizes are supported on
540 * the running system. See mmap(2) man page for details.
541 */
542 pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT;
543 pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK;
544
545 pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB;
546 pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB;
547 pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB;
548 pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB;
549 pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB;
550 pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB;
551 pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB;
552 pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB;
553 pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB;
554 pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB;
555 pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB;
556 pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB;
557
558 pub const RLIMIT_CPU: ::__rlimit_resource_t = 0;
559 pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1;
560 pub const RLIMIT_DATA: ::__rlimit_resource_t = 2;
561 pub const RLIMIT_STACK: ::__rlimit_resource_t = 3;
562 pub const RLIMIT_CORE: ::__rlimit_resource_t = 4;
563 pub const RLIMIT_LOCKS: ::__rlimit_resource_t = 10;
564 pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11;
565 pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12;
566 pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
567 pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
568 pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
569 pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16;
570 pub const RLIM_NLIMITS: ::__rlimit_resource_t = RLIMIT_NLIMITS;
571
572 pub const PRIO_PROCESS: ::__priority_which_t = 0;
573 pub const PRIO_PGRP: ::__priority_which_t = 1;
574 pub const PRIO_USER: ::__priority_which_t = 2;
575
576 pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
577
578 pub const __UT_LINESIZE: usize = 32;
579 pub const __UT_NAMESIZE: usize = 32;
580 pub const __UT_HOSTSIZE: usize = 256;
581 pub const EMPTY: ::c_short = 0;
582 pub const RUN_LVL: ::c_short = 1;
583 pub const BOOT_TIME: ::c_short = 2;
584 pub const NEW_TIME: ::c_short = 3;
585 pub const OLD_TIME: ::c_short = 4;
586 pub const INIT_PROCESS: ::c_short = 5;
587 pub const LOGIN_PROCESS: ::c_short = 6;
588 pub const USER_PROCESS: ::c_short = 7;
589 pub const DEAD_PROCESS: ::c_short = 8;
590 pub const ACCOUNTING: ::c_short = 9;
591
592 // dlfcn.h
593 pub const LM_ID_BASE: ::c_long = 0;
594 pub const LM_ID_NEWLM: ::c_long = -1;
595
596 pub const RTLD_DI_LMID: ::c_int = 1;
597 pub const RTLD_DI_LINKMAP: ::c_int = 2;
598 pub const RTLD_DI_CONFIGADDR: ::c_int = 3;
599 pub const RTLD_DI_SERINFO: ::c_int = 4;
600 pub const RTLD_DI_SERINFOSIZE: ::c_int = 5;
601 pub const RTLD_DI_ORIGIN: ::c_int = 6;
602 pub const RTLD_DI_PROFILENAME: ::c_int = 7;
603 pub const RTLD_DI_PROFILEOUT: ::c_int = 8;
604 pub const RTLD_DI_TLS_MODID: ::c_int = 9;
605 pub const RTLD_DI_TLS_DATA: ::c_int = 10;
606
607 pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
608
609 pub const SOL_RXRPC: ::c_int = 272;
610 pub const SOL_PPPOL2TP: ::c_int = 273;
611 pub const SOL_PNPIPE: ::c_int = 275;
612 pub const SOL_RDS: ::c_int = 276;
613 pub const SOL_IUCV: ::c_int = 277;
614 pub const SOL_CAIF: ::c_int = 278;
615 pub const SOL_NFC: ::c_int = 280;
616 pub const SOL_XDP: ::c_int = 283;
617
618 pub const MSG_TRYHARD: ::c_int = 4;
619
620 pub const LC_PAPER: ::c_int = 7;
621 pub const LC_NAME: ::c_int = 8;
622 pub const LC_ADDRESS: ::c_int = 9;
623 pub const LC_TELEPHONE: ::c_int = 10;
624 pub const LC_MEASUREMENT: ::c_int = 11;
625 pub const LC_IDENTIFICATION: ::c_int = 12;
626 pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER;
627 pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME;
628 pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS;
629 pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE;
630 pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT;
631 pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION;
632 pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
633 | ::LC_NUMERIC_MASK
634 | ::LC_TIME_MASK
635 | ::LC_COLLATE_MASK
636 | ::LC_MONETARY_MASK
637 | ::LC_MESSAGES_MASK
638 | LC_PAPER_MASK
639 | LC_NAME_MASK
640 | LC_ADDRESS_MASK
641 | LC_TELEPHONE_MASK
642 | LC_MEASUREMENT_MASK
643 | LC_IDENTIFICATION_MASK;
644
645 pub const ENOTSUP: ::c_int = EOPNOTSUPP;
646
647 pub const SOCK_SEQPACKET: ::c_int = 5;
648 pub const SOCK_DCCP: ::c_int = 6;
649 pub const SOCK_PACKET: ::c_int = 10;
650
651 pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
652 pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
653 // NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
654 pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
655
656 pub const AF_IB: ::c_int = 27;
657 pub const AF_MPLS: ::c_int = 28;
658 pub const AF_NFC: ::c_int = 39;
659 pub const AF_VSOCK: ::c_int = 40;
660 pub const AF_XDP: ::c_int = 44;
661 pub const PF_IB: ::c_int = AF_IB;
662 pub const PF_MPLS: ::c_int = AF_MPLS;
663 pub const PF_NFC: ::c_int = AF_NFC;
664 pub const PF_VSOCK: ::c_int = AF_VSOCK;
665 pub const PF_XDP: ::c_int = AF_XDP;
666
667 /* DCCP socket options */
668 pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1;
669 pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2;
670 pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3;
671 pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4;
672 pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5;
673 pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6;
674 pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10;
675 pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11;
676 pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12;
677 pub const DCCP_SOCKOPT_CCID: ::c_int = 13;
678 pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14;
679 pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15;
680 pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16;
681 pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17;
682 pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128;
683 pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192;
684
685 /// maximum number of services provided on the same listening port
686 pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32;
687
688 pub const SIGEV_THREAD_ID: ::c_int = 4;
689
690 pub const BUFSIZ: ::c_uint = 8192;
691 pub const TMP_MAX: ::c_uint = 238328;
692 pub const FOPEN_MAX: ::c_uint = 16;
693 pub const FILENAME_MAX: ::c_uint = 4096;
694 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
695 pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
696 pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
697 pub const _SC_PII: ::c_int = 53;
698 pub const _SC_PII_XTI: ::c_int = 54;
699 pub const _SC_PII_SOCKET: ::c_int = 55;
700 pub const _SC_PII_INTERNET: ::c_int = 56;
701 pub const _SC_PII_OSI: ::c_int = 57;
702 pub const _SC_POLL: ::c_int = 58;
703 pub const _SC_SELECT: ::c_int = 59;
704 pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
705 pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
706 pub const _SC_PII_OSI_COTS: ::c_int = 63;
707 pub const _SC_PII_OSI_CLTS: ::c_int = 64;
708 pub const _SC_PII_OSI_M: ::c_int = 65;
709 pub const _SC_T_IOV_MAX: ::c_int = 66;
710 pub const _SC_2_C_VERSION: ::c_int = 96;
711 pub const _SC_CHAR_BIT: ::c_int = 101;
712 pub const _SC_CHAR_MAX: ::c_int = 102;
713 pub const _SC_CHAR_MIN: ::c_int = 103;
714 pub const _SC_INT_MAX: ::c_int = 104;
715 pub const _SC_INT_MIN: ::c_int = 105;
716 pub const _SC_LONG_BIT: ::c_int = 106;
717 pub const _SC_WORD_BIT: ::c_int = 107;
718 pub const _SC_MB_LEN_MAX: ::c_int = 108;
719 pub const _SC_SSIZE_MAX: ::c_int = 110;
720 pub const _SC_SCHAR_MAX: ::c_int = 111;
721 pub const _SC_SCHAR_MIN: ::c_int = 112;
722 pub const _SC_SHRT_MAX: ::c_int = 113;
723 pub const _SC_SHRT_MIN: ::c_int = 114;
724 pub const _SC_UCHAR_MAX: ::c_int = 115;
725 pub const _SC_UINT_MAX: ::c_int = 116;
726 pub const _SC_ULONG_MAX: ::c_int = 117;
727 pub const _SC_USHRT_MAX: ::c_int = 118;
728 pub const _SC_NL_ARGMAX: ::c_int = 119;
729 pub const _SC_NL_LANGMAX: ::c_int = 120;
730 pub const _SC_NL_MSGMAX: ::c_int = 121;
731 pub const _SC_NL_NMAX: ::c_int = 122;
732 pub const _SC_NL_SETMAX: ::c_int = 123;
733 pub const _SC_NL_TEXTMAX: ::c_int = 124;
734 pub const _SC_BASE: ::c_int = 134;
735 pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
736 pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
737 pub const _SC_DEVICE_IO: ::c_int = 140;
738 pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
739 pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
740 pub const _SC_FD_MGMT: ::c_int = 143;
741 pub const _SC_FIFO: ::c_int = 144;
742 pub const _SC_PIPE: ::c_int = 145;
743 pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
744 pub const _SC_FILE_LOCKING: ::c_int = 147;
745 pub const _SC_FILE_SYSTEM: ::c_int = 148;
746 pub const _SC_MULTI_PROCESS: ::c_int = 150;
747 pub const _SC_SINGLE_PROCESS: ::c_int = 151;
748 pub const _SC_NETWORKING: ::c_int = 152;
749 pub const _SC_REGEX_VERSION: ::c_int = 156;
750 pub const _SC_SIGNALS: ::c_int = 158;
751 pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
752 pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
753 pub const _SC_USER_GROUPS: ::c_int = 166;
754 pub const _SC_USER_GROUPS_R: ::c_int = 167;
755 pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
756 pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
757 pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
758 pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
759 pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
760 pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
761 pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
762 pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
763 pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
764 pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
765 pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
766 pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
767 pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
768 pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
769 pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
770 pub const O_ACCMODE: ::c_int = 3;
771 pub const ST_RELATIME: ::c_ulong = 4096;
772 pub const NI_MAXHOST: ::socklen_t = 1025;
773
774 cfg_if! {
775 if #[cfg(not(target_arch = "s390x"))] {
776 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
777 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
778 pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
779 pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
780 pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
781 pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
782 pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
783 pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
784 pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
785 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
786 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
787 pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
788 pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
789 pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
790 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
791 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
792 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
793 pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
794 pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
795 pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
796 pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
797 pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
798 pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
799 pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
800 pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
801 pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
802 pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
803 pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
804 pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
805 pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
806 pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
807 pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
808 pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
809 pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
810 pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
811 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
812 pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
813 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
814 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
815 pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
816 pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
817 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
818 pub const SECURITYFS_MAGIC: ::c_long = 0x73636673;
819 pub const SELINUX_MAGIC: ::c_long = 0xf97cff8c;
820 pub const SMACK_MAGIC: ::c_long = 0x43415d53;
821 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
822 pub const SYSFS_MAGIC: ::c_long = 0x62656572;
823 pub const TMPFS_MAGIC: ::c_long = 0x01021994;
824 pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
825 pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
826 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
827 pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
828 pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
829 } else if #[cfg(target_arch = "s390x")] {
830 pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5;
831 pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff;
832 pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f;
833 pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187;
834 pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70;
835 pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11;
836 pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e;
837 pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270;
838 pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb;
839 pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245;
840 pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45;
841 pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720;
842 pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1;
843 pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f;
844 pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53;
845 pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53;
846 pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53;
847 pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53;
848 pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010;
849 pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea;
850 pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee;
851 pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849;
852 pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6;
853 pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660;
854 pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6;
855 pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478;
856 pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468;
857 pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a;
858 pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f;
859 pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f;
860 pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44;
861 pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c;
862 pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969;
863 pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434;
864 pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f;
865 pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1;
866 pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630;
867 pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0;
868 pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f;
869 pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122;
870 pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821;
871 pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973;
872 pub const SECURITYFS_MAGIC: ::c_uint = 0x73636673;
873 pub const SELINUX_MAGIC: ::c_uint = 0xf97cff8c;
874 pub const SMACK_MAGIC: ::c_uint = 0x43415d53;
875 pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b;
876 pub const SYSFS_MAGIC: ::c_uint = 0x62656572;
877 pub const TMPFS_MAGIC: ::c_uint = 0x01021994;
878 pub const TRACEFS_MAGIC: ::c_uint = 0x74726163;
879 pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346;
880 pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2;
881 pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974;
882 pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342;
883 }
884 }
885
886 pub const CPU_SETSIZE: ::c_int = 0x400;
887
888 pub const PTRACE_TRACEME: ::c_uint = 0;
889 pub const PTRACE_PEEKTEXT: ::c_uint = 1;
890 pub const PTRACE_PEEKDATA: ::c_uint = 2;
891 pub const PTRACE_PEEKUSER: ::c_uint = 3;
892 pub const PTRACE_POKETEXT: ::c_uint = 4;
893 pub const PTRACE_POKEDATA: ::c_uint = 5;
894 pub const PTRACE_POKEUSER: ::c_uint = 6;
895 pub const PTRACE_CONT: ::c_uint = 7;
896 pub const PTRACE_KILL: ::c_uint = 8;
897 pub const PTRACE_SINGLESTEP: ::c_uint = 9;
898 pub const PTRACE_ATTACH: ::c_uint = 16;
899 pub const PTRACE_SYSCALL: ::c_uint = 24;
900 pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
901 pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
902 pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
903 pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
904 pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
905 pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
906 pub const PTRACE_SEIZE: ::c_uint = 0x4206;
907 pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
908 pub const PTRACE_LISTEN: ::c_uint = 0x4208;
909 pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
910
911 // linux/fs.h
912
913 // Flags for preadv2/pwritev2
914 pub const RWF_HIPRI: ::c_int = 0x00000001;
915 pub const RWF_DSYNC: ::c_int = 0x00000002;
916 pub const RWF_SYNC: ::c_int = 0x00000004;
917 pub const RWF_NOWAIT: ::c_int = 0x00000008;
918 pub const RWF_APPEND: ::c_int = 0x00000010;
919
920 // linux/rtnetlink.h
921 pub const TCA_PAD: ::c_ushort = 9;
922 pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10;
923 pub const TCA_CHAIN: ::c_ushort = 11;
924 pub const TCA_HW_OFFLOAD: ::c_ushort = 12;
925
926 pub const RTM_DELNETCONF: u16 = 81;
927 pub const RTM_NEWSTATS: u16 = 92;
928 pub const RTM_GETSTATS: u16 = 94;
929 pub const RTM_NEWCACHEREPORT: u16 = 96;
930
931 pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000;
932 pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000;
933
934 pub const RTA_VIA: ::c_ushort = 18;
935 pub const RTA_NEWDST: ::c_ushort = 19;
936 pub const RTA_PREF: ::c_ushort = 20;
937 pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
938 pub const RTA_ENCAP: ::c_ushort = 22;
939 pub const RTA_EXPIRES: ::c_ushort = 23;
940 pub const RTA_PAD: ::c_ushort = 24;
941 pub const RTA_UID: ::c_ushort = 25;
942 pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;
943
944 // linux/neighbor.h
945 pub const NTF_EXT_LEARNED: u8 = 0x10;
946 pub const NTF_OFFLOADED: u8 = 0x20;
947
948 pub const NDA_MASTER: ::c_ushort = 9;
949 pub const NDA_LINK_NETNSID: ::c_ushort = 10;
950 pub const NDA_SRC_VNI: ::c_ushort = 11;
951
952 // linux/personality.h
953 pub const UNAME26: ::c_int = 0x0020000;
954 pub const FDPIC_FUNCPTRS: ::c_int = 0x0080000;
955
956 // linux/if_addr.h
957 pub const IFA_FLAGS: ::c_ushort = 8;
958
959 pub const IFA_F_MANAGETEMPADDR: u32 = 0x100;
960 pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
961 pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
962 pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
963
964 pub const MAX_LINKS: ::c_int = 32;
965
966 pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10;
967
968 pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1;
969 pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2;
970
971 pub const TIOCM_LE: ::c_int = 0x001;
972 pub const TIOCM_DTR: ::c_int = 0x002;
973 pub const TIOCM_RTS: ::c_int = 0x004;
974 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
975 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
976
977 // linux/keyctl.h
978 pub const KEYCTL_DH_COMPUTE: u32 = 23;
979 pub const KEYCTL_PKEY_QUERY: u32 = 24;
980 pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
981 pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
982 pub const KEYCTL_PKEY_SIGN: u32 = 27;
983 pub const KEYCTL_PKEY_VERIFY: u32 = 28;
984 pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
985
986 pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
987 pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
988 pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
989 pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
990 cfg_if! {
991 if #[cfg(not(any(target_arch="mips", target_arch="mips64")))] {
992 pub const KEYCTL_MOVE: u32 = 30;
993 pub const KEYCTL_CAPABILITIES: u32 = 31;
994
995 pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
996 pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
997 pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
998 pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
999 pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
1000 pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
1001 pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
1002 pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
1003 pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
1004 pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;
1005 }
1006 }
1007
1008 pub const M_MXFAST: ::c_int = 1;
1009 pub const M_NLBLKS: ::c_int = 2;
1010 pub const M_GRAIN: ::c_int = 3;
1011 pub const M_KEEP: ::c_int = 4;
1012 pub const M_TRIM_THRESHOLD: ::c_int = -1;
1013 pub const M_TOP_PAD: ::c_int = -2;
1014 pub const M_MMAP_THRESHOLD: ::c_int = -3;
1015 pub const M_MMAP_MAX: ::c_int = -4;
1016 pub const M_CHECK_ACTION: ::c_int = -5;
1017 pub const M_PERTURB: ::c_int = -6;
1018 pub const M_ARENA_TEST: ::c_int = -7;
1019 pub const M_ARENA_MAX: ::c_int = -8;
1020
1021 pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
1022 pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
1023 pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
1024 pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
1025 pub const STATX_TYPE: ::c_uint = 0x0001;
1026 pub const STATX_MODE: ::c_uint = 0x0002;
1027 pub const STATX_NLINK: ::c_uint = 0x0004;
1028 pub const STATX_UID: ::c_uint = 0x0008;
1029 pub const STATX_GID: ::c_uint = 0x0010;
1030 pub const STATX_ATIME: ::c_uint = 0x0020;
1031 pub const STATX_MTIME: ::c_uint = 0x0040;
1032 pub const STATX_CTIME: ::c_uint = 0x0080;
1033 pub const STATX_INO: ::c_uint = 0x0100;
1034 pub const STATX_SIZE: ::c_uint = 0x0200;
1035 pub const STATX_BLOCKS: ::c_uint = 0x0400;
1036 pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
1037 pub const STATX_BTIME: ::c_uint = 0x0800;
1038 pub const STATX_MNT_ID: ::c_uint = 0x1000;
1039 pub const STATX_ALL: ::c_uint = 0x0fff;
1040 pub const STATX__RESERVED: ::c_int = 0x80000000;
1041 pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
1042 pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
1043 pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
1044 pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
1045 pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
1046 pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
1047
1048 //sys/timex.h
1049 pub const ADJ_OFFSET: ::c_uint = 0x0001;
1050 pub const ADJ_FREQUENCY: ::c_uint = 0x0002;
1051 pub const ADJ_MAXERROR: ::c_uint = 0x0004;
1052 pub const ADJ_ESTERROR: ::c_uint = 0x0008;
1053 pub const ADJ_STATUS: ::c_uint = 0x0010;
1054 pub const ADJ_TIMECONST: ::c_uint = 0x0020;
1055 pub const ADJ_TAI: ::c_uint = 0x0080;
1056 pub const ADJ_SETOFFSET: ::c_uint = 0x0100;
1057 pub const ADJ_MICRO: ::c_uint = 0x1000;
1058 pub const ADJ_NANO: ::c_uint = 0x2000;
1059 pub const ADJ_TICK: ::c_uint = 0x4000;
1060 pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001;
1061 pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001;
1062 pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET;
1063 pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY;
1064 pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR;
1065 pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR;
1066 pub const MOD_STATUS: ::c_uint = ADJ_STATUS;
1067 pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST;
1068 pub const MOD_CLKB: ::c_uint = ADJ_TICK;
1069 pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT;
1070 pub const MOD_TAI: ::c_uint = ADJ_TAI;
1071 pub const MOD_MICRO: ::c_uint = ADJ_MICRO;
1072 pub const MOD_NANO: ::c_uint = ADJ_NANO;
1073 pub const STA_PLL: ::c_int = 0x0001;
1074 pub const STA_PPSFREQ: ::c_int = 0x0002;
1075 pub const STA_PPSTIME: ::c_int = 0x0004;
1076 pub const STA_FLL: ::c_int = 0x0008;
1077 pub const STA_INS: ::c_int = 0x0010;
1078 pub const STA_DEL: ::c_int = 0x0020;
1079 pub const STA_UNSYNC: ::c_int = 0x0040;
1080 pub const STA_FREQHOLD: ::c_int = 0x0080;
1081 pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1082 pub const STA_PPSJITTER: ::c_int = 0x0200;
1083 pub const STA_PPSWANDER: ::c_int = 0x0400;
1084 pub const STA_PPSERROR: ::c_int = 0x0800;
1085 pub const STA_CLOCKERR: ::c_int = 0x1000;
1086 pub const STA_NANO: ::c_int = 0x2000;
1087 pub const STA_MODE: ::c_int = 0x4000;
1088 pub const STA_CLK: ::c_int = 0x8000;
1089 pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
1090 | STA_PPSJITTER
1091 | STA_PPSWANDER
1092 | STA_PPSERROR
1093 | STA_CLOCKERR
1094 | STA_NANO
1095 | STA_MODE
1096 | STA_CLK;
1097 pub const NTP_API: ::c_int = 4;
1098 pub const TIME_OK: ::c_int = 0;
1099 pub const TIME_INS: ::c_int = 1;
1100 pub const TIME_DEL: ::c_int = 2;
1101 pub const TIME_OOP: ::c_int = 3;
1102 pub const TIME_WAIT: ::c_int = 4;
1103 pub const TIME_ERROR: ::c_int = 5;
1104 pub const TIME_BAD: ::c_int = TIME_ERROR;
1105 pub const MAXTC: ::c_long = 6;
1106
1107 cfg_if! {
1108 if #[cfg(any(
1109 target_arch = "arm",
1110 target_arch = "x86",
1111 target_arch = "x86_64",
1112 target_arch = "s390x",
1113 target_arch = "riscv64",
1114 target_arch = "riscv32"
1115 ))] {
1116 pub const PTHREAD_STACK_MIN: ::size_t = 16384;
1117 } else if #[cfg(any(
1118 target_arch = "sparc",
1119 target_arch = "sparc64"
1120 ))] {
1121 pub const PTHREAD_STACK_MIN: ::size_t = 0x6000;
1122 } else {
1123 pub const PTHREAD_STACK_MIN: ::size_t = 131072;
1124 }
1125 }
1126 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;
1127
1128 pub const REG_STARTEND: ::c_int = 4;
1129
1130 pub const REG_EEND: ::c_int = 14;
1131 pub const REG_ESIZE: ::c_int = 15;
1132 pub const REG_ERPAREN: ::c_int = 16;
1133
1134 extern "C" {
1135 pub fn fgetspent_r(
1136 fp: *mut ::FILE,
1137 spbuf: *mut ::spwd,
1138 buf: *mut ::c_char,
1139 buflen: ::size_t,
1140 spbufp: *mut *mut ::spwd,
1141 ) -> ::c_int;
1142 pub fn sgetspent_r(
1143 s: *const ::c_char,
1144 spbuf: *mut ::spwd,
1145 buf: *mut ::c_char,
1146 buflen: ::size_t,
1147 spbufp: *mut *mut ::spwd,
1148 ) -> ::c_int;
1149 pub fn getspent_r(
1150 spbuf: *mut ::spwd,
1151 buf: *mut ::c_char,
1152 buflen: ::size_t,
1153 spbufp: *mut *mut ::spwd,
1154 ) -> ::c_int;
1155 pub fn qsort_r(
1156 base: *mut ::c_void,
1157 num: ::size_t,
1158 size: ::size_t,
1159 compar: ::Option<
1160 unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int,
1161 >,
1162 arg: *mut ::c_void,
1163 );
1164 pub fn sendmmsg(
1165 sockfd: ::c_int,
1166 msgvec: *mut ::mmsghdr,
1167 vlen: ::c_uint,
1168 flags: ::c_int,
1169 ) -> ::c_int;
1170 pub fn recvmmsg(
1171 sockfd: ::c_int,
1172 msgvec: *mut ::mmsghdr,
1173 vlen: ::c_uint,
1174 flags: ::c_int,
1175 timeout: *mut ::timespec,
1176 ) -> ::c_int;
1177
1178 pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
1179 pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
1180 pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
1181 pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
1182 pub fn prlimit(
1183 pid: ::pid_t,
1184 resource: ::__rlimit_resource_t,
1185 new_limit: *const ::rlimit,
1186 old_limit: *mut ::rlimit,
1187 ) -> ::c_int;
1188 pub fn prlimit64(
1189 pid: ::pid_t,
1190 resource: ::__rlimit_resource_t,
1191 new_limit: *const ::rlimit64,
1192 old_limit: *mut ::rlimit64,
1193 ) -> ::c_int;
1194 pub fn utmpname(file: *const ::c_char) -> ::c_int;
1195 pub fn utmpxname(file: *const ::c_char) -> ::c_int;
1196 pub fn getutxent() -> *mut utmpx;
1197 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1198 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1199 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1200 pub fn setutxent();
1201 pub fn endutxent();
1202 pub fn getpt() -> ::c_int;
1203 pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int;
1204 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
1205 pub fn statx(
1206 dirfd: ::c_int,
1207 pathname: *const c_char,
1208 flags: ::c_int,
1209 mask: ::c_uint,
1210 statxbuf: *mut statx,
1211 ) -> ::c_int;
1212 pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
1213
1214 pub fn memmem(
1215 haystack: *const ::c_void,
1216 haystacklen: ::size_t,
1217 needle: *const ::c_void,
1218 needlelen: ::size_t,
1219 ) -> *mut ::c_void;
1220 pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
1221
1222 pub fn adjtimex(buf: *mut timex) -> ::c_int;
1223 pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
1224 #[link_name = "ntp_gettimex"]
1225 pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
1226 pub fn copy_file_range(
1227 fd_in: ::c_int,
1228 off_in: *mut ::off64_t,
1229 fd_out: ::c_int,
1230 off_out: *mut ::off64_t,
1231 len: ::size_t,
1232 flags: ::c_uint,
1233 ) -> ::ssize_t;
1234 pub fn fanotify_mark(
1235 fd: ::c_int,
1236 flags: ::c_uint,
1237 mask: u64,
1238 dirfd: ::c_int,
1239 path: *const ::c_char,
1240 ) -> ::c_int;
1241 pub fn preadv2(
1242 fd: ::c_int,
1243 iov: *const ::iovec,
1244 iovcnt: ::c_int,
1245 offset: ::off_t,
1246 flags: ::c_int,
1247 ) -> ::ssize_t;
1248 pub fn pwritev2(
1249 fd: ::c_int,
1250 iov: *const ::iovec,
1251 iovcnt: ::c_int,
1252 offset: ::off_t,
1253 flags: ::c_int,
1254 ) -> ::ssize_t;
1255 pub fn preadv64v2(
1256 fd: ::c_int,
1257 iov: *const ::iovec,
1258 iovcnt: ::c_int,
1259 offset: ::off64_t,
1260 flags: ::c_int,
1261 ) -> ::ssize_t;
1262 pub fn pwritev64v2(
1263 fd: ::c_int,
1264 iov: *const ::iovec,
1265 iovcnt: ::c_int,
1266 offset: ::off64_t,
1267 flags: ::c_int,
1268 ) -> ::ssize_t;
1269 pub fn renameat2(
1270 olddirfd: ::c_int,
1271 oldpath: *const ::c_char,
1272 newdirfd: ::c_int,
1273 newpath: *const ::c_char,
1274 flags: ::c_uint,
1275 ) -> ::c_int;
1276
1277 // Added in `glibc` 2.25
1278 pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
1279 // Added in `glibc` 2.29
1280 pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
1281 }
1282
1283 extern "C" {
1284 pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
1285 pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
1286 pub fn glob64(
1287 pattern: *const ::c_char,
1288 flags: ::c_int,
1289 errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
1290 pglob: *mut glob64_t,
1291 ) -> ::c_int;
1292 pub fn globfree64(pglob: *mut glob64_t);
1293 pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
1294 pub fn pthread_attr_getaffinity_np(
1295 attr: *const ::pthread_attr_t,
1296 cpusetsize: ::size_t,
1297 cpuset: *mut ::cpu_set_t,
1298 ) -> ::c_int;
1299 pub fn pthread_attr_setaffinity_np(
1300 attr: *mut ::pthread_attr_t,
1301 cpusetsize: ::size_t,
1302 cpuset: *const ::cpu_set_t,
1303 ) -> ::c_int;
1304 pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
1305 pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
1306 pub fn pthread_getaffinity_np(
1307 thread: ::pthread_t,
1308 cpusetsize: ::size_t,
1309 cpuset: *mut ::cpu_set_t,
1310 ) -> ::c_int;
1311 pub fn pthread_setaffinity_np(
1312 thread: ::pthread_t,
1313 cpusetsize: ::size_t,
1314 cpuset: *const ::cpu_set_t,
1315 ) -> ::c_int;
1316 pub fn pthread_rwlockattr_getkind_np(
1317 attr: *const ::pthread_rwlockattr_t,
1318 val: *mut ::c_int,
1319 ) -> ::c_int;
1320 pub fn pthread_rwlockattr_setkind_np(
1321 attr: *mut ::pthread_rwlockattr_t,
1322 val: ::c_int,
1323 ) -> ::c_int;
1324 pub fn sched_getcpu() -> ::c_int;
1325 pub fn mallinfo() -> ::mallinfo;
1326 pub fn mallinfo2() -> ::mallinfo2;
1327 pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
1328 pub fn getpwent_r(
1329 pwd: *mut ::passwd,
1330 buf: *mut ::c_char,
1331 buflen: ::size_t,
1332 result: *mut *mut ::passwd,
1333 ) -> ::c_int;
1334 pub fn getgrent_r(
1335 grp: *mut ::group,
1336 buf: *mut ::c_char,
1337 buflen: ::size_t,
1338 result: *mut *mut ::group,
1339 ) -> ::c_int;
1340 pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
1341 pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
1342 }
1343
1344 extern "C" {
1345 pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1346 pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
1347 pub fn dladdr1(
1348 addr: *const ::c_void,
1349 info: *mut ::Dl_info,
1350 extra_info: *mut *mut ::c_void,
1351 flags: ::c_int,
1352 ) -> ::c_int;
1353 }
1354
1355 cfg_if! {
1356 if #[cfg(any(target_arch = "x86",
1357 target_arch = "arm",
1358 target_arch = "mips",
1359 target_arch = "powerpc",
1360 target_arch = "sparc",
1361 target_arch = "riscv32"))] {
1362 mod b32;
1363 pub use self::b32::*;
1364 } else if #[cfg(any(target_arch = "x86_64",
1365 target_arch = "aarch64",
1366 target_arch = "powerpc64",
1367 target_arch = "mips64",
1368 target_arch = "s390x",
1369 target_arch = "sparc64",
1370 target_arch = "riscv64"))] {
1371 mod b64;
1372 pub use self::b64::*;
1373 } else {
1374 // Unknown target_arch
1375 }
1376 }
1377
1378 cfg_if! {
1379 if #[cfg(libc_align)] {
1380 mod align;
1381 pub use self::align::*;
1382 } else {
1383 mod no_align;
1384 pub use self::no_align::*;
1385 }
1386 }