| 1 |
use crate::off64_t; |
| 2 |
use crate::prelude::*; |
| 3 |
|
| 4 |
pub type pthread_t = *mut c_void; |
| 5 |
pub type clock_t = c_long; |
| 6 |
#[cfg_attr( |
| 7 |
not(feature = "rustc-dep-of-std"), |
| 8 |
deprecated( |
| 9 |
since = "0.2.80", |
| 10 |
note = "This type is changed to 64-bit in musl 1.2.0, \ |
| 11 |
we'll follow that change in the future release. \ |
| 12 |
See #1848 for more info." |
| 13 |
) |
| 14 |
)] |
| 15 |
pub type time_t = c_long; |
| 16 |
pub type suseconds_t = c_long; |
| 17 |
pub type ino_t = u64; |
| 18 |
pub type off_t = i64; |
| 19 |
pub type blkcnt_t = i64; |
| 20 |
|
| 21 |
pub type shmatt_t = c_ulong; |
| 22 |
pub type msgqnum_t = c_ulong; |
| 23 |
pub type msglen_t = c_ulong; |
| 24 |
pub type fsblkcnt_t = c_ulonglong; |
| 25 |
pub type fsblkcnt64_t = c_ulonglong; |
| 26 |
pub type fsfilcnt_t = c_ulonglong; |
| 27 |
pub type fsfilcnt64_t = c_ulonglong; |
| 28 |
pub type rlim_t = c_ulonglong; |
| 29 |
|
| 30 |
cfg_if! { |
| 31 |
if #[cfg(doc)] { |
| 32 |
// Used in `linux::arch` to define ioctl constants. |
| 33 |
pub(crate) type Ioctl = c_int; |
| 34 |
} else { |
| 35 |
#[doc(hidden)] |
| 36 |
pub type Ioctl = c_int; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
impl siginfo_t { |
| 41 |
pub unsafe fn si_addr(&self) -> *mut c_void { |
| 42 |
#[repr(C)] |
| 43 |
struct siginfo_sigfault { |
| 44 |
_si_signo: c_int, |
| 45 |
_si_errno: c_int, |
| 46 |
_si_code: c_int, |
| 47 |
si_addr: *mut c_void, |
| 48 |
} |
| 49 |
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr |
| 50 |
} |
| 51 |
|
| 52 |
pub unsafe fn si_value(&self) -> crate::sigval { |
| 53 |
#[repr(C)] |
| 54 |
struct siginfo_si_value { |
| 55 |
_si_signo: c_int, |
| 56 |
_si_errno: c_int, |
| 57 |
_si_code: c_int, |
| 58 |
_si_timerid: c_int, |
| 59 |
_si_overrun: c_int, |
| 60 |
si_value: crate::sigval, |
| 61 |
} |
| 62 |
(*(self as *const siginfo_t as *const siginfo_si_value)).si_value |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
// Internal, for casts to access union fields |
| 67 |
#[repr(C)] |
| 68 |
struct sifields_sigchld { |
| 69 |
si_pid: crate::pid_t, |
| 70 |
si_uid: crate::uid_t, |
| 71 |
si_status: c_int, |
| 72 |
si_utime: c_long, |
| 73 |
si_stime: c_long, |
| 74 |
} |
| 75 |
impl Copy for sifields_sigchld {} |
| 76 |
impl Clone for sifields_sigchld { |
| 77 |
fn clone(&self) -> sifields_sigchld { |
| 78 |
*self |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
// Internal, for casts to access union fields |
| 83 |
#[repr(C)] |
| 84 |
union sifields { |
| 85 |
_align_pointer: *mut c_void, |
| 86 |
sigchld: sifields_sigchld, |
| 87 |
} |
| 88 |
|
| 89 |
// Internal, for casts to access union fields. Note that some variants |
| 90 |
// of sifields start with a pointer, which makes the alignment of |
| 91 |
// sifields vary on 32-bit and 64-bit architectures. |
| 92 |
#[repr(C)] |
| 93 |
struct siginfo_f { |
| 94 |
_siginfo_base: [c_int; 3], |
| 95 |
sifields: sifields, |
| 96 |
} |
| 97 |
|
| 98 |
impl siginfo_t { |
| 99 |
unsafe fn sifields(&self) -> &sifields { |
| 100 |
&(*(self as *const siginfo_t as *const siginfo_f)).sifields |
| 101 |
} |
| 102 |
|
| 103 |
pub unsafe fn si_pid(&self) -> crate::pid_t { |
| 104 |
self.sifields().sigchld.si_pid |
| 105 |
} |
| 106 |
|
| 107 |
pub unsafe fn si_uid(&self) -> crate::uid_t { |
| 108 |
self.sifields().sigchld.si_uid |
| 109 |
} |
| 110 |
|
| 111 |
pub unsafe fn si_status(&self) -> c_int { |
| 112 |
self.sifields().sigchld.si_status |
| 113 |
} |
| 114 |
|
| 115 |
pub unsafe fn si_utime(&self) -> c_long { |
| 116 |
self.sifields().sigchld.si_utime |
| 117 |
} |
| 118 |
|
| 119 |
pub unsafe fn si_stime(&self) -> c_long { |
| 120 |
self.sifields().sigchld.si_stime |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
s! { |
| 125 |
pub struct aiocb { |
| 126 |
pub aio_fildes: c_int, |
| 127 |
pub aio_lio_opcode: c_int, |
| 128 |
pub aio_reqprio: c_int, |
| 129 |
pub aio_buf: *mut c_void, |
| 130 |
pub aio_nbytes: size_t, |
| 131 |
pub aio_sigevent: crate::sigevent, |
| 132 |
__td: *mut c_void, |
| 133 |
__lock: [c_int; 2], |
| 134 |
__err: c_int, |
| 135 |
__ret: ssize_t, |
| 136 |
pub aio_offset: off_t, |
| 137 |
__next: *mut c_void, |
| 138 |
__prev: *mut c_void, |
| 139 |
#[cfg(target_pointer_width = "32")] |
| 140 |
__dummy4: [c_char; 24], |
| 141 |
#[cfg(target_pointer_width = "64")] |
| 142 |
__dummy4: [c_char; 16], |
| 143 |
} |
| 144 |
|
| 145 |
pub struct sigaction { |
| 146 |
pub sa_sigaction: crate::sighandler_t, |
| 147 |
pub sa_mask: crate::sigset_t, |
| 148 |
pub sa_flags: c_int, |
| 149 |
pub sa_restorer: Option<extern "C" fn()>, |
| 150 |
} |
| 151 |
|
| 152 |
// `mips*` targets swap the `s_errno` and `s_code` fields otherwise this struct is |
| 153 |
// target-agnostic (see https://www.openwall.com/lists/musl/2016/01/27/1/2) |
| 154 |
// |
| 155 |
// FIXME(union): C implementation uses unions |
| 156 |
pub struct siginfo_t { |
| 157 |
pub si_signo: c_int, |
| 158 |
#[cfg(not(target_arch = "mips"))] |
| 159 |
pub si_errno: c_int, |
| 160 |
pub si_code: c_int, |
| 161 |
#[cfg(target_arch = "mips")] |
| 162 |
pub si_errno: c_int, |
| 163 |
#[doc(hidden)] |
| 164 |
#[deprecated( |
| 165 |
since = "0.2.54", |
| 166 |
note = "Please leave a comment on https://github.com/rust-lang/libc/pull/1316 \ |
| 167 |
if you're using this field" |
| 168 |
)] |
| 169 |
pub _pad: [c_int; 29], |
| 170 |
_align: [usize; 0], |
| 171 |
} |
| 172 |
|
| 173 |
pub struct statvfs { |
| 174 |
pub f_bsize: c_ulong, |
| 175 |
pub f_frsize: c_ulong, |
| 176 |
pub f_blocks: crate::fsblkcnt_t, |
| 177 |
pub f_bfree: crate::fsblkcnt_t, |
| 178 |
pub f_bavail: crate::fsblkcnt_t, |
| 179 |
pub f_files: crate::fsfilcnt_t, |
| 180 |
pub f_ffree: crate::fsfilcnt_t, |
| 181 |
pub f_favail: crate::fsfilcnt_t, |
| 182 |
#[cfg(target_endian = "little")] |
| 183 |
pub f_fsid: c_ulong, |
| 184 |
#[cfg(target_pointer_width = "32")] |
| 185 |
__pad: c_int, |
| 186 |
#[cfg(target_endian = "big")] |
| 187 |
pub f_fsid: c_ulong, |
| 188 |
pub f_flag: c_ulong, |
| 189 |
pub f_namemax: c_ulong, |
| 190 |
__f_reserved: [c_int; 6], |
| 191 |
} |
| 192 |
|
| 193 |
pub struct statvfs64 { |
| 194 |
pub f_bsize: c_ulong, |
| 195 |
pub f_frsize: c_ulong, |
| 196 |
pub f_blocks: crate::fsblkcnt64_t, |
| 197 |
pub f_bfree: crate::fsblkcnt64_t, |
| 198 |
pub f_bavail: crate::fsblkcnt64_t, |
| 199 |
pub f_files: crate::fsfilcnt64_t, |
| 200 |
pub f_ffree: crate::fsfilcnt64_t, |
| 201 |
pub f_favail: crate::fsfilcnt64_t, |
| 202 |
#[cfg(target_endian = "little")] |
| 203 |
pub f_fsid: c_ulong, |
| 204 |
#[cfg(target_pointer_width = "32")] |
| 205 |
__pad: c_int, |
| 206 |
#[cfg(target_endian = "big")] |
| 207 |
pub f_fsid: c_ulong, |
| 208 |
pub f_flag: c_ulong, |
| 209 |
pub f_namemax: c_ulong, |
| 210 |
__f_reserved: [c_int; 6], |
| 211 |
} |
| 212 |
|
| 213 |
pub struct termios { |
| 214 |
pub c_iflag: crate::tcflag_t, |
| 215 |
pub c_oflag: crate::tcflag_t, |
| 216 |
pub c_cflag: crate::tcflag_t, |
| 217 |
pub c_lflag: crate::tcflag_t, |
| 218 |
pub c_line: crate::cc_t, |
| 219 |
pub c_cc: [crate::cc_t; crate::NCCS], |
| 220 |
pub __c_ispeed: crate::speed_t, |
| 221 |
pub __c_ospeed: crate::speed_t, |
| 222 |
} |
| 223 |
|
| 224 |
pub struct flock { |
| 225 |
pub l_type: c_short, |
| 226 |
pub l_whence: c_short, |
| 227 |
pub l_start: off_t, |
| 228 |
pub l_len: off_t, |
| 229 |
pub l_pid: crate::pid_t, |
| 230 |
} |
| 231 |
|
| 232 |
pub struct flock64 { |
| 233 |
pub l_type: c_short, |
| 234 |
pub l_whence: c_short, |
| 235 |
pub l_start: off64_t, |
| 236 |
pub l_len: off64_t, |
| 237 |
pub l_pid: crate::pid_t, |
| 238 |
} |
| 239 |
|
| 240 |
pub struct regex_t { |
| 241 |
__re_nsub: size_t, |
| 242 |
__opaque: *mut c_void, |
| 243 |
__padding: [*mut c_void; 4usize], |
| 244 |
__nsub2: size_t, |
| 245 |
__padding2: c_char, |
| 246 |
} |
| 247 |
|
| 248 |
pub struct rtentry { |
| 249 |
pub rt_pad1: c_ulong, |
| 250 |
pub rt_dst: crate::sockaddr, |
| 251 |
pub rt_gateway: crate::sockaddr, |
| 252 |
pub rt_genmask: crate::sockaddr, |
| 253 |
pub rt_flags: c_ushort, |
| 254 |
pub rt_pad2: c_short, |
| 255 |
pub rt_pad3: c_ulong, |
| 256 |
pub rt_tos: c_uchar, |
| 257 |
pub rt_class: c_uchar, |
| 258 |
#[cfg(target_pointer_width = "64")] |
| 259 |
pub rt_pad4: [c_short; 3usize], |
| 260 |
#[cfg(not(target_pointer_width = "64"))] |
| 261 |
pub rt_pad4: [c_short; 1usize], |
| 262 |
pub rt_metric: c_short, |
| 263 |
pub rt_dev: *mut c_char, |
| 264 |
pub rt_mtu: c_ulong, |
| 265 |
pub rt_window: c_ulong, |
| 266 |
pub rt_irtt: c_ushort, |
| 267 |
} |
| 268 |
|
| 269 |
pub struct __exit_status { |
| 270 |
pub e_termination: c_short, |
| 271 |
pub e_exit: c_short, |
| 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 timex { |
| 288 |
pub modes: c_uint, |
| 289 |
pub offset: c_long, |
| 290 |
pub freq: c_long, |
| 291 |
pub maxerror: c_long, |
| 292 |
pub esterror: c_long, |
| 293 |
pub status: c_int, |
| 294 |
pub constant: c_long, |
| 295 |
pub precision: c_long, |
| 296 |
pub tolerance: c_long, |
| 297 |
pub time: crate::timeval, |
| 298 |
pub tick: c_long, |
| 299 |
pub ppsfreq: c_long, |
| 300 |
pub jitter: c_long, |
| 301 |
pub shift: c_int, |
| 302 |
pub stabil: c_long, |
| 303 |
pub jitcnt: c_long, |
| 304 |
pub calcnt: c_long, |
| 305 |
pub errcnt: c_long, |
| 306 |
pub stbcnt: c_long, |
| 307 |
pub tai: c_int, |
| 308 |
pub __padding: [c_int; 11], |
| 309 |
} |
| 310 |
|
| 311 |
pub struct ntptimeval { |
| 312 |
pub time: crate::timeval, |
| 313 |
pub maxerror: c_long, |
| 314 |
pub esterror: c_long, |
| 315 |
} |
| 316 |
|
| 317 |
// netinet/tcp.h |
| 318 |
|
| 319 |
pub struct tcp_info { |
| 320 |
pub tcpi_state: u8, |
| 321 |
pub tcpi_ca_state: u8, |
| 322 |
pub tcpi_retransmits: u8, |
| 323 |
pub tcpi_probes: u8, |
| 324 |
pub tcpi_backoff: u8, |
| 325 |
pub tcpi_options: u8, |
| 326 |
/* |
| 327 |
* FIXME(musl): enable on all targets once musl headers are more up to date |
| 328 |
*/ |
| 329 |
/// This contains the bitfields `tcpi_snd_wscale` and `tcpi_rcv_wscale`. |
| 330 |
/// Each is 4 bits. |
| 331 |
#[cfg(target_arch = "loongarch64")] |
| 332 |
pub tcpi_snd_rcv_wscale: u8, |
| 333 |
/// This contains the bitfields `tcpi_delivery_rate_app_limited` (1 bit) and |
| 334 |
/// `tcpi_fastopen_client_fail` (2 bits). |
| 335 |
#[cfg(target_arch = "loongarch64")] |
| 336 |
pub tcpi_delivery_fastopen_bitfields: u8, |
| 337 |
pub tcpi_rto: u32, |
| 338 |
pub tcpi_ato: u32, |
| 339 |
pub tcpi_snd_mss: u32, |
| 340 |
pub tcpi_rcv_mss: u32, |
| 341 |
pub tcpi_unacked: u32, |
| 342 |
pub tcpi_sacked: u32, |
| 343 |
pub tcpi_lost: u32, |
| 344 |
pub tcpi_retrans: u32, |
| 345 |
pub tcpi_fackets: u32, |
| 346 |
pub tcpi_last_data_sent: u32, |
| 347 |
pub tcpi_last_ack_sent: u32, |
| 348 |
pub tcpi_last_data_recv: u32, |
| 349 |
pub tcpi_last_ack_recv: u32, |
| 350 |
pub tcpi_pmtu: u32, |
| 351 |
pub tcpi_rcv_ssthresh: u32, |
| 352 |
pub tcpi_rtt: u32, |
| 353 |
pub tcpi_rttvar: u32, |
| 354 |
pub tcpi_snd_ssthresh: u32, |
| 355 |
pub tcpi_snd_cwnd: u32, |
| 356 |
pub tcpi_advmss: u32, |
| 357 |
pub tcpi_reordering: u32, |
| 358 |
pub tcpi_rcv_rtt: u32, |
| 359 |
pub tcpi_rcv_space: u32, |
| 360 |
pub tcpi_total_retrans: u32, |
| 361 |
pub tcpi_pacing_rate: u64, |
| 362 |
pub tcpi_max_pacing_rate: u64, |
| 363 |
pub tcpi_bytes_acked: u64, |
| 364 |
pub tcpi_bytes_received: u64, |
| 365 |
pub tcpi_segs_out: u32, |
| 366 |
pub tcpi_segs_in: u32, |
| 367 |
pub tcpi_notsent_bytes: u32, |
| 368 |
pub tcpi_min_rtt: u32, |
| 369 |
pub tcpi_data_segs_in: u32, |
| 370 |
pub tcpi_data_segs_out: u32, |
| 371 |
pub tcpi_delivery_rate: u64, |
| 372 |
pub tcpi_busy_time: u64, |
| 373 |
pub tcpi_rwnd_limited: u64, |
| 374 |
pub tcpi_sndbuf_limited: u64, |
| 375 |
pub tcpi_delivered: u32, |
| 376 |
pub tcpi_delivered_ce: u32, |
| 377 |
pub tcpi_bytes_sent: u64, |
| 378 |
pub tcpi_bytes_retrans: u64, |
| 379 |
pub tcpi_dsack_dups: u32, |
| 380 |
pub tcpi_reord_seen: u32, |
| 381 |
// FIXME(musl): enable on all targets once CI musl is updated |
| 382 |
#[cfg(target_arch = "loongarch64")] |
| 383 |
pub tcpi_rcv_ooopack: u32, |
| 384 |
#[cfg(target_arch = "loongarch64")] |
| 385 |
pub tcpi_snd_wnd: u32, |
| 386 |
} |
| 387 |
|
| 388 |
// MIPS implementation is special (see mips arch folders) |
| 389 |
#[cfg(not(target_arch = "mips"))] |
| 390 |
pub struct statfs { |
| 391 |
pub f_type: c_ulong, |
| 392 |
pub f_bsize: c_ulong, |
| 393 |
pub f_blocks: crate::fsblkcnt_t, |
| 394 |
pub f_bfree: crate::fsblkcnt_t, |
| 395 |
pub f_bavail: crate::fsblkcnt_t, |
| 396 |
pub f_files: crate::fsfilcnt_t, |
| 397 |
pub f_ffree: crate::fsfilcnt_t, |
| 398 |
pub f_fsid: crate::fsid_t, |
| 399 |
pub f_namelen: c_ulong, |
| 400 |
pub f_frsize: c_ulong, |
| 401 |
pub f_flags: c_ulong, |
| 402 |
pub f_spare: [c_ulong; 4], |
| 403 |
} |
| 404 |
|
| 405 |
// MIPS implementation is special (see mips arch folders) |
| 406 |
#[cfg(not(target_arch = "mips"))] |
| 407 |
pub struct statfs64 { |
| 408 |
pub f_type: c_ulong, |
| 409 |
pub f_bsize: c_ulong, |
| 410 |
pub f_blocks: crate::fsblkcnt64_t, |
| 411 |
pub f_bfree: crate::fsblkcnt64_t, |
| 412 |
pub f_bavail: crate::fsblkcnt64_t, |
| 413 |
pub f_files: crate::fsfilcnt64_t, |
| 414 |
pub f_ffree: crate::fsfilcnt64_t, |
| 415 |
pub f_fsid: crate::fsid_t, |
| 416 |
pub f_namelen: c_ulong, |
| 417 |
pub f_frsize: c_ulong, |
| 418 |
pub f_flags: c_ulong, |
| 419 |
pub f_spare: [c_ulong; 4], |
| 420 |
} |
| 421 |
} |
| 422 |
|
| 423 |
s_no_extra_traits! { |
| 424 |
pub struct sysinfo { |
| 425 |
pub uptime: c_ulong, |
| 426 |
pub loads: [c_ulong; 3], |
| 427 |
pub totalram: c_ulong, |
| 428 |
pub freeram: c_ulong, |
| 429 |
pub sharedram: c_ulong, |
| 430 |
pub bufferram: c_ulong, |
| 431 |
pub totalswap: c_ulong, |
| 432 |
pub freeswap: c_ulong, |
| 433 |
pub procs: c_ushort, |
| 434 |
pub pad: c_ushort, |
| 435 |
pub totalhigh: c_ulong, |
| 436 |
pub freehigh: c_ulong, |
| 437 |
pub mem_unit: c_uint, |
| 438 |
pub __reserved: [c_char; 256], |
| 439 |
} |
| 440 |
|
| 441 |
// FIXME(musl): musl added paddings and adjusted |
| 442 |
// layout in 1.2.0 but our CI is still 1.1.24. |
| 443 |
// So, I'm leaving some fields as cfg for now. |
| 444 |
// ref. https://github.com/bminor/musl/commit/ |
| 445 |
// 1e7f0fcd7ff2096904fd93a2ee6d12a2392be392 |
| 446 |
// |
| 447 |
// OpenHarmony uses the musl 1.2 layout. |
| 448 |
pub struct utmpx { |
| 449 |
pub ut_type: c_short, |
| 450 |
__ut_pad1: c_short, |
| 451 |
pub ut_pid: crate::pid_t, |
| 452 |
pub ut_line: [c_char; 32], |
| 453 |
pub ut_id: [c_char; 4], |
| 454 |
pub ut_user: [c_char; 32], |
| 455 |
pub ut_host: [c_char; 256], |
| 456 |
pub ut_exit: __exit_status, |
| 457 |
|
| 458 |
#[cfg(target_env = "musl")] |
| 459 |
#[cfg(not(target_arch = "loongarch64"))] |
| 460 |
pub ut_session: c_long, |
| 461 |
|
| 462 |
#[cfg(target_env = "musl")] |
| 463 |
#[cfg(target_arch = "loongarch64")] |
| 464 |
pub ut_session: c_int, |
| 465 |
|
| 466 |
#[cfg(target_env = "musl")] |
| 467 |
#[cfg(target_arch = "loongarch64")] |
| 468 |
__ut_pad2: c_int, |
| 469 |
|
| 470 |
#[cfg(target_env = "ohos")] |
| 471 |
#[cfg(target_endian = "little")] |
| 472 |
pub ut_session: c_int, |
| 473 |
#[cfg(target_env = "ohos")] |
| 474 |
#[cfg(target_endian = "little")] |
| 475 |
__ut_pad2: c_int, |
| 476 |
|
| 477 |
#[cfg(target_env = "ohos")] |
| 478 |
#[cfg(not(target_endian = "little"))] |
| 479 |
__ut_pad2: c_int, |
| 480 |
#[cfg(target_env = "ohos")] |
| 481 |
#[cfg(not(target_endian = "little"))] |
| 482 |
pub ut_session: c_int, |
| 483 |
|
| 484 |
pub ut_tv: crate::timeval, |
| 485 |
pub ut_addr_v6: [c_uint; 4], |
| 486 |
__unused: [c_char; 20], |
| 487 |
} |
| 488 |
} |
| 489 |
|
| 490 |
cfg_if! { |
| 491 |
if #[cfg(feature = "extra_traits")] { |
| 492 |
impl PartialEq for sysinfo { |
| 493 |
fn eq(&self, other: &sysinfo) -> bool { |
| 494 |
self.uptime == other.uptime |
| 495 |
&& self.loads == other.loads |
| 496 |
&& self.totalram == other.totalram |
| 497 |
&& self.freeram == other.freeram |
| 498 |
&& self.sharedram == other.sharedram |
| 499 |
&& self.bufferram == other.bufferram |
| 500 |
&& self.totalswap == other.totalswap |
| 501 |
&& self.freeswap == other.freeswap |
| 502 |
&& self.procs == other.procs |
| 503 |
&& self.pad == other.pad |
| 504 |
&& self.totalhigh == other.totalhigh |
| 505 |
&& self.freehigh == other.freehigh |
| 506 |
&& self.mem_unit == other.mem_unit |
| 507 |
&& self |
| 508 |
.__reserved |
| 509 |
.iter() |
| 510 |
.zip(other.__reserved.iter()) |
| 511 |
.all(|(a, b)| a == b) |
| 512 |
} |
| 513 |
} |
| 514 |
|
| 515 |
impl Eq for sysinfo {} |
| 516 |
|
| 517 |
impl fmt::Debug for sysinfo { |
| 518 |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 519 |
f.debug_struct("sysinfo") |
| 520 |
.field("uptime", &self.uptime) |
| 521 |
.field("loads", &self.loads) |
| 522 |
.field("totalram", &self.totalram) |
| 523 |
.field("freeram", &self.freeram) |
| 524 |
.field("sharedram", &self.sharedram) |
| 525 |
.field("bufferram", &self.bufferram) |
| 526 |
.field("totalswap", &self.totalswap) |
| 527 |
.field("freeswap", &self.freeswap) |
| 528 |
.field("procs", &self.procs) |
| 529 |
.field("pad", &self.pad) |
| 530 |
.field("totalhigh", &self.totalhigh) |
| 531 |
.field("freehigh", &self.freehigh) |
| 532 |
.field("mem_unit", &self.mem_unit) |
| 533 |
// FIXME(debug): .field("__reserved", &self.__reserved) |
| 534 |
.finish() |
| 535 |
} |
| 536 |
} |
| 537 |
|
| 538 |
impl hash::Hash for sysinfo { |
| 539 |
fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 540 |
self.uptime.hash(state); |
| 541 |
self.loads.hash(state); |
| 542 |
self.totalram.hash(state); |
| 543 |
self.freeram.hash(state); |
| 544 |
self.sharedram.hash(state); |
| 545 |
self.bufferram.hash(state); |
| 546 |
self.totalswap.hash(state); |
| 547 |
self.freeswap.hash(state); |
| 548 |
self.procs.hash(state); |
| 549 |
self.pad.hash(state); |
| 550 |
self.totalhigh.hash(state); |
| 551 |
self.freehigh.hash(state); |
| 552 |
self.mem_unit.hash(state); |
| 553 |
self.__reserved.hash(state); |
| 554 |
} |
| 555 |
} |
| 556 |
|
| 557 |
impl PartialEq for utmpx { |
| 558 |
fn eq(&self, other: &utmpx) -> bool { |
| 559 |
self.ut_type == other.ut_type |
| 560 |
//&& self.__ut_pad1 == other.__ut_pad1 |
| 561 |
&& self.ut_pid == other.ut_pid |
| 562 |
&& self.ut_line == other.ut_line |
| 563 |
&& self.ut_id == other.ut_id |
| 564 |
&& self.ut_user == other.ut_user |
| 565 |
&& self |
| 566 |
.ut_host |
| 567 |
.iter() |
| 568 |
.zip(other.ut_host.iter()) |
| 569 |
.all(|(a,b)| a == b) |
| 570 |
&& self.ut_exit == other.ut_exit |
| 571 |
&& self.ut_session == other.ut_session |
| 572 |
//&& self.__ut_pad2 == other.__ut_pad2 |
| 573 |
&& self.ut_tv == other.ut_tv |
| 574 |
&& self.ut_addr_v6 == other.ut_addr_v6 |
| 575 |
&& self.__unused == other.__unused |
| 576 |
} |
| 577 |
} |
| 578 |
|
| 579 |
impl Eq for utmpx {} |
| 580 |
|
| 581 |
impl fmt::Debug for utmpx { |
| 582 |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 583 |
f.debug_struct("utmpx") |
| 584 |
.field("ut_type", &self.ut_type) |
| 585 |
//.field("__ut_pad1", &self.__ut_pad1) |
| 586 |
.field("ut_pid", &self.ut_pid) |
| 587 |
.field("ut_line", &self.ut_line) |
| 588 |
.field("ut_id", &self.ut_id) |
| 589 |
.field("ut_user", &self.ut_user) |
| 590 |
//FIXME(debug): .field("ut_host", &self.ut_host) |
| 591 |
.field("ut_exit", &self.ut_exit) |
| 592 |
.field("ut_session", &self.ut_session) |
| 593 |
//.field("__ut_pad2", &self.__ut_pad2) |
| 594 |
.field("ut_tv", &self.ut_tv) |
| 595 |
.field("ut_addr_v6", &self.ut_addr_v6) |
| 596 |
.field("__unused", &self.__unused) |
| 597 |
.finish() |
| 598 |
} |
| 599 |
} |
| 600 |
|
| 601 |
impl hash::Hash for utmpx { |
| 602 |
fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 603 |
self.ut_type.hash(state); |
| 604 |
//self.__ut_pad1.hash(state); |
| 605 |
self.ut_pid.hash(state); |
| 606 |
self.ut_line.hash(state); |
| 607 |
self.ut_id.hash(state); |
| 608 |
self.ut_user.hash(state); |
| 609 |
self.ut_host.hash(state); |
| 610 |
self.ut_exit.hash(state); |
| 611 |
self.ut_session.hash(state); |
| 612 |
//self.__ut_pad2.hash(state); |
| 613 |
self.ut_tv.hash(state); |
| 614 |
self.ut_addr_v6.hash(state); |
| 615 |
self.__unused.hash(state); |
| 616 |
} |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
|
| 621 |
// include/sys/mman.h |
| 622 |
/* |
| 623 |
* Huge page size encoding when MAP_HUGETLB is specified, and a huge page |
| 624 |
* size other than the default is desired. See hugetlb_encode.h. |
| 625 |
* All known huge page size encodings are provided here. It is the |
| 626 |
* responsibility of the application to know which sizes are supported on |
| 627 |
* the running system. See mmap(2) man page for details. |
| 628 |
*/ |
| 629 |
pub const MAP_HUGE_SHIFT: c_int = 26; |
| 630 |
pub const MAP_HUGE_MASK: c_int = 0x3f; |
| 631 |
|
| 632 |
pub const MAP_HUGE_64KB: c_int = 16 << MAP_HUGE_SHIFT; |
| 633 |
pub const MAP_HUGE_512KB: c_int = 19 << MAP_HUGE_SHIFT; |
| 634 |
pub const MAP_HUGE_1MB: c_int = 20 << MAP_HUGE_SHIFT; |
| 635 |
pub const MAP_HUGE_2MB: c_int = 21 << MAP_HUGE_SHIFT; |
| 636 |
pub const MAP_HUGE_8MB: c_int = 23 << MAP_HUGE_SHIFT; |
| 637 |
pub const MAP_HUGE_16MB: c_int = 24 << MAP_HUGE_SHIFT; |
| 638 |
pub const MAP_HUGE_32MB: c_int = 25 << MAP_HUGE_SHIFT; |
| 639 |
pub const MAP_HUGE_256MB: c_int = 28 << MAP_HUGE_SHIFT; |
| 640 |
pub const MAP_HUGE_512MB: c_int = 29 << MAP_HUGE_SHIFT; |
| 641 |
pub const MAP_HUGE_1GB: c_int = 30 << MAP_HUGE_SHIFT; |
| 642 |
pub const MAP_HUGE_2GB: c_int = 31 << MAP_HUGE_SHIFT; |
| 643 |
pub const MAP_HUGE_16GB: c_int = 34 << MAP_HUGE_SHIFT; |
| 644 |
|
| 645 |
pub const MS_RMT_MASK: c_ulong = 0x02800051; |
| 646 |
|
| 647 |
// include/utmpx.h |
| 648 |
pub const EMPTY: c_short = 0; |
| 649 |
pub const RUN_LVL: c_short = 1; |
| 650 |
pub const BOOT_TIME: c_short = 2; |
| 651 |
pub const NEW_TIME: c_short = 3; |
| 652 |
pub const OLD_TIME: c_short = 4; |
| 653 |
pub const INIT_PROCESS: c_short = 5; |
| 654 |
pub const LOGIN_PROCESS: c_short = 6; |
| 655 |
pub const USER_PROCESS: c_short = 7; |
| 656 |
pub const DEAD_PROCESS: c_short = 8; |
| 657 |
// musl does not define ACCOUNTING |
| 658 |
|
| 659 |
pub const SFD_CLOEXEC: c_int = 0x080000; |
| 660 |
|
| 661 |
pub const NCCS: usize = 32; |
| 662 |
|
| 663 |
pub const O_TRUNC: c_int = 512; |
| 664 |
pub const O_NOATIME: c_int = 0o1000000; |
| 665 |
pub const O_CLOEXEC: c_int = 0x80000; |
| 666 |
pub const O_TMPFILE: c_int = 0o20000000 | O_DIRECTORY; |
| 667 |
|
| 668 |
pub const EBFONT: c_int = 59; |
| 669 |
pub const ENOSTR: c_int = 60; |
| 670 |
pub const ENODATA: c_int = 61; |
| 671 |
pub const ETIME: c_int = 62; |
| 672 |
pub const ENOSR: c_int = 63; |
| 673 |
pub const ENONET: c_int = 64; |
| 674 |
pub const ENOPKG: c_int = 65; |
| 675 |
pub const EREMOTE: c_int = 66; |
| 676 |
pub const ENOLINK: c_int = 67; |
| 677 |
pub const EADV: c_int = 68; |
| 678 |
pub const ESRMNT: c_int = 69; |
| 679 |
pub const ECOMM: c_int = 70; |
| 680 |
pub const EPROTO: c_int = 71; |
| 681 |
pub const EDOTDOT: c_int = 73; |
| 682 |
|
| 683 |
pub const F_OFD_GETLK: c_int = 36; |
| 684 |
pub const F_OFD_SETLK: c_int = 37; |
| 685 |
pub const F_OFD_SETLKW: c_int = 38; |
| 686 |
|
| 687 |
pub const F_RDLCK: c_int = 0; |
| 688 |
pub const F_WRLCK: c_int = 1; |
| 689 |
pub const F_UNLCK: c_int = 2; |
| 690 |
|
| 691 |
pub const SA_NODEFER: c_int = 0x40000000; |
| 692 |
pub const SA_RESETHAND: c_int = 0x80000000; |
| 693 |
pub const SA_RESTART: c_int = 0x10000000; |
| 694 |
pub const SA_NOCLDSTOP: c_int = 0x00000001; |
| 695 |
|
| 696 |
pub const EPOLL_CLOEXEC: c_int = 0x80000; |
| 697 |
|
| 698 |
pub const EFD_CLOEXEC: c_int = 0x80000; |
| 699 |
|
| 700 |
pub const BUFSIZ: c_uint = 1024; |
| 701 |
pub const TMP_MAX: c_uint = 10000; |
| 702 |
pub const FOPEN_MAX: c_uint = 1000; |
| 703 |
pub const FILENAME_MAX: c_uint = 4096; |
| 704 |
pub const O_PATH: c_int = 0o10000000; |
| 705 |
pub const O_EXEC: c_int = 0o10000000; |
| 706 |
pub const O_SEARCH: c_int = 0o10000000; |
| 707 |
pub const O_ACCMODE: c_int = 0o10000003; |
| 708 |
pub const O_NDELAY: c_int = O_NONBLOCK; |
| 709 |
pub const NI_MAXHOST: crate::socklen_t = 255; |
| 710 |
pub const PTHREAD_STACK_MIN: size_t = 2048; |
| 711 |
|
| 712 |
pub const POSIX_MADV_DONTNEED: c_int = 4; |
| 713 |
|
| 714 |
pub const MAP_ANONYMOUS: c_int = MAP_ANON; |
| 715 |
|
| 716 |
pub const SOCK_SEQPACKET: c_int = 5; |
| 717 |
pub const SOCK_DCCP: c_int = 6; |
| 718 |
pub const SOCK_NONBLOCK: c_int = O_NONBLOCK; |
| 719 |
#[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] |
| 720 |
pub const SOCK_PACKET: c_int = 10; |
| 721 |
|
| 722 |
pub const SOMAXCONN: c_int = 128; |
| 723 |
|
| 724 |
#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] |
| 725 |
pub const SIGUNUSED: c_int = crate::SIGSYS; |
| 726 |
|
| 727 |
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; |
| 728 |
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; |
| 729 |
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
| 730 |
pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4; |
| 731 |
|
| 732 |
#[cfg(not(target_arch = "loongarch64"))] |
| 733 |
pub const CPU_SETSIZE: c_int = 128; |
| 734 |
#[cfg(target_arch = "loongarch64")] |
| 735 |
pub const CPU_SETSIZE: c_int = 1024; |
| 736 |
|
| 737 |
pub const PTRACE_TRACEME: c_int = 0; |
| 738 |
pub const PTRACE_PEEKTEXT: c_int = 1; |
| 739 |
pub const PTRACE_PEEKDATA: c_int = 2; |
| 740 |
pub const PTRACE_PEEKUSER: c_int = 3; |
| 741 |
pub const PTRACE_POKETEXT: c_int = 4; |
| 742 |
pub const PTRACE_POKEDATA: c_int = 5; |
| 743 |
pub const PTRACE_POKEUSER: c_int = 6; |
| 744 |
pub const PTRACE_CONT: c_int = 7; |
| 745 |
pub const PTRACE_KILL: c_int = 8; |
| 746 |
pub const PTRACE_SINGLESTEP: c_int = 9; |
| 747 |
pub const PTRACE_GETREGS: c_int = 12; |
| 748 |
pub const PTRACE_SETREGS: c_int = 13; |
| 749 |
pub const PTRACE_GETFPREGS: c_int = 14; |
| 750 |
pub const PTRACE_SETFPREGS: c_int = 15; |
| 751 |
pub const PTRACE_ATTACH: c_int = 16; |
| 752 |
pub const PTRACE_DETACH: c_int = 17; |
| 753 |
pub const PTRACE_GETFPXREGS: c_int = 18; |
| 754 |
pub const PTRACE_SETFPXREGS: c_int = 19; |
| 755 |
pub const PTRACE_SYSCALL: c_int = 24; |
| 756 |
pub const PTRACE_SETOPTIONS: c_int = 0x4200; |
| 757 |
pub const PTRACE_GETEVENTMSG: c_int = 0x4201; |
| 758 |
pub const PTRACE_GETSIGINFO: c_int = 0x4202; |
| 759 |
pub const PTRACE_SETSIGINFO: c_int = 0x4203; |
| 760 |
pub const PTRACE_GETREGSET: c_int = 0x4204; |
| 761 |
pub const PTRACE_SETREGSET: c_int = 0x4205; |
| 762 |
pub const PTRACE_SEIZE: c_int = 0x4206; |
| 763 |
pub const PTRACE_INTERRUPT: c_int = 0x4207; |
| 764 |
pub const PTRACE_LISTEN: c_int = 0x4208; |
| 765 |
pub const PTRACE_PEEKSIGINFO: c_int = 0x4209; |
| 766 |
pub const PTRACE_GETSIGMASK: c_uint = 0x420a; |
| 767 |
pub const PTRACE_SETSIGMASK: c_uint = 0x420b; |
| 768 |
|
| 769 |
pub const RWF_HIPRI: c_int = 0x00000001; |
| 770 |
pub const RWF_DSYNC: c_int = 0x00000002; |
| 771 |
pub const RWF_SYNC: c_int = 0x00000004; |
| 772 |
pub const RWF_NOWAIT: c_int = 0x00000008; |
| 773 |
pub const RWF_APPEND: c_int = 0x00000010; |
| 774 |
|
| 775 |
pub const AF_IB: c_int = 27; |
| 776 |
pub const AF_MPLS: c_int = 28; |
| 777 |
pub const AF_NFC: c_int = 39; |
| 778 |
pub const AF_VSOCK: c_int = 40; |
| 779 |
pub const AF_XDP: c_int = 44; |
| 780 |
pub const PF_IB: c_int = AF_IB; |
| 781 |
pub const PF_MPLS: c_int = AF_MPLS; |
| 782 |
pub const PF_NFC: c_int = AF_NFC; |
| 783 |
pub const PF_VSOCK: c_int = AF_VSOCK; |
| 784 |
pub const PF_XDP: c_int = AF_XDP; |
| 785 |
|
| 786 |
pub const EFD_NONBLOCK: c_int = crate::O_NONBLOCK; |
| 787 |
|
| 788 |
pub const SFD_NONBLOCK: c_int = crate::O_NONBLOCK; |
| 789 |
|
| 790 |
pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint; |
| 791 |
|
| 792 |
pub const TCSANOW: c_int = 0; |
| 793 |
pub const TCSADRAIN: c_int = 1; |
| 794 |
pub const TCSAFLUSH: c_int = 2; |
| 795 |
|
| 796 |
pub const RTLD_GLOBAL: c_int = 0x100; |
| 797 |
pub const RTLD_NOLOAD: c_int = 0x4; |
| 798 |
|
| 799 |
pub const CLOCK_SGI_CYCLE: crate::clockid_t = 10; |
| 800 |
|
| 801 |
pub const B0: crate::speed_t = 0o000000; |
| 802 |
pub const B50: crate::speed_t = 0o000001; |
| 803 |
pub const B75: crate::speed_t = 0o000002; |
| 804 |
pub const B110: crate::speed_t = 0o000003; |
| 805 |
pub const B134: crate::speed_t = 0o000004; |
| 806 |
pub const B150: crate::speed_t = 0o000005; |
| 807 |
pub const B200: crate::speed_t = 0o000006; |
| 808 |
pub const B300: crate::speed_t = 0o000007; |
| 809 |
pub const B600: crate::speed_t = 0o000010; |
| 810 |
pub const B1200: crate::speed_t = 0o000011; |
| 811 |
pub const B1800: crate::speed_t = 0o000012; |
| 812 |
pub const B2400: crate::speed_t = 0o000013; |
| 813 |
pub const B4800: crate::speed_t = 0o000014; |
| 814 |
pub const B9600: crate::speed_t = 0o000015; |
| 815 |
pub const B19200: crate::speed_t = 0o000016; |
| 816 |
pub const B38400: crate::speed_t = 0o000017; |
| 817 |
pub const EXTA: crate::speed_t = B19200; |
| 818 |
pub const EXTB: crate::speed_t = B38400; |
| 819 |
|
| 820 |
pub const REG_OK: c_int = 0; |
| 821 |
|
| 822 |
pub const PRIO_PROCESS: c_int = 0; |
| 823 |
pub const PRIO_PGRP: c_int = 1; |
| 824 |
pub const PRIO_USER: c_int = 2; |
| 825 |
|
| 826 |
pub const ADJ_OFFSET: c_uint = 0x0001; |
| 827 |
pub const ADJ_FREQUENCY: c_uint = 0x0002; |
| 828 |
pub const ADJ_MAXERROR: c_uint = 0x0004; |
| 829 |
pub const ADJ_ESTERROR: c_uint = 0x0008; |
| 830 |
pub const ADJ_STATUS: c_uint = 0x0010; |
| 831 |
pub const ADJ_TIMECONST: c_uint = 0x0020; |
| 832 |
pub const ADJ_TAI: c_uint = 0x0080; |
| 833 |
pub const ADJ_SETOFFSET: c_uint = 0x0100; |
| 834 |
pub const ADJ_MICRO: c_uint = 0x1000; |
| 835 |
pub const ADJ_NANO: c_uint = 0x2000; |
| 836 |
pub const ADJ_TICK: c_uint = 0x4000; |
| 837 |
pub const ADJ_OFFSET_SINGLESHOT: c_uint = 0x8001; |
| 838 |
pub const ADJ_OFFSET_SS_READ: c_uint = 0xa001; |
| 839 |
pub const MOD_OFFSET: c_uint = ADJ_OFFSET; |
| 840 |
pub const MOD_FREQUENCY: c_uint = ADJ_FREQUENCY; |
| 841 |
pub const MOD_MAXERROR: c_uint = ADJ_MAXERROR; |
| 842 |
pub const MOD_ESTERROR: c_uint = ADJ_ESTERROR; |
| 843 |
pub const MOD_STATUS: c_uint = ADJ_STATUS; |
| 844 |
pub const MOD_TIMECONST: c_uint = ADJ_TIMECONST; |
| 845 |
pub const MOD_CLKB: c_uint = ADJ_TICK; |
| 846 |
pub const MOD_CLKA: c_uint = ADJ_OFFSET_SINGLESHOT; |
| 847 |
pub const MOD_TAI: c_uint = ADJ_TAI; |
| 848 |
pub const MOD_MICRO: c_uint = ADJ_MICRO; |
| 849 |
pub const MOD_NANO: c_uint = ADJ_NANO; |
| 850 |
pub const STA_PLL: c_int = 0x0001; |
| 851 |
pub const STA_PPSFREQ: c_int = 0x0002; |
| 852 |
pub const STA_PPSTIME: c_int = 0x0004; |
| 853 |
pub const STA_FLL: c_int = 0x0008; |
| 854 |
pub const STA_INS: c_int = 0x0010; |
| 855 |
pub const STA_DEL: c_int = 0x0020; |
| 856 |
pub const STA_UNSYNC: c_int = 0x0040; |
| 857 |
pub const STA_FREQHOLD: c_int = 0x0080; |
| 858 |
pub const STA_PPSSIGNAL: c_int = 0x0100; |
| 859 |
pub const STA_PPSJITTER: c_int = 0x0200; |
| 860 |
pub const STA_PPSWANDER: c_int = 0x0400; |
| 861 |
pub const STA_PPSERROR: c_int = 0x0800; |
| 862 |
pub const STA_CLOCKERR: c_int = 0x1000; |
| 863 |
pub const STA_NANO: c_int = 0x2000; |
| 864 |
pub const STA_MODE: c_int = 0x4000; |
| 865 |
pub const STA_CLK: c_int = 0x8000; |
| 866 |
pub const STA_RONLY: c_int = STA_PPSSIGNAL |
| 867 |
| STA_PPSJITTER |
| 868 |
| STA_PPSWANDER |
| 869 |
| STA_PPSERROR |
| 870 |
| STA_CLOCKERR |
| 871 |
| STA_NANO |
| 872 |
| STA_MODE |
| 873 |
| STA_CLK; |
| 874 |
|
| 875 |
pub const TIME_OK: c_int = 0; |
| 876 |
pub const TIME_INS: c_int = 1; |
| 877 |
pub const TIME_DEL: c_int = 2; |
| 878 |
pub const TIME_OOP: c_int = 3; |
| 879 |
pub const TIME_WAIT: c_int = 4; |
| 880 |
pub const TIME_ERROR: c_int = 5; |
| 881 |
pub const TIME_BAD: c_int = TIME_ERROR; |
| 882 |
pub const MAXTC: c_long = 6; |
| 883 |
|
| 884 |
pub const _CS_V6_ENV: c_int = 1148; |
| 885 |
pub const _CS_V7_ENV: c_int = 1149; |
| 886 |
|
| 887 |
pub const CLONE_NEWTIME: c_int = 0x80; |
| 888 |
|
| 889 |
cfg_if! { |
| 890 |
if #[cfg(target_arch = "s390x")] { |
| 891 |
pub const POSIX_FADV_DONTNEED: c_int = 6; |
| 892 |
pub const POSIX_FADV_NOREUSE: c_int = 7; |
| 893 |
} else { |
| 894 |
pub const POSIX_FADV_DONTNEED: c_int = 4; |
| 895 |
pub const POSIX_FADV_NOREUSE: c_int = 5; |
| 896 |
} |
| 897 |
} |
| 898 |
|
| 899 |
extern "C" { |
| 900 |
pub fn sendmmsg( |
| 901 |
sockfd: c_int, |
| 902 |
msgvec: *mut crate::mmsghdr, |
| 903 |
vlen: c_uint, |
| 904 |
flags: c_uint, |
| 905 |
) -> c_int; |
| 906 |
pub fn recvmmsg( |
| 907 |
sockfd: c_int, |
| 908 |
msgvec: *mut crate::mmsghdr, |
| 909 |
vlen: c_uint, |
| 910 |
flags: c_uint, |
| 911 |
timeout: *mut crate::timespec, |
| 912 |
) -> c_int; |
| 913 |
|
| 914 |
pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; |
| 915 |
pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; |
| 916 |
pub fn prlimit( |
| 917 |
pid: crate::pid_t, |
| 918 |
resource: c_int, |
| 919 |
new_limit: *const crate::rlimit, |
| 920 |
old_limit: *mut crate::rlimit, |
| 921 |
) -> c_int; |
| 922 |
pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int; |
| 923 |
pub fn ptrace(request: c_int, ...) -> c_long; |
| 924 |
pub fn getpriority(which: c_int, who: crate::id_t) -> c_int; |
| 925 |
pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int; |
| 926 |
// Musl targets need the `mask` argument of `fanotify_mark` be specified |
| 927 |
// `c_ulonglong` instead of `u64` or there will be a type mismatch between |
| 928 |
// `long long unsigned int` and the expected `uint64_t`. |
| 929 |
pub fn fanotify_mark( |
| 930 |
fd: c_int, |
| 931 |
flags: c_uint, |
| 932 |
mask: c_ulonglong, |
| 933 |
dirfd: c_int, |
| 934 |
path: *const c_char, |
| 935 |
) -> c_int; |
| 936 |
pub fn preadv2( |
| 937 |
fd: c_int, |
| 938 |
iov: *const crate::iovec, |
| 939 |
iovcnt: c_int, |
| 940 |
offset: off_t, |
| 941 |
flags: c_int, |
| 942 |
) -> ssize_t; |
| 943 |
pub fn pwritev2( |
| 944 |
fd: c_int, |
| 945 |
iov: *const crate::iovec, |
| 946 |
iovcnt: c_int, |
| 947 |
offset: off_t, |
| 948 |
flags: c_int, |
| 949 |
) -> ssize_t; |
| 950 |
pub fn getauxval(type_: c_ulong) -> c_ulong; |
| 951 |
|
| 952 |
// Added in `musl` 1.1.20 |
| 953 |
pub fn explicit_bzero(s: *mut c_void, len: size_t); |
| 954 |
// Added in `musl` 1.2.2 |
| 955 |
pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void; |
| 956 |
|
| 957 |
pub fn adjtimex(buf: *mut crate::timex) -> c_int; |
| 958 |
pub fn clock_adjtime(clk_id: crate::clockid_t, buf: *mut crate::timex) -> c_int; |
| 959 |
|
| 960 |
pub fn ctermid(s: *mut c_char) -> *mut c_char; |
| 961 |
|
| 962 |
pub fn memfd_create(name: *const c_char, flags: c_uint) -> c_int; |
| 963 |
pub fn mlock2(addr: *const c_void, len: size_t, flags: c_uint) -> c_int; |
| 964 |
pub fn malloc_usable_size(ptr: *mut c_void) -> size_t; |
| 965 |
|
| 966 |
pub fn euidaccess(pathname: *const c_char, mode: c_int) -> c_int; |
| 967 |
pub fn eaccess(pathname: *const c_char, mode: c_int) -> c_int; |
| 968 |
|
| 969 |
pub fn asctime_r(tm: *const crate::tm, buf: *mut c_char) -> *mut c_char; |
| 970 |
|
| 971 |
pub fn dirname(path: *mut c_char) -> *mut c_char; |
| 972 |
pub fn basename(path: *mut c_char) -> *mut c_char; |
| 973 |
|
| 974 |
// Added in `musl` 1.1.24 |
| 975 |
pub fn posix_spawn_file_actions_addchdir_np( |
| 976 |
actions: *mut crate::posix_spawn_file_actions_t, |
| 977 |
path: *const c_char, |
| 978 |
) -> c_int; |
| 979 |
// Added in `musl` 1.1.24 |
| 980 |
pub fn posix_spawn_file_actions_addfchdir_np( |
| 981 |
actions: *mut crate::posix_spawn_file_actions_t, |
| 982 |
fd: c_int, |
| 983 |
) -> c_int; |
| 984 |
|
| 985 |
pub fn getutxent() -> *mut utmpx; |
| 986 |
pub fn getutxid(ut: *const utmpx) -> *mut utmpx; |
| 987 |
pub fn getutxline(ut: *const utmpx) -> *mut utmpx; |
| 988 |
pub fn pututxline(ut: *const utmpx) -> *mut utmpx; |
| 989 |
pub fn setutxent(); |
| 990 |
pub fn endutxent(); |
| 991 |
} |
| 992 |
|
| 993 |
// Alias <foo> to <foo>64 to mimic glibc's LFS64 support |
| 994 |
mod lfs64; |
| 995 |
pub use self::lfs64::*; |
| 996 |
|
| 997 |
cfg_if! { |
| 998 |
if #[cfg(any( |
| 999 |
target_arch = "x86_64", |
| 1000 |
target_arch = "aarch64", |
| 1001 |
target_arch = "mips64", |
| 1002 |
target_arch = "powerpc64", |
| 1003 |
target_arch = "s390x", |
| 1004 |
target_arch = "riscv64", |
| 1005 |
target_arch = "loongarch64", |
| 1006 |
// musl-linux ABI for wasm32 follows b64 convention |
| 1007 |
target_arch = "wasm32", |
| 1008 |
))] { |
| 1009 |
mod b64; |
| 1010 |
pub use self::b64::*; |
| 1011 |
} else if #[cfg(any( |
| 1012 |
target_arch = "x86", |
| 1013 |
target_arch = "mips", |
| 1014 |
target_arch = "powerpc", |
| 1015 |
target_arch = "hexagon", |
| 1016 |
target_arch = "riscv32", |
| 1017 |
target_arch = "arm" |
| 1018 |
))] { |
| 1019 |
mod b32; |
| 1020 |
pub use self::b32::*; |
| 1021 |
} else { |
| 1022 |
} |
| 1023 |
} |