1 | use crate::off64_t; |
2 | use crate::prelude::*; |
3 | |
4 | pub type pthread_t = c_ulong; |
5 | pub type __priority_which_t = c_uint; |
6 | pub type __rlimit_resource_t = c_uint; |
7 | pub type Lmid_t = c_long; |
8 | pub type regoff_t = c_int; |
9 | pub type __kernel_rwf_t = c_int; |
10 | |
11 | cfg_if! { |
12 | if #[cfg(doc)] { |
13 | // Used in `linux::arch` to define ioctl constants. |
14 | pub(crate) type Ioctl = c_ulong; |
15 | } else { |
16 | #[doc (hidden)] |
17 | pub type Ioctl = c_ulong; |
18 | } |
19 | } |
20 | |
21 | s! { |
22 | pub struct aiocb { |
23 | pub aio_fildes: c_int, |
24 | pub aio_lio_opcode: c_int, |
25 | pub aio_reqprio: c_int, |
26 | pub aio_buf: *mut c_void, |
27 | pub aio_nbytes: size_t, |
28 | pub aio_sigevent: crate::sigevent, |
29 | __next_prio: *mut aiocb, |
30 | __abs_prio: c_int, |
31 | __policy: c_int, |
32 | __error_code: c_int, |
33 | __return_value: ssize_t, |
34 | pub aio_offset: off_t, |
35 | #[cfg (all( |
36 | not(gnu_file_offset_bits64), |
37 | not(target_arch = "x86_64" ), |
38 | target_pointer_width = "32" |
39 | ))] |
40 | __unused1: [c_char; 4], |
41 | __glibc_reserved: [c_char; 32], |
42 | } |
43 | |
44 | pub struct __exit_status { |
45 | pub e_termination: c_short, |
46 | pub e_exit: c_short, |
47 | } |
48 | |
49 | pub struct __timeval { |
50 | pub tv_sec: i32, |
51 | pub tv_usec: i32, |
52 | } |
53 | |
54 | pub struct glob64_t { |
55 | pub gl_pathc: size_t, |
56 | pub gl_pathv: *mut *mut c_char, |
57 | pub gl_offs: size_t, |
58 | pub gl_flags: c_int, |
59 | |
60 | __unused1: *mut c_void, |
61 | __unused2: *mut c_void, |
62 | __unused3: *mut c_void, |
63 | __unused4: *mut c_void, |
64 | __unused5: *mut c_void, |
65 | } |
66 | |
67 | pub struct msghdr { |
68 | pub msg_name: *mut c_void, |
69 | pub msg_namelen: crate::socklen_t, |
70 | pub msg_iov: *mut crate::iovec, |
71 | pub msg_iovlen: size_t, |
72 | pub msg_control: *mut c_void, |
73 | pub msg_controllen: size_t, |
74 | pub msg_flags: c_int, |
75 | } |
76 | |
77 | pub struct cmsghdr { |
78 | pub cmsg_len: size_t, |
79 | pub cmsg_level: c_int, |
80 | pub cmsg_type: c_int, |
81 | } |
82 | |
83 | pub struct termios { |
84 | pub c_iflag: crate::tcflag_t, |
85 | pub c_oflag: crate::tcflag_t, |
86 | pub c_cflag: crate::tcflag_t, |
87 | pub c_lflag: crate::tcflag_t, |
88 | pub c_line: crate::cc_t, |
89 | pub c_cc: [crate::cc_t; crate::NCCS], |
90 | #[cfg (not(any( |
91 | target_arch = "sparc" , |
92 | target_arch = "sparc64" , |
93 | target_arch = "mips" , |
94 | target_arch = "mips32r6" , |
95 | target_arch = "mips64" , |
96 | target_arch = "mips64r6" |
97 | )))] |
98 | pub c_ispeed: crate::speed_t, |
99 | #[cfg (not(any( |
100 | target_arch = "sparc" , |
101 | target_arch = "sparc64" , |
102 | target_arch = "mips" , |
103 | target_arch = "mips32r6" , |
104 | target_arch = "mips64" , |
105 | target_arch = "mips64r6" |
106 | )))] |
107 | pub c_ospeed: crate::speed_t, |
108 | } |
109 | |
110 | pub struct mallinfo { |
111 | pub arena: c_int, |
112 | pub ordblks: c_int, |
113 | pub smblks: c_int, |
114 | pub hblks: c_int, |
115 | pub hblkhd: c_int, |
116 | pub usmblks: c_int, |
117 | pub fsmblks: c_int, |
118 | pub uordblks: c_int, |
119 | pub fordblks: c_int, |
120 | pub keepcost: c_int, |
121 | } |
122 | |
123 | pub struct mallinfo2 { |
124 | pub arena: size_t, |
125 | pub ordblks: size_t, |
126 | pub smblks: size_t, |
127 | pub hblks: size_t, |
128 | pub hblkhd: size_t, |
129 | pub usmblks: size_t, |
130 | pub fsmblks: size_t, |
131 | pub uordblks: size_t, |
132 | pub fordblks: size_t, |
133 | pub keepcost: size_t, |
134 | } |
135 | |
136 | pub struct nl_pktinfo { |
137 | pub group: u32, |
138 | } |
139 | |
140 | pub struct nl_mmap_req { |
141 | pub nm_block_size: c_uint, |
142 | pub nm_block_nr: c_uint, |
143 | pub nm_frame_size: c_uint, |
144 | pub nm_frame_nr: c_uint, |
145 | } |
146 | |
147 | pub struct nl_mmap_hdr { |
148 | pub nm_status: c_uint, |
149 | pub nm_len: c_uint, |
150 | pub nm_group: u32, |
151 | pub nm_pid: u32, |
152 | pub nm_uid: u32, |
153 | pub nm_gid: u32, |
154 | } |
155 | |
156 | pub struct rtentry { |
157 | pub rt_pad1: c_ulong, |
158 | pub rt_dst: crate::sockaddr, |
159 | pub rt_gateway: crate::sockaddr, |
160 | pub rt_genmask: crate::sockaddr, |
161 | pub rt_flags: c_ushort, |
162 | pub rt_pad2: c_short, |
163 | pub rt_pad3: c_ulong, |
164 | pub rt_tos: c_uchar, |
165 | pub rt_class: c_uchar, |
166 | #[cfg (target_pointer_width = "64" )] |
167 | pub rt_pad4: [c_short; 3usize], |
168 | #[cfg (not(target_pointer_width = "64" ))] |
169 | pub rt_pad4: c_short, |
170 | pub rt_metric: c_short, |
171 | pub rt_dev: *mut c_char, |
172 | pub rt_mtu: c_ulong, |
173 | pub rt_window: c_ulong, |
174 | pub rt_irtt: c_ushort, |
175 | } |
176 | |
177 | pub struct timex { |
178 | pub modes: c_uint, |
179 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
180 | pub offset: i64, |
181 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
182 | pub offset: c_long, |
183 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
184 | pub freq: i64, |
185 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
186 | pub freq: c_long, |
187 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
188 | pub maxerror: i64, |
189 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
190 | pub maxerror: c_long, |
191 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
192 | pub esterror: i64, |
193 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
194 | pub esterror: c_long, |
195 | pub status: c_int, |
196 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
197 | pub constant: i64, |
198 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
199 | pub constant: c_long, |
200 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
201 | pub precision: i64, |
202 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
203 | pub precision: c_long, |
204 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
205 | pub tolerance: i64, |
206 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
207 | pub tolerance: c_long, |
208 | pub time: crate::timeval, |
209 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
210 | pub tick: i64, |
211 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
212 | pub tick: c_long, |
213 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
214 | pub ppsfreq: i64, |
215 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
216 | pub ppsfreq: c_long, |
217 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
218 | pub jitter: i64, |
219 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
220 | pub jitter: c_long, |
221 | pub shift: c_int, |
222 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
223 | pub stabil: i64, |
224 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
225 | pub stabil: c_long, |
226 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
227 | pub jitcnt: i64, |
228 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
229 | pub jitcnt: c_long, |
230 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
231 | pub calcnt: i64, |
232 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
233 | pub calcnt: c_long, |
234 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
235 | pub errcnt: i64, |
236 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
237 | pub errcnt: c_long, |
238 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
239 | pub stbcnt: i64, |
240 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
241 | pub stbcnt: c_long, |
242 | pub tai: c_int, |
243 | pub __unused1: i32, |
244 | pub __unused2: i32, |
245 | pub __unused3: i32, |
246 | pub __unused4: i32, |
247 | pub __unused5: i32, |
248 | pub __unused6: i32, |
249 | pub __unused7: i32, |
250 | pub __unused8: i32, |
251 | pub __unused9: i32, |
252 | pub __unused10: i32, |
253 | pub __unused11: i32, |
254 | } |
255 | |
256 | pub struct ntptimeval { |
257 | pub time: crate::timeval, |
258 | pub maxerror: c_long, |
259 | pub esterror: c_long, |
260 | pub tai: c_long, |
261 | pub __glibc_reserved1: c_long, |
262 | pub __glibc_reserved2: c_long, |
263 | pub __glibc_reserved3: c_long, |
264 | pub __glibc_reserved4: c_long, |
265 | } |
266 | |
267 | pub struct regex_t { |
268 | __buffer: *mut c_void, |
269 | __allocated: size_t, |
270 | __used: size_t, |
271 | __syntax: c_ulong, |
272 | __fastmap: *mut c_char, |
273 | __translate: *mut c_char, |
274 | __re_nsub: size_t, |
275 | __bitfield: u8, |
276 | } |
277 | |
278 | pub struct Elf64_Chdr { |
279 | pub ch_type: crate::Elf64_Word, |
280 | pub ch_reserved: crate::Elf64_Word, |
281 | pub ch_size: crate::Elf64_Xword, |
282 | pub ch_addralign: crate::Elf64_Xword, |
283 | } |
284 | |
285 | pub struct Elf32_Chdr { |
286 | pub ch_type: crate::Elf32_Word, |
287 | pub ch_size: crate::Elf32_Word, |
288 | pub ch_addralign: crate::Elf32_Word, |
289 | } |
290 | |
291 | pub struct seminfo { |
292 | pub semmap: c_int, |
293 | pub semmni: c_int, |
294 | pub semmns: c_int, |
295 | pub semmnu: c_int, |
296 | pub semmsl: c_int, |
297 | pub semopm: c_int, |
298 | pub semume: c_int, |
299 | pub semusz: c_int, |
300 | pub semvmx: c_int, |
301 | pub semaem: c_int, |
302 | } |
303 | |
304 | pub struct ptrace_peeksiginfo_args { |
305 | pub off: crate::__u64, |
306 | pub flags: crate::__u32, |
307 | pub nr: crate::__s32, |
308 | } |
309 | |
310 | pub struct __c_anonymous_ptrace_syscall_info_entry { |
311 | pub nr: crate::__u64, |
312 | pub args: [crate::__u64; 6], |
313 | } |
314 | |
315 | pub struct __c_anonymous_ptrace_syscall_info_exit { |
316 | pub sval: crate::__s64, |
317 | pub is_error: crate::__u8, |
318 | } |
319 | |
320 | pub struct __c_anonymous_ptrace_syscall_info_seccomp { |
321 | pub nr: crate::__u64, |
322 | pub args: [crate::__u64; 6], |
323 | pub ret_data: crate::__u32, |
324 | } |
325 | |
326 | pub struct ptrace_syscall_info { |
327 | pub op: crate::__u8, |
328 | pub pad: [crate::__u8; 3], |
329 | pub arch: crate::__u32, |
330 | pub instruction_pointer: crate::__u64, |
331 | pub stack_pointer: crate::__u64, |
332 | pub u: __c_anonymous_ptrace_syscall_info_data, |
333 | } |
334 | |
335 | pub struct ptrace_sud_config { |
336 | pub mode: crate::__u64, |
337 | pub selector: crate::__u64, |
338 | pub offset: crate::__u64, |
339 | pub len: crate::__u64, |
340 | } |
341 | |
342 | pub struct iocb { |
343 | pub aio_data: crate::__u64, |
344 | #[cfg (target_endian = "little" )] |
345 | pub aio_key: crate::__u32, |
346 | #[cfg (target_endian = "little" )] |
347 | pub aio_rw_flags: crate::__kernel_rwf_t, |
348 | #[cfg (target_endian = "big" )] |
349 | pub aio_rw_flags: crate::__kernel_rwf_t, |
350 | #[cfg (target_endian = "big" )] |
351 | pub aio_key: crate::__u32, |
352 | pub aio_lio_opcode: crate::__u16, |
353 | pub aio_reqprio: crate::__s16, |
354 | pub aio_fildes: crate::__u32, |
355 | pub aio_buf: crate::__u64, |
356 | pub aio_nbytes: crate::__u64, |
357 | pub aio_offset: crate::__s64, |
358 | aio_reserved2: crate::__u64, |
359 | pub aio_flags: crate::__u32, |
360 | pub aio_resfd: crate::__u32, |
361 | } |
362 | |
363 | // netinet/tcp.h |
364 | |
365 | pub struct tcp_info { |
366 | pub tcpi_state: u8, |
367 | pub tcpi_ca_state: u8, |
368 | pub tcpi_retransmits: u8, |
369 | pub tcpi_probes: u8, |
370 | pub tcpi_backoff: u8, |
371 | pub tcpi_options: u8, |
372 | /// This contains the bitfields `tcpi_snd_wscale` and `tcpi_rcv_wscale`. |
373 | /// Each is 4 bits. |
374 | pub tcpi_snd_rcv_wscale: u8, |
375 | pub tcpi_rto: u32, |
376 | pub tcpi_ato: u32, |
377 | pub tcpi_snd_mss: u32, |
378 | pub tcpi_rcv_mss: u32, |
379 | pub tcpi_unacked: u32, |
380 | pub tcpi_sacked: u32, |
381 | pub tcpi_lost: u32, |
382 | pub tcpi_retrans: u32, |
383 | pub tcpi_fackets: u32, |
384 | pub tcpi_last_data_sent: u32, |
385 | pub tcpi_last_ack_sent: u32, |
386 | pub tcpi_last_data_recv: u32, |
387 | pub tcpi_last_ack_recv: u32, |
388 | pub tcpi_pmtu: u32, |
389 | pub tcpi_rcv_ssthresh: u32, |
390 | pub tcpi_rtt: u32, |
391 | pub tcpi_rttvar: u32, |
392 | pub tcpi_snd_ssthresh: u32, |
393 | pub tcpi_snd_cwnd: u32, |
394 | pub tcpi_advmss: u32, |
395 | pub tcpi_reordering: u32, |
396 | pub tcpi_rcv_rtt: u32, |
397 | pub tcpi_rcv_space: u32, |
398 | pub tcpi_total_retrans: u32, |
399 | } |
400 | |
401 | pub struct fanotify_event_info_pidfd { |
402 | pub hdr: crate::fanotify_event_info_header, |
403 | pub pidfd: crate::__s32, |
404 | } |
405 | |
406 | pub struct fanotify_event_info_error { |
407 | pub hdr: crate::fanotify_event_info_header, |
408 | pub error: crate::__s32, |
409 | pub error_count: crate::__u32, |
410 | } |
411 | |
412 | // FIXME(1.0) this is actually a union |
413 | #[cfg_attr (target_pointer_width = "32" , repr(align(4)))] |
414 | #[cfg_attr (target_pointer_width = "64" , repr(align(8)))] |
415 | pub struct sem_t { |
416 | #[cfg (target_pointer_width = "32" )] |
417 | __size: [c_char; 16], |
418 | #[cfg (target_pointer_width = "64" )] |
419 | __size: [c_char; 32], |
420 | } |
421 | |
422 | pub struct mbstate_t { |
423 | __count: c_int, |
424 | __wchb: [c_char; 4], |
425 | } |
426 | |
427 | pub struct fpos64_t { |
428 | __pos: off64_t, |
429 | __state: crate::mbstate_t, |
430 | } |
431 | |
432 | pub struct fpos_t { |
433 | #[cfg (not(gnu_file_offset_bits64))] |
434 | __pos: off_t, |
435 | #[cfg (gnu_file_offset_bits64)] |
436 | __pos: off64_t, |
437 | __state: crate::mbstate_t, |
438 | } |
439 | } |
440 | |
441 | impl siginfo_t { |
442 | pub unsafe fn si_addr(&self) -> *mut c_void { |
443 | #[repr (C)] |
444 | struct siginfo_sigfault { |
445 | _si_signo: c_int, |
446 | _si_errno: c_int, |
447 | _si_code: c_int, |
448 | si_addr: *mut c_void, |
449 | } |
450 | (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr |
451 | } |
452 | |
453 | pub unsafe fn si_value(&self) -> crate::sigval { |
454 | #[repr (C)] |
455 | struct siginfo_timer { |
456 | _si_signo: c_int, |
457 | _si_errno: c_int, |
458 | _si_code: c_int, |
459 | _si_tid: c_int, |
460 | _si_overrun: c_int, |
461 | si_sigval: crate::sigval, |
462 | } |
463 | (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval |
464 | } |
465 | } |
466 | |
467 | // Internal, for casts to access union fields |
468 | #[repr (C)] |
469 | struct sifields_sigchld { |
470 | si_pid: crate::pid_t, |
471 | si_uid: crate::uid_t, |
472 | si_status: c_int, |
473 | si_utime: c_long, |
474 | si_stime: c_long, |
475 | } |
476 | impl Copy for sifields_sigchld {} |
477 | impl Clone for sifields_sigchld { |
478 | fn clone(&self) -> sifields_sigchld { |
479 | *self |
480 | } |
481 | } |
482 | |
483 | // Internal, for casts to access union fields |
484 | #[repr (C)] |
485 | union sifields { |
486 | _align_pointer: *mut c_void, |
487 | sigchld: sifields_sigchld, |
488 | } |
489 | |
490 | // Internal, for casts to access union fields. Note that some variants |
491 | // of sifields start with a pointer, which makes the alignment of |
492 | // sifields vary on 32-bit and 64-bit architectures. |
493 | #[repr (C)] |
494 | struct siginfo_f { |
495 | _siginfo_base: [c_int; 3], |
496 | sifields: sifields, |
497 | } |
498 | |
499 | impl siginfo_t { |
500 | unsafe fn sifields(&self) -> &sifields { |
501 | &(*(self as *const siginfo_t as *const siginfo_f)).sifields |
502 | } |
503 | |
504 | pub unsafe fn si_pid(&self) -> crate::pid_t { |
505 | self.sifields().sigchld.si_pid |
506 | } |
507 | |
508 | pub unsafe fn si_uid(&self) -> crate::uid_t { |
509 | self.sifields().sigchld.si_uid |
510 | } |
511 | |
512 | pub unsafe fn si_status(&self) -> c_int { |
513 | self.sifields().sigchld.si_status |
514 | } |
515 | |
516 | pub unsafe fn si_utime(&self) -> c_long { |
517 | self.sifields().sigchld.si_utime |
518 | } |
519 | |
520 | pub unsafe fn si_stime(&self) -> c_long { |
521 | self.sifields().sigchld.si_stime |
522 | } |
523 | } |
524 | |
525 | pub union __c_anonymous_ptrace_syscall_info_data { |
526 | pub entry: __c_anonymous_ptrace_syscall_info_entry, |
527 | pub exit: __c_anonymous_ptrace_syscall_info_exit, |
528 | pub seccomp: __c_anonymous_ptrace_syscall_info_seccomp, |
529 | } |
530 | impl Copy for __c_anonymous_ptrace_syscall_info_data {} |
531 | impl Clone for __c_anonymous_ptrace_syscall_info_data { |
532 | fn clone(&self) -> __c_anonymous_ptrace_syscall_info_data { |
533 | *self |
534 | } |
535 | } |
536 | |
537 | s_no_extra_traits! { |
538 | pub struct utmpx { |
539 | pub ut_type: c_short, |
540 | pub ut_pid: crate::pid_t, |
541 | pub ut_line: [c_char; __UT_LINESIZE], |
542 | pub ut_id: [c_char; 4], |
543 | |
544 | pub ut_user: [c_char; __UT_NAMESIZE], |
545 | pub ut_host: [c_char; __UT_HOSTSIZE], |
546 | pub ut_exit: __exit_status, |
547 | |
548 | #[cfg (any( |
549 | target_arch = "aarch64" , |
550 | target_arch = "s390x" , |
551 | target_arch = "loongarch64" , |
552 | all(target_pointer_width = "32" , not(target_arch = "x86_64" )) |
553 | ))] |
554 | pub ut_session: c_long, |
555 | #[cfg (any( |
556 | target_arch = "aarch64" , |
557 | target_arch = "s390x" , |
558 | target_arch = "loongarch64" , |
559 | all(target_pointer_width = "32" , not(target_arch = "x86_64" )) |
560 | ))] |
561 | pub ut_tv: crate::timeval, |
562 | |
563 | #[cfg (not(any( |
564 | target_arch = "aarch64" , |
565 | target_arch = "s390x" , |
566 | target_arch = "loongarch64" , |
567 | all(target_pointer_width = "32" , not(target_arch = "x86_64" )) |
568 | )))] |
569 | pub ut_session: i32, |
570 | #[cfg (not(any( |
571 | target_arch = "aarch64" , |
572 | target_arch = "s390x" , |
573 | target_arch = "loongarch64" , |
574 | all(target_pointer_width = "32" , not(target_arch = "x86_64" )) |
575 | )))] |
576 | pub ut_tv: __timeval, |
577 | |
578 | pub ut_addr_v6: [i32; 4], |
579 | __glibc_reserved: [c_char; 20], |
580 | } |
581 | } |
582 | |
583 | cfg_if! { |
584 | if #[cfg(feature = "extra_traits" )] { |
585 | impl PartialEq for utmpx { |
586 | fn eq(&self, other: &utmpx) -> bool { |
587 | self.ut_type == other.ut_type |
588 | && self.ut_pid == other.ut_pid |
589 | && self.ut_line == other.ut_line |
590 | && self.ut_id == other.ut_id |
591 | && self.ut_user == other.ut_user |
592 | && self |
593 | .ut_host |
594 | .iter() |
595 | .zip(other.ut_host.iter()) |
596 | .all(|(a, b)| a == b) |
597 | && self.ut_exit == other.ut_exit |
598 | && self.ut_session == other.ut_session |
599 | && self.ut_tv == other.ut_tv |
600 | && self.ut_addr_v6 == other.ut_addr_v6 |
601 | && self.__glibc_reserved == other.__glibc_reserved |
602 | } |
603 | } |
604 | |
605 | impl Eq for utmpx {} |
606 | |
607 | impl fmt::Debug for utmpx { |
608 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
609 | f.debug_struct("utmpx" ) |
610 | .field("ut_type" , &self.ut_type) |
611 | .field("ut_pid" , &self.ut_pid) |
612 | .field("ut_line" , &self.ut_line) |
613 | .field("ut_id" , &self.ut_id) |
614 | .field("ut_user" , &self.ut_user) |
615 | // FIXME(debug): .field("ut_host", &self.ut_host) |
616 | .field("ut_exit" , &self.ut_exit) |
617 | .field("ut_session" , &self.ut_session) |
618 | .field("ut_tv" , &self.ut_tv) |
619 | .field("ut_addr_v6" , &self.ut_addr_v6) |
620 | .field("__glibc_reserved" , &self.__glibc_reserved) |
621 | .finish() |
622 | } |
623 | } |
624 | |
625 | impl hash::Hash for utmpx { |
626 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
627 | self.ut_type.hash(state); |
628 | self.ut_pid.hash(state); |
629 | self.ut_line.hash(state); |
630 | self.ut_id.hash(state); |
631 | self.ut_user.hash(state); |
632 | self.ut_host.hash(state); |
633 | self.ut_exit.hash(state); |
634 | self.ut_session.hash(state); |
635 | self.ut_tv.hash(state); |
636 | self.ut_addr_v6.hash(state); |
637 | self.__glibc_reserved.hash(state); |
638 | } |
639 | } |
640 | |
641 | impl PartialEq for __c_anonymous_ptrace_syscall_info_data { |
642 | fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool { |
643 | unsafe { |
644 | self.entry == other.entry |
645 | || self.exit == other.exit |
646 | || self.seccomp == other.seccomp |
647 | } |
648 | } |
649 | } |
650 | |
651 | impl Eq for __c_anonymous_ptrace_syscall_info_data {} |
652 | |
653 | impl fmt::Debug for __c_anonymous_ptrace_syscall_info_data { |
654 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
655 | unsafe { |
656 | f.debug_struct("__c_anonymous_ptrace_syscall_info_data" ) |
657 | .field("entry" , &self.entry) |
658 | .field("exit" , &self.exit) |
659 | .field("seccomp" , &self.seccomp) |
660 | .finish() |
661 | } |
662 | } |
663 | } |
664 | |
665 | impl hash::Hash for __c_anonymous_ptrace_syscall_info_data { |
666 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
667 | unsafe { |
668 | self.entry.hash(state); |
669 | self.exit.hash(state); |
670 | self.seccomp.hash(state); |
671 | } |
672 | } |
673 | } |
674 | } |
675 | } |
676 | |
677 | // include/uapi/asm-generic/hugetlb_encode.h |
678 | pub const HUGETLB_FLAG_ENCODE_SHIFT: c_int = 26; |
679 | pub const HUGETLB_FLAG_ENCODE_MASK: c_int = 0x3f; |
680 | |
681 | pub const HUGETLB_FLAG_ENCODE_64KB: c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT; |
682 | pub const HUGETLB_FLAG_ENCODE_512KB: c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT; |
683 | pub const HUGETLB_FLAG_ENCODE_1MB: c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT; |
684 | pub const HUGETLB_FLAG_ENCODE_2MB: c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT; |
685 | pub const HUGETLB_FLAG_ENCODE_8MB: c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT; |
686 | pub const HUGETLB_FLAG_ENCODE_16MB: c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT; |
687 | pub const HUGETLB_FLAG_ENCODE_32MB: c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT; |
688 | pub const HUGETLB_FLAG_ENCODE_256MB: c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT; |
689 | pub const HUGETLB_FLAG_ENCODE_512MB: c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT; |
690 | pub const HUGETLB_FLAG_ENCODE_1GB: c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT; |
691 | pub const HUGETLB_FLAG_ENCODE_2GB: c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT; |
692 | pub const HUGETLB_FLAG_ENCODE_16GB: c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT; |
693 | |
694 | // include/uapi/linux/mman.h |
695 | /* |
696 | * Huge page size encoding when MAP_HUGETLB is specified, and a huge page |
697 | * size other than the default is desired. See hugetlb_encode.h. |
698 | * All known huge page size encodings are provided here. It is the |
699 | * responsibility of the application to know which sizes are supported on |
700 | * the running system. See mmap(2) man page for details. |
701 | */ |
702 | pub const MAP_HUGE_SHIFT: c_int = HUGETLB_FLAG_ENCODE_SHIFT; |
703 | pub const MAP_HUGE_MASK: c_int = HUGETLB_FLAG_ENCODE_MASK; |
704 | |
705 | pub const MAP_HUGE_64KB: c_int = HUGETLB_FLAG_ENCODE_64KB; |
706 | pub const MAP_HUGE_512KB: c_int = HUGETLB_FLAG_ENCODE_512KB; |
707 | pub const MAP_HUGE_1MB: c_int = HUGETLB_FLAG_ENCODE_1MB; |
708 | pub const MAP_HUGE_2MB: c_int = HUGETLB_FLAG_ENCODE_2MB; |
709 | pub const MAP_HUGE_8MB: c_int = HUGETLB_FLAG_ENCODE_8MB; |
710 | pub const MAP_HUGE_16MB: c_int = HUGETLB_FLAG_ENCODE_16MB; |
711 | pub const MAP_HUGE_32MB: c_int = HUGETLB_FLAG_ENCODE_32MB; |
712 | pub const MAP_HUGE_256MB: c_int = HUGETLB_FLAG_ENCODE_256MB; |
713 | pub const MAP_HUGE_512MB: c_int = HUGETLB_FLAG_ENCODE_512MB; |
714 | pub const MAP_HUGE_1GB: c_int = HUGETLB_FLAG_ENCODE_1GB; |
715 | pub const MAP_HUGE_2GB: c_int = HUGETLB_FLAG_ENCODE_2GB; |
716 | pub const MAP_HUGE_16GB: c_int = HUGETLB_FLAG_ENCODE_16GB; |
717 | |
718 | pub const PRIO_PROCESS: crate::__priority_which_t = 0; |
719 | pub const PRIO_PGRP: crate::__priority_which_t = 1; |
720 | pub const PRIO_USER: crate::__priority_which_t = 2; |
721 | |
722 | pub const MS_RMT_MASK: c_ulong = 0x02800051; |
723 | |
724 | pub const __UT_LINESIZE: usize = 32; |
725 | pub const __UT_NAMESIZE: usize = 32; |
726 | pub const __UT_HOSTSIZE: usize = 256; |
727 | pub const EMPTY: c_short = 0; |
728 | pub const RUN_LVL: c_short = 1; |
729 | pub const BOOT_TIME: c_short = 2; |
730 | pub const NEW_TIME: c_short = 3; |
731 | pub const OLD_TIME: c_short = 4; |
732 | pub const INIT_PROCESS: c_short = 5; |
733 | pub const LOGIN_PROCESS: c_short = 6; |
734 | pub const USER_PROCESS: c_short = 7; |
735 | pub const DEAD_PROCESS: c_short = 8; |
736 | pub const ACCOUNTING: c_short = 9; |
737 | |
738 | // dlfcn.h |
739 | pub const LM_ID_BASE: c_long = 0; |
740 | pub const LM_ID_NEWLM: c_long = -1; |
741 | |
742 | pub const RTLD_DI_LMID: c_int = 1; |
743 | pub const RTLD_DI_LINKMAP: c_int = 2; |
744 | pub const RTLD_DI_CONFIGADDR: c_int = 3; |
745 | pub const RTLD_DI_SERINFO: c_int = 4; |
746 | pub const RTLD_DI_SERINFOSIZE: c_int = 5; |
747 | pub const RTLD_DI_ORIGIN: c_int = 6; |
748 | pub const RTLD_DI_PROFILENAME: c_int = 7; |
749 | pub const RTLD_DI_PROFILEOUT: c_int = 8; |
750 | pub const RTLD_DI_TLS_MODID: c_int = 9; |
751 | pub const RTLD_DI_TLS_DATA: c_int = 10; |
752 | |
753 | pub const SOCK_NONBLOCK: c_int = O_NONBLOCK; |
754 | pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint; |
755 | |
756 | pub const SOL_RXRPC: c_int = 272; |
757 | pub const SOL_PPPOL2TP: c_int = 273; |
758 | pub const SOL_PNPIPE: c_int = 275; |
759 | pub const SOL_RDS: c_int = 276; |
760 | pub const SOL_IUCV: c_int = 277; |
761 | pub const SOL_CAIF: c_int = 278; |
762 | pub const SOL_NFC: c_int = 280; |
763 | |
764 | pub const MSG_TRYHARD: c_int = 4; |
765 | |
766 | pub const LC_PAPER: c_int = 7; |
767 | pub const LC_NAME: c_int = 8; |
768 | pub const LC_ADDRESS: c_int = 9; |
769 | pub const LC_TELEPHONE: c_int = 10; |
770 | pub const LC_MEASUREMENT: c_int = 11; |
771 | pub const LC_IDENTIFICATION: c_int = 12; |
772 | pub const LC_PAPER_MASK: c_int = 1 << LC_PAPER; |
773 | pub const LC_NAME_MASK: c_int = 1 << LC_NAME; |
774 | pub const LC_ADDRESS_MASK: c_int = 1 << LC_ADDRESS; |
775 | pub const LC_TELEPHONE_MASK: c_int = 1 << LC_TELEPHONE; |
776 | pub const LC_MEASUREMENT_MASK: c_int = 1 << LC_MEASUREMENT; |
777 | pub const LC_IDENTIFICATION_MASK: c_int = 1 << LC_IDENTIFICATION; |
778 | pub const LC_ALL_MASK: c_int = crate::LC_CTYPE_MASK |
779 | | crate::LC_NUMERIC_MASK |
780 | | crate::LC_TIME_MASK |
781 | | crate::LC_COLLATE_MASK |
782 | | crate::LC_MONETARY_MASK |
783 | | crate::LC_MESSAGES_MASK |
784 | | LC_PAPER_MASK |
785 | | LC_NAME_MASK |
786 | | LC_ADDRESS_MASK |
787 | | LC_TELEPHONE_MASK |
788 | | LC_MEASUREMENT_MASK |
789 | | LC_IDENTIFICATION_MASK; |
790 | |
791 | pub const ENOTSUP: c_int = EOPNOTSUPP; |
792 | |
793 | pub const SOCK_SEQPACKET: c_int = 5; |
794 | pub const SOCK_DCCP: c_int = 6; |
795 | #[deprecated (since = "0.2.70" , note = "AF_PACKET must be used instead" )] |
796 | pub const SOCK_PACKET: c_int = 10; |
797 | |
798 | pub const AF_IB: c_int = 27; |
799 | pub const AF_MPLS: c_int = 28; |
800 | pub const AF_NFC: c_int = 39; |
801 | pub const AF_VSOCK: c_int = 40; |
802 | pub const AF_XDP: c_int = 44; |
803 | pub const PF_IB: c_int = AF_IB; |
804 | pub const PF_MPLS: c_int = AF_MPLS; |
805 | pub const PF_NFC: c_int = AF_NFC; |
806 | pub const PF_VSOCK: c_int = AF_VSOCK; |
807 | pub const PF_XDP: c_int = AF_XDP; |
808 | |
809 | pub const SIGEV_THREAD_ID: c_int = 4; |
810 | |
811 | pub const BUFSIZ: c_uint = 8192; |
812 | pub const TMP_MAX: c_uint = 238328; |
813 | pub const FOPEN_MAX: c_uint = 16; |
814 | pub const FILENAME_MAX: c_uint = 4096; |
815 | pub const POSIX_MADV_DONTNEED: c_int = 4; |
816 | pub const _CS_GNU_LIBC_VERSION: c_int = 2; |
817 | pub const _CS_GNU_LIBPTHREAD_VERSION: c_int = 3; |
818 | pub const _CS_V6_ENV: c_int = 1148; |
819 | pub const _CS_V7_ENV: c_int = 1149; |
820 | pub const _SC_EQUIV_CLASS_MAX: c_int = 41; |
821 | pub const _SC_CHARCLASS_NAME_MAX: c_int = 45; |
822 | pub const _SC_PII: c_int = 53; |
823 | pub const _SC_PII_XTI: c_int = 54; |
824 | pub const _SC_PII_SOCKET: c_int = 55; |
825 | pub const _SC_PII_INTERNET: c_int = 56; |
826 | pub const _SC_PII_OSI: c_int = 57; |
827 | pub const _SC_POLL: c_int = 58; |
828 | pub const _SC_SELECT: c_int = 59; |
829 | pub const _SC_PII_INTERNET_STREAM: c_int = 61; |
830 | pub const _SC_PII_INTERNET_DGRAM: c_int = 62; |
831 | pub const _SC_PII_OSI_COTS: c_int = 63; |
832 | pub const _SC_PII_OSI_CLTS: c_int = 64; |
833 | pub const _SC_PII_OSI_M: c_int = 65; |
834 | pub const _SC_T_IOV_MAX: c_int = 66; |
835 | pub const _SC_2_C_VERSION: c_int = 96; |
836 | pub const _SC_CHAR_BIT: c_int = 101; |
837 | pub const _SC_CHAR_MAX: c_int = 102; |
838 | pub const _SC_CHAR_MIN: c_int = 103; |
839 | pub const _SC_INT_MAX: c_int = 104; |
840 | pub const _SC_INT_MIN: c_int = 105; |
841 | pub const _SC_LONG_BIT: c_int = 106; |
842 | pub const _SC_WORD_BIT: c_int = 107; |
843 | pub const _SC_MB_LEN_MAX: c_int = 108; |
844 | pub const _SC_SSIZE_MAX: c_int = 110; |
845 | pub const _SC_SCHAR_MAX: c_int = 111; |
846 | pub const _SC_SCHAR_MIN: c_int = 112; |
847 | pub const _SC_SHRT_MAX: c_int = 113; |
848 | pub const _SC_SHRT_MIN: c_int = 114; |
849 | pub const _SC_UCHAR_MAX: c_int = 115; |
850 | pub const _SC_UINT_MAX: c_int = 116; |
851 | pub const _SC_ULONG_MAX: c_int = 117; |
852 | pub const _SC_USHRT_MAX: c_int = 118; |
853 | pub const _SC_NL_ARGMAX: c_int = 119; |
854 | pub const _SC_NL_LANGMAX: c_int = 120; |
855 | pub const _SC_NL_MSGMAX: c_int = 121; |
856 | pub const _SC_NL_NMAX: c_int = 122; |
857 | pub const _SC_NL_SETMAX: c_int = 123; |
858 | pub const _SC_NL_TEXTMAX: c_int = 124; |
859 | pub const _SC_BASE: c_int = 134; |
860 | pub const _SC_C_LANG_SUPPORT: c_int = 135; |
861 | pub const _SC_C_LANG_SUPPORT_R: c_int = 136; |
862 | pub const _SC_DEVICE_IO: c_int = 140; |
863 | pub const _SC_DEVICE_SPECIFIC: c_int = 141; |
864 | pub const _SC_DEVICE_SPECIFIC_R: c_int = 142; |
865 | pub const _SC_FD_MGMT: c_int = 143; |
866 | pub const _SC_FIFO: c_int = 144; |
867 | pub const _SC_PIPE: c_int = 145; |
868 | pub const _SC_FILE_ATTRIBUTES: c_int = 146; |
869 | pub const _SC_FILE_LOCKING: c_int = 147; |
870 | pub const _SC_FILE_SYSTEM: c_int = 148; |
871 | pub const _SC_MULTI_PROCESS: c_int = 150; |
872 | pub const _SC_SINGLE_PROCESS: c_int = 151; |
873 | pub const _SC_NETWORKING: c_int = 152; |
874 | pub const _SC_REGEX_VERSION: c_int = 156; |
875 | pub const _SC_SIGNALS: c_int = 158; |
876 | pub const _SC_SYSTEM_DATABASE: c_int = 162; |
877 | pub const _SC_SYSTEM_DATABASE_R: c_int = 163; |
878 | pub const _SC_USER_GROUPS: c_int = 166; |
879 | pub const _SC_USER_GROUPS_R: c_int = 167; |
880 | pub const _SC_LEVEL1_ICACHE_SIZE: c_int = 185; |
881 | pub const _SC_LEVEL1_ICACHE_ASSOC: c_int = 186; |
882 | pub const _SC_LEVEL1_ICACHE_LINESIZE: c_int = 187; |
883 | pub const _SC_LEVEL1_DCACHE_SIZE: c_int = 188; |
884 | pub const _SC_LEVEL1_DCACHE_ASSOC: c_int = 189; |
885 | pub const _SC_LEVEL1_DCACHE_LINESIZE: c_int = 190; |
886 | pub const _SC_LEVEL2_CACHE_SIZE: c_int = 191; |
887 | pub const _SC_LEVEL2_CACHE_ASSOC: c_int = 192; |
888 | pub const _SC_LEVEL2_CACHE_LINESIZE: c_int = 193; |
889 | pub const _SC_LEVEL3_CACHE_SIZE: c_int = 194; |
890 | pub const _SC_LEVEL3_CACHE_ASSOC: c_int = 195; |
891 | pub const _SC_LEVEL3_CACHE_LINESIZE: c_int = 196; |
892 | pub const _SC_LEVEL4_CACHE_SIZE: c_int = 197; |
893 | pub const _SC_LEVEL4_CACHE_ASSOC: c_int = 198; |
894 | pub const _SC_LEVEL4_CACHE_LINESIZE: c_int = 199; |
895 | pub const O_ACCMODE: c_int = 3; |
896 | pub const ST_RELATIME: c_ulong = 4096; |
897 | pub const NI_MAXHOST: crate::socklen_t = 1025; |
898 | |
899 | // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the |
900 | // following are only available on newer Linux versions than the versions |
901 | // currently used in CI in some configurations, so we define them here. |
902 | cfg_if! { |
903 | if #[cfg(not(target_arch = "s390x" ))] { |
904 | pub const BINDERFS_SUPER_MAGIC: c_long = 0x6c6f6f70; |
905 | pub const XFS_SUPER_MAGIC: c_long = 0x58465342; |
906 | } else if #[cfg(target_arch = "s390x" )] { |
907 | pub const BINDERFS_SUPER_MAGIC: c_uint = 0x6c6f6f70; |
908 | pub const XFS_SUPER_MAGIC: c_uint = 0x58465342; |
909 | } |
910 | } |
911 | |
912 | pub const CPU_SETSIZE: c_int = 0x400; |
913 | |
914 | pub const PTRACE_TRACEME: c_uint = 0; |
915 | pub const PTRACE_PEEKTEXT: c_uint = 1; |
916 | pub const PTRACE_PEEKDATA: c_uint = 2; |
917 | pub const PTRACE_PEEKUSER: c_uint = 3; |
918 | pub const PTRACE_POKETEXT: c_uint = 4; |
919 | pub const PTRACE_POKEDATA: c_uint = 5; |
920 | pub const PTRACE_POKEUSER: c_uint = 6; |
921 | pub const PTRACE_CONT: c_uint = 7; |
922 | pub const PTRACE_KILL: c_uint = 8; |
923 | pub const PTRACE_SINGLESTEP: c_uint = 9; |
924 | pub const PTRACE_ATTACH: c_uint = 16; |
925 | pub const PTRACE_SYSCALL: c_uint = 24; |
926 | pub const PTRACE_SETOPTIONS: c_uint = 0x4200; |
927 | pub const PTRACE_GETEVENTMSG: c_uint = 0x4201; |
928 | pub const PTRACE_GETSIGINFO: c_uint = 0x4202; |
929 | pub const PTRACE_SETSIGINFO: c_uint = 0x4203; |
930 | pub const PTRACE_GETREGSET: c_uint = 0x4204; |
931 | pub const PTRACE_SETREGSET: c_uint = 0x4205; |
932 | pub const PTRACE_SEIZE: c_uint = 0x4206; |
933 | pub const PTRACE_INTERRUPT: c_uint = 0x4207; |
934 | pub const PTRACE_LISTEN: c_uint = 0x4208; |
935 | pub const PTRACE_PEEKSIGINFO: c_uint = 0x4209; |
936 | pub const PTRACE_GETSIGMASK: c_uint = 0x420a; |
937 | pub const PTRACE_SETSIGMASK: c_uint = 0x420b; |
938 | pub const PTRACE_GET_SYSCALL_INFO: c_uint = 0x420e; |
939 | pub const PTRACE_SYSCALL_INFO_NONE: crate::__u8 = 0; |
940 | pub const PTRACE_SYSCALL_INFO_ENTRY: crate::__u8 = 1; |
941 | pub const PTRACE_SYSCALL_INFO_EXIT: crate::__u8 = 2; |
942 | pub const PTRACE_SYSCALL_INFO_SECCOMP: crate::__u8 = 3; |
943 | pub const PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4210; |
944 | pub const PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4211; |
945 | |
946 | // linux/fs.h |
947 | |
948 | // Flags for preadv2/pwritev2 |
949 | pub const RWF_HIPRI: c_int = 0x00000001; |
950 | pub const RWF_DSYNC: c_int = 0x00000002; |
951 | pub const RWF_SYNC: c_int = 0x00000004; |
952 | pub const RWF_NOWAIT: c_int = 0x00000008; |
953 | pub const RWF_APPEND: c_int = 0x00000010; |
954 | |
955 | // linux/rtnetlink.h |
956 | pub const TCA_PAD: c_ushort = 9; |
957 | pub const TCA_DUMP_INVISIBLE: c_ushort = 10; |
958 | pub const TCA_CHAIN: c_ushort = 11; |
959 | pub const TCA_HW_OFFLOAD: c_ushort = 12; |
960 | |
961 | pub const RTM_DELNETCONF: u16 = 81; |
962 | pub const RTM_NEWSTATS: u16 = 92; |
963 | pub const RTM_GETSTATS: u16 = 94; |
964 | pub const RTM_NEWCACHEREPORT: u16 = 96; |
965 | |
966 | pub const RTM_F_LOOKUP_TABLE: c_uint = 0x1000; |
967 | pub const RTM_F_FIB_MATCH: c_uint = 0x2000; |
968 | |
969 | pub const RTA_VIA: c_ushort = 18; |
970 | pub const RTA_NEWDST: c_ushort = 19; |
971 | pub const RTA_PREF: c_ushort = 20; |
972 | pub const RTA_ENCAP_TYPE: c_ushort = 21; |
973 | pub const RTA_ENCAP: c_ushort = 22; |
974 | pub const RTA_EXPIRES: c_ushort = 23; |
975 | pub const RTA_PAD: c_ushort = 24; |
976 | pub const RTA_UID: c_ushort = 25; |
977 | pub const RTA_TTL_PROPAGATE: c_ushort = 26; |
978 | |
979 | // linux/neighbor.h |
980 | pub const NTF_EXT_LEARNED: u8 = 0x10; |
981 | pub const NTF_OFFLOADED: u8 = 0x20; |
982 | |
983 | pub const NDA_MASTER: c_ushort = 9; |
984 | pub const NDA_LINK_NETNSID: c_ushort = 10; |
985 | pub const NDA_SRC_VNI: c_ushort = 11; |
986 | |
987 | // linux/personality.h |
988 | pub const UNAME26: c_int = 0x0020000; |
989 | pub const FDPIC_FUNCPTRS: c_int = 0x0080000; |
990 | |
991 | pub const MAX_LINKS: c_int = 32; |
992 | |
993 | pub const GENL_UNS_ADMIN_PERM: c_int = 0x10; |
994 | |
995 | pub const GENL_ID_VFS_DQUOT: c_int = crate::NLMSG_MIN_TYPE + 1; |
996 | pub const GENL_ID_PMCRAID: c_int = crate::NLMSG_MIN_TYPE + 2; |
997 | |
998 | pub const ELFOSABI_ARM_AEABI: u8 = 64; |
999 | |
1000 | // linux/sched.h |
1001 | pub const CLONE_NEWTIME: c_int = 0x80; |
1002 | // DIFF(main): changed to `c_ulonglong` in e9abac9ac2 |
1003 | pub const CLONE_CLEAR_SIGHAND: c_int = 0x100000000; |
1004 | pub const CLONE_INTO_CGROUP: c_int = 0x200000000; |
1005 | |
1006 | // linux/keyctl.h |
1007 | pub const KEYCTL_DH_COMPUTE: u32 = 23; |
1008 | pub const KEYCTL_PKEY_QUERY: u32 = 24; |
1009 | pub const KEYCTL_PKEY_ENCRYPT: u32 = 25; |
1010 | pub const KEYCTL_PKEY_DECRYPT: u32 = 26; |
1011 | pub const KEYCTL_PKEY_SIGN: u32 = 27; |
1012 | pub const KEYCTL_PKEY_VERIFY: u32 = 28; |
1013 | pub const KEYCTL_RESTRICT_KEYRING: u32 = 29; |
1014 | |
1015 | pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01; |
1016 | pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02; |
1017 | pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04; |
1018 | pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08; |
1019 | cfg_if! { |
1020 | if #[cfg(not(any( |
1021 | target_arch = "mips" , |
1022 | target_arch = "mips32r6" , |
1023 | target_arch = "mips64" , |
1024 | target_arch = "mips64r6" |
1025 | )))] { |
1026 | pub const KEYCTL_MOVE: u32 = 30; |
1027 | pub const KEYCTL_CAPABILITIES: u32 = 31; |
1028 | |
1029 | pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01; |
1030 | pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02; |
1031 | pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04; |
1032 | pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08; |
1033 | pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10; |
1034 | pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20; |
1035 | pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40; |
1036 | pub const KEYCTL_CAPS0_MOVE: u32 = 0x80; |
1037 | pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01; |
1038 | pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02; |
1039 | } |
1040 | } |
1041 | |
1042 | pub const M_MXFAST: c_int = 1; |
1043 | pub const M_NLBLKS: c_int = 2; |
1044 | pub const M_GRAIN: c_int = 3; |
1045 | pub const M_KEEP: c_int = 4; |
1046 | pub const M_TRIM_THRESHOLD: c_int = -1; |
1047 | pub const M_TOP_PAD: c_int = -2; |
1048 | pub const M_MMAP_THRESHOLD: c_int = -3; |
1049 | pub const M_MMAP_MAX: c_int = -4; |
1050 | pub const M_CHECK_ACTION: c_int = -5; |
1051 | pub const M_PERTURB: c_int = -6; |
1052 | pub const M_ARENA_TEST: c_int = -7; |
1053 | pub const M_ARENA_MAX: c_int = -8; |
1054 | |
1055 | pub const SOMAXCONN: c_int = 4096; |
1056 | |
1057 | // linux/mount.h |
1058 | pub const MOVE_MOUNT_F_SYMLINKS: c_uint = 0x00000001; |
1059 | pub const MOVE_MOUNT_F_AUTOMOUNTS: c_uint = 0x00000002; |
1060 | pub const MOVE_MOUNT_F_EMPTY_PATH: c_uint = 0x00000004; |
1061 | pub const MOVE_MOUNT_T_SYMLINKS: c_uint = 0x00000010; |
1062 | pub const MOVE_MOUNT_T_AUTOMOUNTS: c_uint = 0x00000020; |
1063 | pub const MOVE_MOUNT_T_EMPTY_PATH: c_uint = 0x00000040; |
1064 | pub const MOVE_MOUNT_SET_GROUP: c_uint = 0x00000100; |
1065 | pub const MOVE_MOUNT_BENEATH: c_uint = 0x00000200; |
1066 | |
1067 | // sys/timex.h |
1068 | pub const ADJ_OFFSET: c_uint = 0x0001; |
1069 | pub const ADJ_FREQUENCY: c_uint = 0x0002; |
1070 | pub const ADJ_MAXERROR: c_uint = 0x0004; |
1071 | pub const ADJ_ESTERROR: c_uint = 0x0008; |
1072 | pub const ADJ_STATUS: c_uint = 0x0010; |
1073 | pub const ADJ_TIMECONST: c_uint = 0x0020; |
1074 | pub const ADJ_TAI: c_uint = 0x0080; |
1075 | pub const ADJ_SETOFFSET: c_uint = 0x0100; |
1076 | pub const ADJ_MICRO: c_uint = 0x1000; |
1077 | pub const ADJ_NANO: c_uint = 0x2000; |
1078 | pub const ADJ_TICK: c_uint = 0x4000; |
1079 | pub const ADJ_OFFSET_SINGLESHOT: c_uint = 0x8001; |
1080 | pub const ADJ_OFFSET_SS_READ: c_uint = 0xa001; |
1081 | pub const MOD_OFFSET: c_uint = ADJ_OFFSET; |
1082 | pub const MOD_FREQUENCY: c_uint = ADJ_FREQUENCY; |
1083 | pub const MOD_MAXERROR: c_uint = ADJ_MAXERROR; |
1084 | pub const MOD_ESTERROR: c_uint = ADJ_ESTERROR; |
1085 | pub const MOD_STATUS: c_uint = ADJ_STATUS; |
1086 | pub const MOD_TIMECONST: c_uint = ADJ_TIMECONST; |
1087 | pub const MOD_CLKB: c_uint = ADJ_TICK; |
1088 | pub const MOD_CLKA: c_uint = ADJ_OFFSET_SINGLESHOT; |
1089 | pub const MOD_TAI: c_uint = ADJ_TAI; |
1090 | pub const MOD_MICRO: c_uint = ADJ_MICRO; |
1091 | pub const MOD_NANO: c_uint = ADJ_NANO; |
1092 | pub const STA_PLL: c_int = 0x0001; |
1093 | pub const STA_PPSFREQ: c_int = 0x0002; |
1094 | pub const STA_PPSTIME: c_int = 0x0004; |
1095 | pub const STA_FLL: c_int = 0x0008; |
1096 | pub const STA_INS: c_int = 0x0010; |
1097 | pub const STA_DEL: c_int = 0x0020; |
1098 | pub const STA_UNSYNC: c_int = 0x0040; |
1099 | pub const STA_FREQHOLD: c_int = 0x0080; |
1100 | pub const STA_PPSSIGNAL: c_int = 0x0100; |
1101 | pub const STA_PPSJITTER: c_int = 0x0200; |
1102 | pub const STA_PPSWANDER: c_int = 0x0400; |
1103 | pub const STA_PPSERROR: c_int = 0x0800; |
1104 | pub const STA_CLOCKERR: c_int = 0x1000; |
1105 | pub const STA_NANO: c_int = 0x2000; |
1106 | pub const STA_MODE: c_int = 0x4000; |
1107 | pub const STA_CLK: c_int = 0x8000; |
1108 | pub const STA_RONLY: c_int = STA_PPSSIGNAL |
1109 | | STA_PPSJITTER |
1110 | | STA_PPSWANDER |
1111 | | STA_PPSERROR |
1112 | | STA_CLOCKERR |
1113 | | STA_NANO |
1114 | | STA_MODE |
1115 | | STA_CLK; |
1116 | pub const NTP_API: c_int = 4; |
1117 | pub const TIME_OK: c_int = 0; |
1118 | pub const TIME_INS: c_int = 1; |
1119 | pub const TIME_DEL: c_int = 2; |
1120 | pub const TIME_OOP: c_int = 3; |
1121 | pub const TIME_WAIT: c_int = 4; |
1122 | pub const TIME_ERROR: c_int = 5; |
1123 | pub const TIME_BAD: c_int = TIME_ERROR; |
1124 | pub const MAXTC: c_long = 6; |
1125 | |
1126 | // Portable GLOB_* flags are defined at the `linux_like` level. |
1127 | // The following are GNU extensions. |
1128 | pub const GLOB_PERIOD: c_int = 1 << 7; |
1129 | pub const GLOB_ALTDIRFUNC: c_int = 1 << 9; |
1130 | pub const GLOB_BRACE: c_int = 1 << 10; |
1131 | pub const GLOB_NOMAGIC: c_int = 1 << 11; |
1132 | pub const GLOB_TILDE: c_int = 1 << 12; |
1133 | pub const GLOB_ONLYDIR: c_int = 1 << 13; |
1134 | pub const GLOB_TILDE_CHECK: c_int = 1 << 14; |
1135 | |
1136 | pub const MADV_COLLAPSE: c_int = 25; |
1137 | |
1138 | cfg_if! { |
1139 | if #[cfg(any( |
1140 | target_arch = "arm" , |
1141 | target_arch = "x86" , |
1142 | target_arch = "x86_64" , |
1143 | target_arch = "s390x" , |
1144 | target_arch = "riscv64" , |
1145 | target_arch = "riscv32" |
1146 | ))] { |
1147 | pub const PTHREAD_STACK_MIN: size_t = 16384; |
1148 | } else if #[cfg(any(target_arch = "sparc" , target_arch = "sparc64" ))] { |
1149 | pub const PTHREAD_STACK_MIN: size_t = 0x6000; |
1150 | } else { |
1151 | pub const PTHREAD_STACK_MIN: size_t = 131072; |
1152 | } |
1153 | } |
1154 | pub const PTHREAD_MUTEX_ADAPTIVE_NP: c_int = 3; |
1155 | |
1156 | pub const REG_STARTEND: c_int = 4; |
1157 | |
1158 | pub const REG_EEND: c_int = 14; |
1159 | pub const REG_ESIZE: c_int = 15; |
1160 | pub const REG_ERPAREN: c_int = 16; |
1161 | |
1162 | cfg_if! { |
1163 | if #[cfg(any( |
1164 | target_arch = "x86" , |
1165 | target_arch = "x86_64" , |
1166 | target_arch = "arm" , |
1167 | target_arch = "aarch64" , |
1168 | target_arch = "loongarch64" , |
1169 | target_arch = "riscv64" , |
1170 | target_arch = "s390x" |
1171 | ))] { |
1172 | pub const TUNSETCARRIER: Ioctl = 0x400454e2; |
1173 | pub const TUNGETDEVNETNS: Ioctl = 0x54e3; |
1174 | } else if #[cfg(any( |
1175 | target_arch = "mips" , |
1176 | target_arch = "mips64" , |
1177 | target_arch = "powerpc" , |
1178 | target_arch = "powerpc64" , |
1179 | target_arch = "sparc" , |
1180 | target_arch = "sparc64" |
1181 | ))] { |
1182 | pub const TUNSETCARRIER: Ioctl = 0x800454e2; |
1183 | pub const TUNGETDEVNETNS: Ioctl = 0x200054e3; |
1184 | } else { |
1185 | // Unknown target_arch |
1186 | } |
1187 | } |
1188 | |
1189 | unsafeextern "C" { |
1190 | pub unsafefn fgetspent_r( |
1191 | fp: *mut crate::FILE, |
1192 | spbuf: *mut crate::spwd, |
1193 | buf: *mut c_char, |
1194 | buflen: size_t, |
1195 | spbufp: *mut *mut crate::spwd, |
1196 | ) -> c_int; |
1197 | pub unsafefn sgetspent_r( |
1198 | s: *const c_char, |
1199 | spbuf: *mut crate::spwd, |
1200 | buf: *mut c_char, |
1201 | buflen: size_t, |
1202 | spbufp: *mut *mut crate::spwd, |
1203 | ) -> c_int; |
1204 | pub unsafefn getspent_r( |
1205 | spbuf: *mut crate::spwd, |
1206 | buf: *mut c_char, |
1207 | buflen: size_t, |
1208 | spbufp: *mut *mut crate::spwd, |
1209 | ) -> c_int; |
1210 | pub unsafefn qsort_r( |
1211 | base: *mut c_void, |
1212 | num: size_t, |
1213 | size: size_t, |
1214 | compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>, |
1215 | arg: *mut c_void, |
1216 | ); |
1217 | pub unsafefn sendmmsg( |
1218 | sockfd: c_int, |
1219 | msgvec: *mut crate::mmsghdr, |
1220 | vlen: c_uint, |
1221 | flags: c_int, |
1222 | ) -> c_int; |
1223 | pub unsafefn recvmmsg( |
1224 | sockfd: c_int, |
1225 | msgvec: *mut crate::mmsghdr, |
1226 | vlen: c_uint, |
1227 | flags: c_int, |
1228 | timeout: *mut crate::timespec, |
1229 | ) -> c_int; |
1230 | |
1231 | pub unsafefn getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int; |
1232 | pub unsafefn setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) |
1233 | -> c_int; |
1234 | #[cfg_attr (gnu_file_offset_bits64, link_name = "getrlimit64" )] |
1235 | pub unsafefn getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; |
1236 | #[cfg_attr (gnu_file_offset_bits64, link_name = "setrlimit64" )] |
1237 | pub unsafefn setrlimit(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; |
1238 | #[cfg_attr (gnu_file_offset_bits64, link_name = "prlimit64" )] |
1239 | pub unsafefn prlimit( |
1240 | pid: crate::pid_t, |
1241 | resource: crate::__rlimit_resource_t, |
1242 | new_limit: *const crate::rlimit, |
1243 | old_limit: *mut crate::rlimit, |
1244 | ) -> c_int; |
1245 | pub unsafefn prlimit64( |
1246 | pid: crate::pid_t, |
1247 | resource: crate::__rlimit_resource_t, |
1248 | new_limit: *const crate::rlimit64, |
1249 | old_limit: *mut crate::rlimit64, |
1250 | ) -> c_int; |
1251 | pub unsafefn utmpname(file: *const c_char) -> c_int; |
1252 | pub unsafefn utmpxname(file: *const c_char) -> c_int; |
1253 | pub unsafefn getutxent() -> *mut utmpx; |
1254 | pub unsafefn getutxid(ut: *const utmpx) -> *mut utmpx; |
1255 | pub unsafefn getutxline(ut: *const utmpx) -> *mut utmpx; |
1256 | pub unsafefn pututxline(ut: *const utmpx) -> *mut utmpx; |
1257 | pub unsafefn setutxent(); |
1258 | pub unsafefn endutxent(); |
1259 | pub unsafefn getpt() -> c_int; |
1260 | pub unsafefn mallopt(param: c_int, value: c_int) -> c_int; |
1261 | pub unsafefn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int; |
1262 | pub unsafefn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; |
1263 | pub unsafefn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; |
1264 | pub unsafefn getauxval(type_: c_ulong) -> c_ulong; |
1265 | |
1266 | pub unsafefn adjtimex(buf: *mut timex) -> c_int; |
1267 | pub unsafefn ntp_adjtime(buf: *mut timex) -> c_int; |
1268 | #[link_name = "ntp_gettimex" ] |
1269 | pub unsafefn ntp_gettime(buf: *mut ntptimeval) -> c_int; |
1270 | pub unsafefn clock_adjtime(clk_id: crate::clockid_t, buf: *mut crate::timex) -> c_int; |
1271 | |
1272 | pub unsafefn fanotify_mark( |
1273 | fd: c_int, |
1274 | flags: c_uint, |
1275 | mask: u64, |
1276 | dirfd: c_int, |
1277 | path: *const c_char, |
1278 | ) -> c_int; |
1279 | #[cfg_attr (gnu_file_offset_bits64, link_name = "preadv64v2" )] |
1280 | pub unsafefn preadv2( |
1281 | fd: c_int, |
1282 | iov: *const crate::iovec, |
1283 | iovcnt: c_int, |
1284 | offset: off_t, |
1285 | flags: c_int, |
1286 | ) -> ssize_t; |
1287 | #[cfg_attr (gnu_file_offset_bits64, link_name = "pwritev64v2" )] |
1288 | pub unsafefn pwritev2( |
1289 | fd: c_int, |
1290 | iov: *const crate::iovec, |
1291 | iovcnt: c_int, |
1292 | offset: off_t, |
1293 | flags: c_int, |
1294 | ) -> ssize_t; |
1295 | pub unsafefn preadv64v2( |
1296 | fd: c_int, |
1297 | iov: *const crate::iovec, |
1298 | iovcnt: c_int, |
1299 | offset: off64_t, |
1300 | flags: c_int, |
1301 | ) -> ssize_t; |
1302 | pub unsafefn pwritev64v2( |
1303 | fd: c_int, |
1304 | iov: *const crate::iovec, |
1305 | iovcnt: c_int, |
1306 | offset: off64_t, |
1307 | flags: c_int, |
1308 | ) -> ssize_t; |
1309 | pub unsafefn renameat2( |
1310 | olddirfd: c_int, |
1311 | oldpath: *const c_char, |
1312 | newdirfd: c_int, |
1313 | newpath: *const c_char, |
1314 | flags: c_uint, |
1315 | ) -> c_int; |
1316 | |
1317 | // Added in `glibc` 2.25 |
1318 | pub unsafefn explicit_bzero(s: *mut c_void, len: size_t); |
1319 | // Added in `glibc` 2.29 |
1320 | pub unsafefn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void; |
1321 | |
1322 | pub unsafefn ctermid(s: *mut c_char) -> *mut c_char; |
1323 | pub unsafefn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int; |
1324 | pub unsafefn glob64( |
1325 | pattern: *const c_char, |
1326 | flags: c_int, |
1327 | errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, |
1328 | pglob: *mut glob64_t, |
1329 | ) -> c_int; |
1330 | pub unsafefn globfree64(pglob: *mut glob64_t); |
1331 | pub unsafefn ptrace(request: c_uint, ...) -> c_long; |
1332 | pub unsafefn pthread_attr_getaffinity_np( |
1333 | attr: *const crate::pthread_attr_t, |
1334 | cpusetsize: size_t, |
1335 | cpuset: *mut crate::cpu_set_t, |
1336 | ) -> c_int; |
1337 | pub unsafefn pthread_attr_setaffinity_np( |
1338 | attr: *mut crate::pthread_attr_t, |
1339 | cpusetsize: size_t, |
1340 | cpuset: *const crate::cpu_set_t, |
1341 | ) -> c_int; |
1342 | pub unsafefn getpriority(which: crate::__priority_which_t, who: crate::id_t) -> c_int; |
1343 | pub unsafefn setpriority(which: crate::__priority_which_t, who: crate::id_t, prio: c_int) -> c_int; |
1344 | pub unsafefn pthread_rwlockattr_getkind_np( |
1345 | attr: *const crate::pthread_rwlockattr_t, |
1346 | val: *mut c_int, |
1347 | ) -> c_int; |
1348 | pub unsafefn pthread_rwlockattr_setkind_np( |
1349 | attr: *mut crate::pthread_rwlockattr_t, |
1350 | val: c_int, |
1351 | ) -> c_int; |
1352 | pub unsafefn pthread_sigqueue(thread: crate::pthread_t, sig: c_int, value: crate::sigval) -> c_int; |
1353 | pub unsafefn mallinfo() -> crate::mallinfo; |
1354 | pub unsafefn mallinfo2() -> crate::mallinfo2; |
1355 | pub unsafefn malloc_stats(); |
1356 | pub unsafefn malloc_info(options: c_int, stream: *mut crate::FILE) -> c_int; |
1357 | pub unsafefn malloc_usable_size(ptr: *mut c_void) -> size_t; |
1358 | pub unsafefn getpwent_r( |
1359 | pwd: *mut crate::passwd, |
1360 | buf: *mut c_char, |
1361 | buflen: size_t, |
1362 | result: *mut *mut crate::passwd, |
1363 | ) -> c_int; |
1364 | pub unsafefn getgrent_r( |
1365 | grp: *mut crate::group, |
1366 | buf: *mut c_char, |
1367 | buflen: size_t, |
1368 | result: *mut *mut crate::group, |
1369 | ) -> c_int; |
1370 | pub unsafefn fgetpwent_r( |
1371 | stream: *mut crate::FILE, |
1372 | pwd: *mut crate::passwd, |
1373 | buf: *mut c_char, |
1374 | buflen: size_t, |
1375 | result: *mut *mut crate::passwd, |
1376 | ) -> c_int; |
1377 | pub unsafefn fgetgrent_r( |
1378 | stream: *mut crate::FILE, |
1379 | grp: *mut crate::group, |
1380 | buf: *mut c_char, |
1381 | buflen: size_t, |
1382 | result: *mut *mut crate::group, |
1383 | ) -> c_int; |
1384 | |
1385 | pub unsafefn putpwent(p: *const crate::passwd, stream: *mut crate::FILE) -> c_int; |
1386 | pub unsafefn putgrent(grp: *const crate::group, stream: *mut crate::FILE) -> c_int; |
1387 | |
1388 | pub unsafefn sethostid(hostid: c_long) -> c_int; |
1389 | |
1390 | pub unsafefn memfd_create(name: *const c_char, flags: c_uint) -> c_int; |
1391 | pub unsafefn mlock2(addr: *const c_void, len: size_t, flags: c_uint) -> c_int; |
1392 | |
1393 | pub unsafefn euidaccess(pathname: *const c_char, mode: c_int) -> c_int; |
1394 | pub unsafefn eaccess(pathname: *const c_char, mode: c_int) -> c_int; |
1395 | |
1396 | pub unsafefn asctime_r(tm: *const crate::tm, buf: *mut c_char) -> *mut c_char; |
1397 | pub unsafefn ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char; |
1398 | |
1399 | pub unsafefn dirname(path: *mut c_char) -> *mut c_char; |
1400 | /// POSIX version of `basename(3)`, defined in `libgen.h`. |
1401 | #[link_name = "__xpg_basename" ] |
1402 | pub unsafefn posix_basename(path: *mut c_char) -> *mut c_char; |
1403 | /// GNU version of `basename(3)`, defined in `string.h`. |
1404 | #[link_name = "basename" ] |
1405 | pub unsafefn gnu_basename(path: *const c_char) -> *mut c_char; |
1406 | pub unsafefn dlmopen(lmid: Lmid_t, filename: *const c_char, flag: c_int) -> *mut c_void; |
1407 | pub unsafefn dlinfo(handle: *mut c_void, request: c_int, info: *mut c_void) -> c_int; |
1408 | pub unsafefn dladdr1( |
1409 | addr: *const c_void, |
1410 | info: *mut crate::Dl_info, |
1411 | extra_info: *mut *mut c_void, |
1412 | flags: c_int, |
1413 | ) -> c_int; |
1414 | pub unsafefn malloc_trim(__pad: size_t) -> c_int; |
1415 | pub unsafefn gnu_get_libc_release() -> *const c_char; |
1416 | pub unsafefn gnu_get_libc_version() -> *const c_char; |
1417 | |
1418 | // posix/spawn.h |
1419 | // Added in `glibc` 2.29 |
1420 | pub unsafefn posix_spawn_file_actions_addchdir_np( |
1421 | actions: *mut crate::posix_spawn_file_actions_t, |
1422 | path: *const c_char, |
1423 | ) -> c_int; |
1424 | // Added in `glibc` 2.29 |
1425 | pub unsafefn posix_spawn_file_actions_addfchdir_np( |
1426 | actions: *mut crate::posix_spawn_file_actions_t, |
1427 | fd: c_int, |
1428 | ) -> c_int; |
1429 | // Added in `glibc` 2.34 |
1430 | pub unsafefn posix_spawn_file_actions_addclosefrom_np( |
1431 | actions: *mut crate::posix_spawn_file_actions_t, |
1432 | from: c_int, |
1433 | ) -> c_int; |
1434 | // Added in `glibc` 2.35 |
1435 | pub unsafefn posix_spawn_file_actions_addtcsetpgrp_np( |
1436 | actions: *mut crate::posix_spawn_file_actions_t, |
1437 | tcfd: c_int, |
1438 | ) -> c_int; |
1439 | |
1440 | // mntent.h |
1441 | pub unsafefn getmntent_r( |
1442 | stream: *mut crate::FILE, |
1443 | mntbuf: *mut crate::mntent, |
1444 | buf: *mut c_char, |
1445 | buflen: c_int, |
1446 | ) -> *mut crate::mntent; |
1447 | |
1448 | pub unsafefn execveat( |
1449 | dirfd: c_int, |
1450 | pathname: *const c_char, |
1451 | argv: *const *mut c_char, |
1452 | envp: *const *mut c_char, |
1453 | flags: c_int, |
1454 | ) -> c_int; |
1455 | |
1456 | // Added in `glibc` 2.34 |
1457 | pub unsafefn close_range(first: c_uint, last: c_uint, flags: c_int) -> c_int; |
1458 | |
1459 | pub unsafefn mq_notify(mqdes: crate::mqd_t, sevp: *const crate::sigevent) -> c_int; |
1460 | |
1461 | pub unsafefn epoll_pwait2( |
1462 | epfd: c_int, |
1463 | events: *mut crate::epoll_event, |
1464 | maxevents: c_int, |
1465 | timeout: *const crate::timespec, |
1466 | sigmask: *const crate::sigset_t, |
1467 | ) -> c_int; |
1468 | |
1469 | pub unsafefn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
1470 | } |
1471 | |
1472 | cfg_if! { |
1473 | if #[cfg(any( |
1474 | target_arch = "x86" , |
1475 | target_arch = "arm" , |
1476 | target_arch = "m68k" , |
1477 | target_arch = "csky" , |
1478 | target_arch = "mips" , |
1479 | target_arch = "mips32r6" , |
1480 | target_arch = "powerpc" , |
1481 | target_arch = "sparc" , |
1482 | target_arch = "riscv32" |
1483 | ))] { |
1484 | mod b32; |
1485 | pub use self::b32::*; |
1486 | } else if #[cfg(any( |
1487 | target_arch = "x86_64" , |
1488 | target_arch = "aarch64" , |
1489 | target_arch = "powerpc64" , |
1490 | target_arch = "mips64" , |
1491 | target_arch = "mips64r6" , |
1492 | target_arch = "s390x" , |
1493 | target_arch = "sparc64" , |
1494 | target_arch = "riscv64" , |
1495 | target_arch = "loongarch64" |
1496 | ))] { |
1497 | mod b64; |
1498 | pub use self::b64::*; |
1499 | } else { |
1500 | // Unknown target_arch |
1501 | } |
1502 | } |
1503 | |