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