From deed988406ae8d6c81b842091e961d813c09fc8a Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 16:11:29 -0500 Subject: [PATCH 1/9] ci: Add a timeout for all jobs The Android jobs seem to occasionally get stuck. Add a timeout of 10 minutes for simple jobs and 25 minutes for more complex jobs, which should make sure that if anything gets stuck it will get stopped. (backport ) (cherry picked from commit e1fe3d80860916f439c82ab68484d39ce8525ff0) --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f5132216cecc7..703b9d7868a3e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,7 @@ jobs: style_check: name: Style check runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -36,6 +37,7 @@ jobs: - toolchain: beta os: ubuntu-24.04 runs-on: ${{ matrix.os }} + timeout-minutes: 25 env: TOOLCHAIN: ${{ matrix.toolchain }} steps: @@ -73,6 +75,7 @@ jobs: - target: i686-pc-windows-msvc os: windows-2022 runs-on: ${{ matrix.os }} + timeout-minutes: 25 env: TARGET: ${{ matrix.target }} steps: @@ -123,6 +126,7 @@ jobs: # FIXME: It seems some items in `src/unix/mod.rs` # aren't defined on redox actually. # - x86_64-unknown-redox + timeout-minutes: 25 env: TARGET: ${{ matrix.target }} steps: @@ -141,6 +145,7 @@ jobs: matrix: target: - x86_64-pc-solaris + timeout-minutes: 25 steps: - uses: actions/checkout@v4 - name: test on Solaris @@ -164,6 +169,7 @@ jobs: runs-on: ubuntu-24.04 env: TOOLCHAIN: nightly + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain From e13cde2dff7d4965bfb12577f35d488ec3ba8a22 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 02:56:13 -0500 Subject: [PATCH 2/9] ci: Check various FreeBSD versions Since we suport multiple versions and this is tier 2, we should make sure that we can build with a couple versions. This does not run tests. Additionally, introduce an environment variable for an easy way to override the version for testing. This includes an unrelated cleanup adjustment in `verify-build.sh` (backport ) (cherry picked from commit 9c2f78eacbfc64b2e5528ea60c1811e02ed50ba7) --- build.rs | 9 ++++++++- ci/verify-build.sh | 50 ++++++++++++++++++++++++++++++++-------------- libc-test/build.rs | 7 +++++++ 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/build.rs b/build.rs index 8e9f877e83c9a..90fbc0d7c5fda 100644 --- a/build.rs +++ b/build.rs @@ -49,13 +49,20 @@ fn main() { // // On CI, we detect the actual FreeBSD version and match its ABI exactly, // running tests to ensure that the ABI is correct. - let which_freebsd = if libc_ci { + println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION"); + // Allow overriding the default version for testing + let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") { + let vers = version.parse().unwrap(); + println!("cargo:warning=setting FreeBSD version to {vers}"); + vers + } else if libc_ci { which_freebsd().unwrap_or(11) } else if rustc_dep_of_std { 12 } else { 11 }; + match which_freebsd { x if x < 10 => panic!("FreeBSD older than 10 is not supported"), 10 => set_cfg("freebsd10"), diff --git a/ci/verify-build.sh b/ci/verify-build.sh index afd87b40e4b96..e1cad0b7df57c 100755 --- a/ci/verify-build.sh +++ b/ci/verify-build.sh @@ -28,6 +28,7 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then rustup component add rust-src fi +# Run the tests for a specific target test_target() { target="${1}" no_dist="${2:-0}" @@ -68,8 +69,31 @@ test_target() { # Test again without default features, i.e. without "std" $cmd --no-default-features $cmd --no-default-features --features extra_traits + + # For tier 2 freebsd targets, check with the different versions we support + # if on nightly or stable + case "$rust-$target" in + stable-x86_64-*freebsd*) do_freebsd_checks=1 ;; + nightly-i686*freebsd*) do_freebsd_checks=1 ;; + esac + + if [ -n "${do_freebsd_checks:-}" ]; then + for version in $freebsd_versions; do + export RUST_LIBC_UNSTABLE_FREEBSD_VERSION="$version" + $cmd + $cmd --no-default-features + done + fi } +freebsd_versions="\ +11 \ +12 \ +13 \ +14 \ +15 \ +" + rust_linux_targets="\ aarch64-linux-android \ aarch64-unknown-linux-gnu \ @@ -244,21 +268,19 @@ for target in $targets; do if echo "$target" | grep -q "$filter"; then if [ "$os" = "windows" ]; then TARGET="$target" ./ci/install-rust.sh - test_target "$target" - else - # `wasm32-wasip1` was renamed from `wasm32-wasi` - if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then - target="wasm32-wasi" - fi + fi - # `wasm32-wasip2` only exists in recent versions of Rust - if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then - continue - fi - - test_target "$target" + # `wasm32-wasip1` was renamed from `wasm32-wasi` + if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then + target="wasm32-wasi" fi + # `wasm32-wasip2` only exists in recent versions of Rust + if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then + continue + fi + + test_target "$target" test_run=1 fi done @@ -267,11 +289,9 @@ for target in ${no_dist_targets:-}; do if echo "$target" | grep -q "$filter"; then if [ "$os" = "windows" ]; then TARGET="$target" ./ci/install-rust.sh - test_target "$target" 1 - else - test_target "$target" 1 fi + test_target "$target" 1 test_run=1 fi done diff --git a/libc-test/build.rs b/libc-test/build.rs index 12a04566de8bb..66548cea19b01 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -4734,9 +4734,16 @@ fn test_linux_like_apis(target: &str) { } fn which_freebsd() -> Option { + if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") { + let vers = version.parse().unwrap(); + println!("cargo:warning=setting FreeBSD version to {vers}"); + return Some(vers); + } + let output = std::process::Command::new("freebsd-version") .output() .ok()?; + if !output.status.success() { return None; } From 5d77970a4e20c79c75319942a38e213b3a59ad43 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 03:25:37 -0500 Subject: [PATCH 3/9] fix(freebsd): Run `cargo fix` with more FreeBSD versions For versions 10, 11, 12, 13, 14, 15, and architectures aarch64, i686, powerpc64, riscv64gc, and x86_64, I ran the following: RUST_LIBC_UNSTABLE_FREEBSD_VERSION=15 cargo fix \ -Zbuild-std=core \ --features extra_traits \ --allow-dirty \ --edition \ --broken-code \ --lib \ --target aarch64-unknown-freebsd (backport ) (cherry picked from commit 2e4ac8f24aa7f84df94d0dcbfa073e0ea444375b) Not an exact cherry pick, I just reran the command. --- .../bsd/freebsdlike/freebsd/freebsd12/mod.rs | 190 +++++++++--------- .../freebsdlike/freebsd/freebsd12/x86_64.rs | 4 +- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index b763d34e5fdf4..6bffccfc9fc70 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -12,18 +12,18 @@ pub type shmatt_t = c_uint; s! { pub struct shmid_ds { - pub shm_perm: ::ipc_perm, + pub shm_perm: crate::ipc_perm, pub shm_segsz: size_t, - pub shm_lpid: ::pid_t, - pub shm_cpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, + pub shm_lpid: crate::pid_t, + pub shm_cpid: crate::pid_t, + pub shm_nattch: crate::shmatt_t, + pub shm_atime: crate::time_t, + pub shm_dtime: crate::time_t, + pub shm_ctime: crate::time_t, } pub struct kevent { - pub ident: ::uintptr_t, + pub ident: crate::uintptr_t, pub filter: c_short, pub flags: c_ushort, pub fflags: c_uint, @@ -37,8 +37,8 @@ s! { pub paddr: c_ulong, pub kmap_vaddr: c_ulong, pub dmap_vaddr: c_ulong, - pub prot: ::vm_prot_t, - pub offset: ::u_long, + pub prot: crate::vm_prot_t, + pub offset: crate::u_long, pub len: size_t, } @@ -48,7 +48,7 @@ s! { /// Reserved: layout identifier. pub ki_layout: c_int, /// Address of command arguments. - pub ki_args: *mut ::pargs, + pub ki_args: *mut crate::pargs, // This is normally "struct proc". /// Address of proc. pub ki_paddr: *mut c_void, @@ -70,17 +70,17 @@ s! { /// Sleep address. pub ki_wchan: *mut c_void, /// Process identifier. - pub ki_pid: ::pid_t, + pub ki_pid: crate::pid_t, /// Parent process ID. - pub ki_ppid: ::pid_t, + pub ki_ppid: crate::pid_t, /// Process group ID. - pub ki_pgid: ::pid_t, + pub ki_pgid: crate::pid_t, /// tty process group ID. - pub ki_tpgid: ::pid_t, + pub ki_tpgid: crate::pid_t, /// Process session ID. - pub ki_sid: ::pid_t, + pub ki_sid: crate::pid_t, /// Terminal session ID. - pub ki_tsid: ::pid_t, + pub ki_tsid: crate::pid_t, /// Job control counter. pub ki_jobc: c_short, /// Unused (just here for alignment). @@ -88,61 +88,61 @@ s! { /// Controlling tty dev. pub ki_tdev_freebsd11: u32, /// Signals arrived but not delivered. - pub ki_siglist: ::sigset_t, + pub ki_siglist: crate::sigset_t, /// Current signal mask. - pub ki_sigmask: ::sigset_t, + pub ki_sigmask: crate::sigset_t, /// Signals being ignored. - pub ki_sigignore: ::sigset_t, + pub ki_sigignore: crate::sigset_t, /// Signals being caught by user. - pub ki_sigcatch: ::sigset_t, + pub ki_sigcatch: crate::sigset_t, /// Effective user ID. - pub ki_uid: ::uid_t, + pub ki_uid: crate::uid_t, /// Real user ID. - pub ki_ruid: ::uid_t, + pub ki_ruid: crate::uid_t, /// Saved effective user ID. - pub ki_svuid: ::uid_t, + pub ki_svuid: crate::uid_t, /// Real group ID. - pub ki_rgid: ::gid_t, + pub ki_rgid: crate::gid_t, /// Saved effective group ID. - pub ki_svgid: ::gid_t, + pub ki_svgid: crate::gid_t, /// Number of groups. pub ki_ngroups: c_short, /// Unused (just here for alignment). pub ki_spare_short2: c_short, /// Groups. - pub ki_groups: [::gid_t; ::KI_NGROUPS], + pub ki_groups: [crate::gid_t; crate::KI_NGROUPS], /// Virtual size. - pub ki_size: ::vm_size_t, + pub ki_size: crate::vm_size_t, /// Current resident set size in pages. - pub ki_rssize: ::segsz_t, + pub ki_rssize: crate::segsz_t, /// Resident set size before last swap. - pub ki_swrss: ::segsz_t, + pub ki_swrss: crate::segsz_t, /// Text size (pages) XXX. - pub ki_tsize: ::segsz_t, + pub ki_tsize: crate::segsz_t, /// Data size (pages) XXX. - pub ki_dsize: ::segsz_t, + pub ki_dsize: crate::segsz_t, /// Stack size (pages). - pub ki_ssize: ::segsz_t, + pub ki_ssize: crate::segsz_t, /// Exit status for wait & stop signal. - pub ki_xstat: ::u_short, + pub ki_xstat: crate::u_short, /// Accounting flags. - pub ki_acflag: ::u_short, + pub ki_acflag: crate::u_short, /// %cpu for process during `ki_swtime`. - pub ki_pctcpu: ::fixpt_t, + pub ki_pctcpu: crate::fixpt_t, /// Time averaged value of `ki_cpticks`. - pub ki_estcpu: ::u_int, + pub ki_estcpu: crate::u_int, /// Time since last blocked. - pub ki_slptime: ::u_int, + pub ki_slptime: crate::u_int, /// Time swapped in or out. - pub ki_swtime: ::u_int, + pub ki_swtime: crate::u_int, /// Number of copy-on-write faults. - pub ki_cow: ::u_int, + pub ki_cow: crate::u_int, /// Real time in microsec. pub ki_runtime: u64, /// Starting time. - pub ki_start: ::timeval, + pub ki_start: crate::timeval, /// Time used by process children. - pub ki_childtime: ::timeval, + pub ki_childtime: crate::timeval, /// P_* flags. pub ki_flag: c_long, /// KI_* flags (below). @@ -162,27 +162,27 @@ s! { /// Last cpu we were on. pub ki_lastcpu_old: c_uchar, /// Thread name. - pub ki_tdname: [c_char; ::TDNAMLEN + 1], + pub ki_tdname: [c_char; crate::TDNAMLEN + 1], /// Wchan message. - pub ki_wmesg: [c_char; ::WMESGLEN + 1], + pub ki_wmesg: [c_char; crate::WMESGLEN + 1], /// Setlogin name. - pub ki_login: [c_char; ::LOGNAMELEN + 1], + pub ki_login: [c_char; crate::LOGNAMELEN + 1], /// Lock name. - pub ki_lockname: [c_char; ::LOCKNAMELEN + 1], + pub ki_lockname: [c_char; crate::LOCKNAMELEN + 1], /// Command name. - pub ki_comm: [c_char; ::COMMLEN + 1], + pub ki_comm: [c_char; crate::COMMLEN + 1], /// Emulation name. - pub ki_emul: [c_char; ::KI_EMULNAMELEN + 1], + pub ki_emul: [c_char; crate::KI_EMULNAMELEN + 1], /// Login class. - pub ki_loginclass: [c_char; ::LOGINCLASSLEN + 1], + pub ki_loginclass: [c_char; crate::LOGINCLASSLEN + 1], /// More thread name. - pub ki_moretdname: [c_char; ::MAXCOMLEN - ::TDNAMLEN + 1], + pub ki_moretdname: [c_char; crate::MAXCOMLEN - crate::TDNAMLEN + 1], /// Spare string space. pub ki_sparestrings: [[c_char; 23]; 2], // little hack to allow PartialEq /// Spare room for growth. - pub ki_spareints: [c_int; ::KI_NSPARE_INT], + pub ki_spareints: [c_int; crate::KI_NSPARE_INT], /// Controlling tty dev. - pub ki_tdev: ::dev_t, + pub ki_tdev: crate::dev_t, /// Which cpu we are on. pub ki_oncpu: c_int, /// Last cpu we were on. @@ -194,19 +194,19 @@ s! { /// Default FIB number. pub ki_fibnum: c_int, /// Credential flags. - pub ki_cr_flags: ::u_int, + pub ki_cr_flags: crate::u_int, /// Process jail ID. pub ki_jid: c_int, /// Number of threads in total. pub ki_numthreads: c_int, /// Thread ID. - pub ki_tid: ::lwpid_t, + pub ki_tid: crate::lwpid_t, /// Process priority. - pub ki_pri: ::priority, + pub ki_pri: crate::priority, /// Process rusage statistics. - pub ki_rusage: ::rusage, + pub ki_rusage: crate::rusage, /// rusage of children processes. - pub ki_rusage_ch: ::rusage, + pub ki_rusage_ch: crate::rusage, // This is normally "struct pcb". /// Kernel virtual addr of pcb. pub ki_pcb: *mut c_void, @@ -216,8 +216,8 @@ s! { pub ki_udata: *mut c_void, // This is normally "struct thread". pub ki_tdaddr: *mut c_void, - pub ki_spareptrs: [*mut c_void; ::KI_NSPARE_PTR], - pub ki_sparelongs: [c_long; ::KI_NSPARE_LONG], + pub ki_spareptrs: [*mut c_void; crate::KI_NSPARE_PTR], + pub ki_sparelongs: [c_long; crate::KI_NSPARE_LONG], /// PS_* flags. pub ki_sflag: c_long, /// kthread flag. @@ -225,35 +225,35 @@ s! { } pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, + pub st_nlink: crate::nlink_t, + pub st_mode: crate::mode_t, st_padding0: i16, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, st_padding1: i32, - pub st_rdev: ::dev_t, + pub st_rdev: crate::dev_t, #[cfg(target_arch = "x86")] st_atim_ext: i32, - pub st_atime: ::time_t, + pub st_atime: crate::time_t, pub st_atime_nsec: c_long, #[cfg(target_arch = "x86")] st_mtim_ext: i32, - pub st_mtime: ::time_t, + pub st_mtime: crate::time_t, pub st_mtime_nsec: c_long, #[cfg(target_arch = "x86")] st_ctim_ext: i32, - pub st_ctime: ::time_t, + pub st_ctime: crate::time_t, pub st_ctime_nsec: c_long, #[cfg(target_arch = "x86")] st_btim_ext: i32, - pub st_birthtime: ::time_t, + pub st_birthtime: crate::time_t, pub st_birthtime_nsec: c_long, pub st_size: off_t, - pub st_blocks: ::blkcnt_t, - pub st_blksize: ::blksize_t, - pub st_flags: ::fflags_t, + pub st_blocks: crate::blkcnt_t, + pub st_blksize: crate::blksize_t, + pub st_flags: crate::fflags_t, pub st_gen: u64, pub st_spare: [u64; 10], } @@ -261,7 +261,7 @@ s! { s_no_extra_traits! { pub struct dirent { - pub d_fileno: ::ino_t, + pub d_fileno: crate::ino_t, pub d_off: off_t, pub d_reclen: u16, pub d_type: u8, @@ -288,8 +288,8 @@ s_no_extra_traits! { pub f_asyncreads: u64, f_spare: [u64; 10], pub f_namemax: u32, - pub f_owner: ::uid_t, - pub f_fsid: ::fsid_t, + pub f_owner: crate::uid_t, + pub f_fsid: crate::fsid_t, f_charspare: [c_char; 80], pub f_fstypename: [c_char; 16], pub f_mntfromname: [c_char; 1024], @@ -304,7 +304,7 @@ s_no_extra_traits! { pub vn_mntdir: *mut c_char, pub vn_type: c_int, pub vn_mode: u16, - pub vn_devname: [c_char; ::SPECNAMELEN as usize + 1], + pub vn_devname: [c_char; crate::SPECNAMELEN as usize + 1], } } @@ -343,8 +343,8 @@ cfg_if! { } } impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + impl crate::fmt::Debug for statfs { + fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -366,8 +366,8 @@ cfg_if! { .finish() } } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl crate::hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -406,8 +406,8 @@ cfg_if! { } } impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + impl crate::fmt::Debug for dirent { + fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -418,8 +418,8 @@ cfg_if! { .finish() } } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl crate::hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -445,8 +445,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + impl crate::fmt::Debug for vnstat { + fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -461,8 +461,8 @@ cfg_if! { .finish() } } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl crate::hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); @@ -488,9 +488,9 @@ pub const KI_NSPARE_PTR: usize = 6; pub const MINCORE_SUPER: c_int = 0x20; safe_f! { - pub {const} fn makedev(major: c_uint, minor: c_uint) -> ::dev_t { - let major = major as ::dev_t; - let minor = minor as ::dev_t; + pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { + let major = major as crate::dev_t; + let minor = minor as crate::dev_t; let mut dev = 0; dev |= ((major & 0xffffff00) as dev_t) << 32; dev |= ((major & 0x000000ff) as dev_t) << 8; @@ -501,11 +501,11 @@ safe_f! { } f! { - pub fn major(dev: ::dev_t) -> c_int { + pub fn major(dev: crate::dev_t) -> c_int { (((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as c_int } - pub fn minor(dev: ::dev_t) -> c_int { + pub fn minor(dev: crate::dev_t) -> c_int { (((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as c_int } } @@ -513,7 +513,7 @@ f! { extern "C" { pub fn setgrent(); pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; - pub fn freelocale(loc: ::locale_t); + pub fn freelocale(loc: crate::locale_t); pub fn msgrcv( msqid: c_int, msgp: *mut c_void, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs index 7c2d6853a8514..24713993f90a7 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs @@ -1,7 +1,7 @@ use crate::c_int; -pub const PROC_KPTI_CTL: c_int = ::PROC_PROCCTL_MD_MIN; +pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: c_int = 2; -pub const PROC_KPTI_STATUS: c_int = ::PROC_PROCCTL_MD_MIN + 1; +pub const PROC_KPTI_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 1; pub const PROC_KPTI_STATUS_ACTIVE: c_int = 0x80000000; From 867454921ca798012f98846a6dffc313d880c230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Wed, 27 Nov 2024 20:43:18 +0100 Subject: [PATCH 4/9] Handle remaining leading `::` in paths I looked for `[^\w]::` and fixed them manually. (backport ) (cherry picked from commit 82d30c6a287fcbb186539cd21b663e2ee1f48a75) --- ci/style.rs | 2 +- src/fuchsia/mod.rs | 2 +- src/teeos/mod.rs | 2 +- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/arm.rs | 2 +- src/unix/linux_like/linux/gnu/b32/m68k/mod.rs | 296 +++++++++--------- .../linux/gnu/b64/loongarch64/mod.rs | 6 +- .../linux/gnu/b64/x86_64/not_x32.rs | 6 +- src/unix/linux_like/linux/mod.rs | 4 +- .../linux_like/linux/musl/b32/riscv32/mod.rs | 12 +- .../linux/uclibc/mips/mips64/mod.rs | 110 +++---- src/unix/newlib/aarch64/mod.rs | 14 +- src/unix/nto/neutrino.rs | 22 +- src/unix/redox/mod.rs | 2 +- src/unix/solarish/x86.rs | 22 +- 16 files changed, 254 insertions(+), 254 deletions(-) diff --git a/ci/style.rs b/ci/style.rs index c4e0fb0db8058..f5aeabcc71b5a 100644 --- a/ci/style.rs +++ b/ci/style.rs @@ -115,7 +115,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { } } if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) { - err.error(path, i, "impl ::Copy and ::Clone manually"); + err.error(path, i, "impl Copy and Clone manually"); } if line.contains("impl") { in_impl = true; diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 5600488f88511..1d2bd948ce4df 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -2062,7 +2062,7 @@ pub const WEXITED: c_int = 0x00000004; pub const WCONTINUED: c_int = 0x00000008; pub const WNOWAIT: c_int = 0x01000000; -// ::Options set using PTRACE_SETOPTIONS. +// Options set using PTRACE_SETOPTIONS. pub const PTRACE_O_TRACESYSGOOD: c_int = 0x00000001; pub const PTRACE_O_TRACEFORK: c_int = 0x00000002; pub const PTRACE_O_TRACEVFORK: c_int = 0x00000004; diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index b04f69b09c0ac..a46587d111108 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -1109,7 +1109,7 @@ extern "C" { pub fn pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, - abstime: *const ::timespec, + abstime: *const timespec, ) -> c_int; pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index e82667ee7f688..090a1c2d1ad1d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -369,7 +369,7 @@ s! { pub si_status: c_int, pub si_addr: *mut c_void, //Requires it to be union for tests - //pub si_value: ::sigval, + //pub si_value: crate::sigval, _pad: [usize; 9], } diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index d43269607d29c..0eddbc0bea115 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -14,7 +14,7 @@ s! { pub struct mcontext_t { pub __gregs: __gregset, pub __fregs: __fpregset, - __spare: [::__greg_t; 7], + __spare: [crate::__greg_t; 7], } } @@ -26,7 +26,7 @@ s_no_extra_traits! { } } -pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/openbsd/arm.rs b/src/unix/bsd/netbsdlike/openbsd/arm.rs index 89603fba92853..e781fa7484ac1 100644 --- a/src/unix/bsd/netbsdlike/openbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/openbsd/arm.rs @@ -4,6 +4,6 @@ pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; -pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 6b705ffe7f159..2dc51bb4b9fe7 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -5,27 +5,27 @@ pub type wchar_t = i32; s! { pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, + pub sa_sigaction: crate::sighandler_t, + pub sa_mask: crate::sigset_t, pub sa_flags: c_int, pub sa_restorer: Option, } pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, + pub f_type: crate::__fsword_t, + pub f_bsize: crate::__fsword_t, + pub f_blocks: crate::fsblkcnt_t, + pub f_bfree: crate::fsblkcnt_t, + pub f_bavail: crate::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, + pub f_files: crate::fsfilcnt_t, + pub f_ffree: crate::fsfilcnt_t, + pub f_fsid: crate::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - f_spare: [::__fsword_t; 4], + pub f_namelen: crate::__fsword_t, + pub f_frsize: crate::__fsword_t, + pub f_flags: crate::__fsword_t, + f_spare: [crate::__fsword_t; 4], } pub struct flock { @@ -33,7 +33,7 @@ s! { pub l_whence: c_short, pub l_start: off_t, pub l_len: off_t, - pub l_pid: ::pid_t, + pub l_pid: crate::pid_t, } pub struct flock64 { @@ -41,16 +41,16 @@ s! { pub l_whence: c_short, pub l_start: off64_t, pub l_len: off64_t, - pub l_pid: ::pid_t, + pub l_pid: crate::pid_t, } pub struct ipc_perm { - __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, + __key: crate::key_t, + pub uid: crate::uid_t, + pub gid: crate::gid_t, + pub cuid: crate::uid_t, + pub cgid: crate::gid_t, + pub mode: crate::mode_t, __seq: c_ushort, __pad1: c_ushort, __glibc_reserved1: c_ulong, @@ -58,51 +58,51 @@ s! { } pub struct stat64 { - pub st_dev: ::dev_t, + pub st_dev: crate::dev_t, __pad1: c_ushort, - pub __st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, + pub __st_ino: crate::ino_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: crate::dev_t, __pad2: c_ushort, pub st_size: off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, + pub st_blksize: crate::blksize_t, + pub st_blocks: crate::blkcnt64_t, + pub st_atime: crate::time_t, pub st_atime_nsec: c_ulong, - pub st_mtime: ::time_t, + pub st_mtime: crate::time_t, pub st_mtime_nsec: c_ulong, - pub st_ctime: ::time_t, + pub st_ctime: crate::time_t, pub st_ctime_nsec: c_ulong, - pub st_ino: ::ino64_t, + pub st_ino: crate::ino64_t, } pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt64_t, - pub f_bfree: ::fsblkcnt64_t, - pub f_bavail: ::fsblkcnt64_t, - pub f_files: ::fsblkcnt64_t, - pub f_ffree: ::fsblkcnt64_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], + pub f_type: crate::__fsword_t, + pub f_bsize: crate::__fsword_t, + pub f_blocks: crate::fsblkcnt64_t, + pub f_bfree: crate::fsblkcnt64_t, + pub f_bavail: crate::fsblkcnt64_t, + pub f_files: crate::fsblkcnt64_t, + pub f_ffree: crate::fsblkcnt64_t, + pub f_fsid: crate::fsid_t, + pub f_namelen: crate::__fsword_t, + pub f_frsize: crate::__fsword_t, + pub f_flags: crate::__fsword_t, + pub f_spare: [crate::__fsword_t; 4], } pub struct statvfs64 { pub f_bsize: c_ulong, pub f_frsize: c_ulong, - pub f_blocks: ::fsblkcnt64_t, - pub f_bfree: ::fsblkcnt64_t, - pub f_bavail: ::fsblkcnt64_t, - pub f_files: ::fsblkcnt64_t, - pub f_ffree: ::fsblkcnt64_t, - pub f_favail: ::fsblkcnt64_t, + pub f_blocks: crate::fsblkcnt64_t, + pub f_bfree: crate::fsblkcnt64_t, + pub f_bavail: crate::fsblkcnt64_t, + pub f_files: crate::fsblkcnt64_t, + pub f_ffree: crate::fsblkcnt64_t, + pub f_favail: crate::fsblkcnt64_t, pub f_fsid: c_ulong, __f_unused: c_int, pub f_flag: c_ulong, @@ -111,34 +111,34 @@ s! { } pub struct shmid_ds { - pub shm_perm: ::ipc_perm, + pub shm_perm: crate::ipc_perm, pub shm_segsz: size_t, - pub shm_atime: ::time_t, + pub shm_atime: crate::time_t, __glibc_reserved1: c_long, - pub shm_dtime: ::time_t, + pub shm_dtime: crate::time_t, __glibc_reserved2: c_long, - pub shm_ctime: ::time_t, + pub shm_ctime: crate::time_t, __glibc_reserved3: c_long, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, + pub shm_cpid: crate::pid_t, + pub shm_lpid: crate::pid_t, + pub shm_nattch: crate::shmatt_t, __glibc_reserved5: c_ulong, __glibc_reserved6: c_ulong, } pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, + pub msg_perm: crate::ipc_perm, + pub msg_stime: crate::time_t, __glibc_reserved1: c_uint, - pub msg_rtime: ::time_t, + pub msg_rtime: crate::time_t, __glibc_reserved2: c_uint, - pub msg_ctime: ::time_t, + pub msg_ctime: crate::time_t, __glibc_reserved3: c_uint, __msg_cbytes: c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, + pub msg_qnum: crate::msgqnum_t, + pub msg_qbytes: crate::msglen_t, + pub msg_lspid: crate::pid_t, + pub msg_lrpid: crate::pid_t, __glibc_reserved4: c_ulong, __glibc_reserved5: c_ulong, } @@ -338,16 +338,16 @@ pub const SIGPROF: c_int = 27; pub const SIGWINCH: c_int = 28; pub const SIGSTKSZ: size_t = 8192; pub const MINSIGSTKSZ: size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::tcflag_t = 0x00000800; -pub const TAB2: ::tcflag_t = 0x00001000; -pub const TAB3: ::tcflag_t = 0x00001800; -pub const CR1: ::tcflag_t = 0x00000200; -pub const CR2: ::tcflag_t = 0x00000400; -pub const CR3: ::tcflag_t = 0x00000600; -pub const FF1: ::tcflag_t = 0x00008000; -pub const BS1: ::tcflag_t = 0x00002000; -pub const VT1: ::tcflag_t = 0x00004000; +pub const CBAUD: crate::tcflag_t = 0o0010017; +pub const TAB1: crate::tcflag_t = 0x00000800; +pub const TAB2: crate::tcflag_t = 0x00001000; +pub const TAB3: crate::tcflag_t = 0x00001800; +pub const CR1: crate::tcflag_t = 0x00000200; +pub const CR2: crate::tcflag_t = 0x00000400; +pub const CR3: crate::tcflag_t = 0x00000600; +pub const FF1: crate::tcflag_t = 0x00008000; +pub const BS1: crate::tcflag_t = 0x00002000; +pub const VT1: crate::tcflag_t = 0x00004000; pub const VWERASE: usize = 14; pub const VREPRINT: usize = 12; pub const VSUSP: usize = 10; @@ -355,82 +355,82 @@ pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VDISCARD: usize = 13; pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const IXON: crate::tcflag_t = 0x00000400; +pub const IXOFF: crate::tcflag_t = 0x00001000; +pub const ONLCR: crate::tcflag_t = 0x4; +pub const CSIZE: crate::tcflag_t = 0x00000030; +pub const CS6: crate::tcflag_t = 0x00000010; +pub const CS7: crate::tcflag_t = 0x00000020; +pub const CS8: crate::tcflag_t = 0x00000030; +pub const CSTOPB: crate::tcflag_t = 0x00000040; +pub const CREAD: crate::tcflag_t = 0x00000080; +pub const PARENB: crate::tcflag_t = 0x00000100; +pub const PARODD: crate::tcflag_t = 0x00000200; +pub const HUPCL: crate::tcflag_t = 0x00000400; +pub const CLOCAL: crate::tcflag_t = 0x00000800; +pub const ECHOKE: crate::tcflag_t = 0x00000800; +pub const ECHOE: crate::tcflag_t = 0x00000010; +pub const ECHOK: crate::tcflag_t = 0x00000020; +pub const ECHONL: crate::tcflag_t = 0x00000040; +pub const ECHOPRT: crate::tcflag_t = 0x00000400; +pub const ECHOCTL: crate::tcflag_t = 0x00000200; +pub const ISIG: crate::tcflag_t = 0x00000001; +pub const ICANON: crate::tcflag_t = 0x00000002; +pub const PENDIN: crate::tcflag_t = 0x00004000; +pub const NOFLSH: crate::tcflag_t = 0x00000080; +pub const CIBAUD: crate::tcflag_t = 0o02003600000; +pub const CBAUDEX: crate::tcflag_t = 0o010000; pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; +pub const OLCUC: crate::tcflag_t = 0o000002; +pub const NLDLY: crate::tcflag_t = 0o000400; +pub const CRDLY: crate::tcflag_t = 0o003000; +pub const TABDLY: crate::tcflag_t = 0o014000; +pub const BSDLY: crate::tcflag_t = 0o020000; +pub const FFDLY: crate::tcflag_t = 0o100000; +pub const VTDLY: crate::tcflag_t = 0o040000; +pub const XTABS: crate::tcflag_t = 0o014000; -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; +pub const B0: crate::speed_t = 0o000000; +pub const B50: crate::speed_t = 0o000001; +pub const B75: crate::speed_t = 0o000002; +pub const B110: crate::speed_t = 0o000003; +pub const B134: crate::speed_t = 0o000004; +pub const B150: crate::speed_t = 0o000005; +pub const B200: crate::speed_t = 0o000006; +pub const B300: crate::speed_t = 0o000007; +pub const B600: crate::speed_t = 0o000010; +pub const B1200: crate::speed_t = 0o000011; +pub const B1800: crate::speed_t = 0o000012; +pub const B2400: crate::speed_t = 0o000013; +pub const B4800: crate::speed_t = 0o000014; +pub const B9600: crate::speed_t = 0o000015; +pub const B19200: crate::speed_t = 0o000016; +pub const B38400: crate::speed_t = 0o000017; +pub const EXTA: crate::speed_t = B19200; +pub const EXTB: crate::speed_t = B38400; +pub const B57600: crate::speed_t = 0o010001; +pub const B115200: crate::speed_t = 0o010002; +pub const B230400: crate::speed_t = 0o010003; +pub const B460800: crate::speed_t = 0o010004; +pub const B500000: crate::speed_t = 0o010005; +pub const B576000: crate::speed_t = 0o010006; +pub const B921600: crate::speed_t = 0o010007; +pub const B1000000: crate::speed_t = 0o010010; +pub const B1152000: crate::speed_t = 0o010011; +pub const B1500000: crate::speed_t = 0o010012; +pub const B2000000: crate::speed_t = 0o010013; +pub const B2500000: crate::speed_t = 0o010014; +pub const B3000000: crate::speed_t = 0o010015; +pub const B3500000: crate::speed_t = 0o010016; +pub const B4000000: crate::speed_t = 0o010017; pub const VEOL: usize = 11; pub const VEOL2: usize = 16; pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const IEXTEN: crate::tcflag_t = 0x00008000; +pub const TOSTOP: crate::tcflag_t = 0x00000100; +pub const FLUSHO: crate::tcflag_t = 0x00001000; +pub const EXTPROC: crate::tcflag_t = 0x00010000; pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 8305ccdf25a53..5e4d3f0a2837e 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -276,21 +276,21 @@ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthrea ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs index 2d256cd8a13db..19e28e91f5b33 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs @@ -46,21 +46,21 @@ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthrea ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], }; #[cfg(target_endian = "big")] -pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mutex_t { +pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: crate::pthread_mutex_t = pthread_mutex_t { size: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 889fc9980a94f..43b9d725ecb3a 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -4241,11 +4241,11 @@ pub const IW_PMKID_CAND_PREAUTH: c_ulong = 0x00000001; pub const IW_EV_LCP_PK_LEN: usize = 4; -pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + ::IFNAMSIZ; +pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + crate::IFNAMSIZ; pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::(); pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::(); pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::(); -pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + size_of::<::sockaddr>(); +pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + size_of::(); pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::(); pub const IW_EV_POINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + 4; diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 68cdc45de4df6..46de7219dbf8b 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -109,14 +109,14 @@ s_no_extra_traits! { } } -//pub const RLIM_INFINITY: ::rlim_t = !0; +//pub const RLIM_INFINITY: crate::rlim_t = !0; pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: c_int = 0x8; -//pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -//pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -//pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; -//pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; -//pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; +//pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5; +//pub const RLIMIT_AS: crate::__rlimit_resource_t = 9; +//pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8; +//pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 7; +//pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 6; pub const O_APPEND: c_int = 1024; pub const O_CREAT: c_int = 64; pub const O_EXCL: c_int = 128; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs index de46957301023..4000ab147504c 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs @@ -18,47 +18,47 @@ s! { pub struct stat { pub st_dev: c_ulong, st_pad1: [c_long; 2], - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, + pub st_ino: crate::ino_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, pub st_rdev: c_ulong, st_pad2: [c_ulong; 1], pub st_size: off_t, st_pad3: c_long, - pub st_atime: ::time_t, + pub st_atime: crate::time_t, pub st_atime_nsec: c_long, - pub st_mtime: ::time_t, + pub st_mtime: crate::time_t, pub st_mtime_nsec: c_long, - pub st_ctime: ::time_t, + pub st_ctime: crate::time_t, pub st_ctime_nsec: c_long, - pub st_blksize: ::blksize_t, + pub st_blksize: crate::blksize_t, st_pad4: c_long, - pub st_blocks: ::blkcnt_t, + pub st_blocks: crate::blkcnt_t, st_pad5: [c_long; 7], } pub struct stat64 { pub st_dev: c_ulong, st_pad1: [c_long; 2], - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, + pub st_ino: crate::ino64_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, pub st_rdev: c_ulong, st_pad2: [c_long; 2], pub st_size: off64_t, - pub st_atime: ::time_t, + pub st_atime: crate::time_t, pub st_atime_nsec: c_long, - pub st_mtime: ::time_t, + pub st_mtime: crate::time_t, pub st_mtime_nsec: c_long, - pub st_ctime: ::time_t, + pub st_ctime: crate::time_t, pub st_ctime_nsec: c_long, - pub st_blksize: ::blksize_t, + pub st_blksize: crate::blksize_t, st_pad3: c_long, - pub st_blocks: ::blkcnt64_t, + pub st_blocks: crate::blkcnt64_t, st_pad5: [c_long; 7], } @@ -68,7 +68,7 @@ s! { pub struct sigaction { pub sa_flags: c_int, - pub sa_sigaction: ::sighandler_t, + pub sa_sigaction: crate::sighandler_t, pub sa_mask: sigset_t, _restorer: *mut c_void, } @@ -92,11 +92,11 @@ s! { } pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, + pub __key: crate::key_t, + pub uid: crate::uid_t, + pub gid: crate::gid_t, + pub cuid: crate::uid_t, + pub cgid: crate::gid_t, pub mode: c_uint, pub __seq: c_ushort, __pad1: c_ushort, @@ -105,28 +105,28 @@ s! { } pub struct shmid_ds { - pub shm_perm: ::ipc_perm, + pub shm_perm: crate::ipc_perm, pub shm_segsz: size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, + pub shm_atime: crate::time_t, + pub shm_dtime: crate::time_t, + pub shm_ctime: crate::time_t, + pub shm_cpid: crate::pid_t, + pub shm_lpid: crate::pid_t, + pub shm_nattch: crate::shmatt_t, __unused4: c_ulong, __unused5: c_ulong, } pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - pub msg_rtime: ::time_t, - pub msg_ctime: ::time_t, + pub msg_perm: crate::ipc_perm, + pub msg_stime: crate::time_t, + pub msg_rtime: crate::time_t, + pub msg_ctime: crate::time_t, __msg_cbytes: c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, + pub msg_qnum: crate::msgqnum_t, + pub msg_qbytes: crate::msglen_t, + pub msg_lspid: crate::pid_t, + pub msg_lrpid: crate::pid_t, __glibc_reserved4: c_ulong, __glibc_reserved5: c_ulong, } @@ -135,12 +135,12 @@ s! { pub f_type: c_long, pub f_bsize: c_long, pub f_frsize: c_long, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsblkcnt_t, - pub f_ffree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, + pub f_blocks: crate::fsblkcnt_t, + pub f_bfree: crate::fsblkcnt_t, + pub f_files: crate::fsblkcnt_t, + pub f_ffree: crate::fsblkcnt_t, + pub f_bavail: crate::fsblkcnt_t, + pub f_fsid: crate::fsid_t, pub f_namelen: c_long, f_spare: [c_long; 6], @@ -148,8 +148,8 @@ s! { pub struct msghdr { pub msg_name: *mut c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, + pub msg_namelen: crate::socklen_t, + pub msg_iov: *mut crate::iovec, pub msg_iovlen: size_t, pub msg_control: *mut c_void, pub msg_controllen: size_t, @@ -163,12 +163,12 @@ s! { } pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], + pub c_iflag: crate::tcflag_t, + pub c_oflag: crate::tcflag_t, + pub c_cflag: crate::tcflag_t, + pub c_lflag: crate::tcflag_t, + pub c_line: crate::cc_t, + pub c_cc: [crate::cc_t; crate::NCCS], } pub struct sysinfo { diff --git a/src/unix/newlib/aarch64/mod.rs b/src/unix/newlib/aarch64/mod.rs index 7efbdf780db3f..87952650e5d12 100644 --- a/src/unix/newlib/aarch64/mod.rs +++ b/src/unix/newlib/aarch64/mod.rs @@ -10,24 +10,24 @@ pub type c_ulong = u64; s! { pub struct sockaddr { pub sa_len: u8, - pub sa_family: ::sa_family_t, + pub sa_family: crate::sa_family_t, pub sa_data: [c_char; 14], } pub struct sockaddr_in6 { pub sin6_len: u8, - pub sin6_family: ::sa_family_t, - pub sin6_port: ::in_port_t, + pub sin6_family: crate::sa_family_t, + pub sin6_port: crate::in_port_t, pub sin6_flowinfo: u32, - pub sin6_addr: ::in6_addr, + pub sin6_addr: crate::in6_addr, pub sin6_scope_id: u32, } pub struct sockaddr_in { pub sin_len: u8, - pub sin_family: ::sa_family_t, - pub sin_port: ::in_port_t, - pub sin_addr: ::in_addr, + pub sin_family: crate::sa_family_t, + pub sin_port: crate::in_port_t, + pub sin_addr: crate::in_addr, pub sin_zero: [c_char; 8], } } diff --git a/src/unix/nto/neutrino.rs b/src/unix/nto/neutrino.rs index 3e2bee367acd3..8d559015ac8cb 100644 --- a/src/unix/nto/neutrino.rs +++ b/src/unix/nto/neutrino.rs @@ -83,7 +83,7 @@ s! { // of Neutrino 7.1 SDP. Commented out for now. //pub struct _asyncmsg_put_header { // pub err: c_int, - // pub iov: *mut ::iov_t, + // pub iov: *mut crate::iov_t, // pub parts: c_int, // pub handle: c_uint, // pub cb: Option< @@ -105,7 +105,7 @@ s! { // pub buffer_size: size_t, // pub max_num_buffer: c_uint, // pub trigger_num_msg: c_uint, - // pub trigger_time: ::_itimer, + // pub trigger_time: crate::_itimer, // reserve: c_uint, //} @@ -116,15 +116,15 @@ s! { // pub sendq_tail: c_uint, // pub sendq_free: c_uint, // pub err: c_int, - // pub ev: ::sigevent, + // pub ev: crate::sigevent, // pub num_curmsg: c_uint, - // pub ttimer: ::timer_t, - // pub block_con: ::pthread_cond_t, - // pub mu: ::pthread_mutex_t, + // pub ttimer: crate::timer_t, + // pub block_con: crate::pthread_cond_t, + // pub mu: crate::pthread_mutex_t, // reserved: c_uint, - // pub attr: ::_asyncmsg_connection_attr, + // pub attr: crate::_asyncmsg_connection_attr, // pub reserves: [c_uint; 3], - // pub sendq: [::_asyncmsg_put_header; 1], // flexarray + // pub sendq: [crate::_asyncmsg_put_header; 1], // flexarray //} pub struct __c_anonymous_struct_ev { @@ -543,7 +543,7 @@ extern "C" { // standard installation of Neutrino 7.1 SDP. Commented out for now. //pub fn ConnectAttachExt( // __nd: u32, - // __pid: ::pid_t, + // __pid: crate::pid_t, // __chid: c_int, // __index: c_uint, // __flags: c_int, @@ -1262,7 +1262,7 @@ extern "C" { //pub fn InterruptDisable(); pub fn InterruptMask(__intr: c_int, __id: c_int) -> c_int; pub fn InterruptUnmask(__intr: c_int, __id: c_int) -> c_int; - //pub fn InterruptLock(__spin: *mut ::intrspin); - //pub fn InterruptUnlock(__spin: *mut ::intrspin); + //pub fn InterruptLock(__spin: *mut intrspin); + //pub fn InterruptUnlock(__spin: *mut intrspin); //pub fn InterruptStatus() -> c_uint; } diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 890b47a68a45f..1d2738a45cd49 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -85,7 +85,7 @@ s_no_extra_traits! { pub struct sockaddr_storage { pub ss_family: crate::sa_family_t, __ss_padding: - [u8; 128 - ::core::mem::size_of::() - ::core::mem::size_of::()], + [u8; 128 - crate::mem::size_of::() - crate::mem::size_of::()], __ss_align: c_ulong, } } diff --git a/src/unix/solarish/x86.rs b/src/unix/solarish/x86.rs index c161169547286..db449b1e86690 100644 --- a/src/unix/solarish/x86.rs +++ b/src/unix/solarish/x86.rs @@ -10,21 +10,21 @@ pub type Elf32_Phdr = __c_anonymous_Elf32_Phdr; s! { pub struct __c_anonymous_Elf32_Phdr { - pub p_type: ::Elf32_Word, - pub p_offset: ::Elf32_Off, - pub p_vaddr: ::Elf32_Addr, - pub p_paddr: ::Elf32_Addr, - pub p_filesz: ::Elf32_Word, - pub p_memsz: ::Elf32_Word, - pub p_flags: ::Elf32_Word, - pub p_align: ::Elf32_Word, + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, } pub struct dl_phdr_info { - pub dlpi_addr: ::Elf32_Addr, + pub dlpi_addr: Elf32_Addr, pub dlpi_name: *const c_char, - pub dlpi_phdr: *const ::Elf32_Phdr, - pub dlpi_phnum: ::Elf32_Half, + pub dlpi_phdr: *const Elf32_Phdr, + pub dlpi_phnum: Elf32_Half, pub dlpi_adds: c_ulonglong, pub dlpi_subs: c_ulonglong, } From 0c7b004860a1343ec8f3fe34a1e738ae1400cde0 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 25 Nov 2024 19:57:35 +0000 Subject: [PATCH 5/9] solarish update stat type with st_fstype field. (backport ) (cherry picked from commit bd5a0d30a090ed6d387dadc9e922e62d581dd79e) --- libc-test/semver/solarish.txt | 1 + src/unix/solarish/mod.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index f70409ed8ae88..9d0ae3ac18b5d 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -17,6 +17,7 @@ LIO_WRITE PIPE_BUF SIGEV_PORT _POSIX_VDISABLE +_ST_FSTYPSZ aio_cancel aio_error aio_fsync diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index ae24e6e308419..981c697e923f3 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -344,7 +344,7 @@ s! { pub st_ctime_nsec: c_long, pub st_blksize: crate::blksize_t, pub st_blocks: crate::blkcnt_t, - __unused: [c_char; 16], + pub st_fstype: [c_char; _ST_FSTYPSZ as usize], } pub struct termios { @@ -2029,6 +2029,8 @@ pub const _SC_XOPEN_STREAMS: c_int = 761; pub const _SC_IPV6: c_int = 762; pub const _SC_RAW_SOCKETS: c_int = 763; +pub const _ST_FSTYPSZ: c_int = 16; + pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX pub const _COND_MAGIC: u16 = 0x4356; // CV pub const _RWL_MAGIC: u16 = 0x5257; // RW From 1abd74b07a1d97373d416f5a6778c5eb9a0835af Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 17:13:45 -0500 Subject: [PATCH 6/9] trusty: Add `intptr_t` and `uintptr_t` Other platforms export these types, so update Trusty to do so as well. (backport ) (cherry picked from commit 6bee30ed7998fc6b700b8f4e879b6999bb75df42) --- src/trusty.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/trusty.rs b/src/trusty.rs index 3155fd23e6a3a..2d2b78881a75f 100644 --- a/src/trusty.rs +++ b/src/trusty.rs @@ -43,6 +43,9 @@ pub type c_int16_t = i16; pub type c_int32_t = i32; pub type c_int64_t = i64; +pub type intptr_t = isize; +pub type uintptr_t = usize; + pub type c_float = f32; pub type c_double = f64; From 877b6f6ebb9626a6469e725f065f84e22962b3b5 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 04:20:12 -0500 Subject: [PATCH 7/9] Create an internal prelude When building with `rustc-dep-of-std`, we don't get the core types imported by default (`Clone`, `Copy`, `Option`). In order to avoid needing to import these individually, introduce a prelude that includes them, along with commonly used C numeric types. This allows cleaning up some of the `use` statements. (backport ) (cherry picked from commit 30bc78b2ccc2d620cdd1f2ac16be083eff6dcabc) --- src/lib.rs | 51 ++++++++++++++++++++++++++------------------------- src/macros.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f95e9ba6afd3e..1be0a003382d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,35 +33,10 @@ mod macros; cfg_if! { if #[cfg(feature = "rustc-dep-of-std")] { extern crate rustc_std_workspace_core as core; - #[allow(unused_imports)] - use core::iter; - #[allow(unused_imports)] - use core::ops; - #[allow(unused_imports)] - use core::option; } } -#[doc(hidden)] -#[allow(unused_imports)] -use core::clone::Clone; -#[allow(unused_imports)] -use core::ffi; pub use core::ffi::c_void; -#[allow(unused_imports)] -use core::fmt; -#[allow(unused_imports)] -use core::hash; -#[doc(hidden)] -#[allow(unused_imports)] -use core::marker::{Copy, Send, Sync}; -#[allow(unused_imports)] -use core::mem; -#[allow(unused_imports)] -use core::num; -#[doc(hidden)] -#[allow(unused_imports)] -use core::option::Option; cfg_if! { if #[cfg(windows)] { @@ -70,78 +45,104 @@ cfg_if! { mod windows; pub use crate::windows::*; + + prelude!(); } else if #[cfg(target_os = "fuchsia")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod fuchsia; pub use crate::fuchsia::*; + + prelude!(); } else if #[cfg(target_os = "switch")] { mod fixed_width_ints; pub use fixed_width_ints::*; mod switch; pub use switch::*; + + prelude!(); } else if #[cfg(target_os = "psp")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod psp; pub use crate::psp::*; + + prelude!(); } else if #[cfg(target_os = "vxworks")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod vxworks; pub use crate::vxworks::*; + + prelude!(); } else if #[cfg(target_os = "solid_asp3")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod solid; pub use crate::solid::*; + + prelude!(); } else if #[cfg(unix)] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod unix; pub use crate::unix::*; + + prelude!(); } else if #[cfg(target_os = "hermit")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod hermit; pub use crate::hermit::*; + + prelude!(); } else if #[cfg(target_os = "teeos")] { mod fixed_width_ints; pub use fixed_width_ints::*; mod teeos; pub use teeos::*; + + prelude!(); } else if #[cfg(target_os = "trusty")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod trusty; pub use crate::trusty::*; + + prelude!(); } else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod sgx; pub use crate::sgx::*; + + prelude!(); } else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod wasi; pub use crate::wasi::*; + + prelude!(); } else if #[cfg(target_os = "xous")] { mod fixed_width_ints; pub use crate::fixed_width_ints::*; mod xous; pub use crate::xous::*; + + prelude!(); } else { // non-supported targets: empty... } diff --git a/src/macros.rs b/src/macros.rs index 354f42a568806..2ea084398da41 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -61,6 +61,33 @@ macro_rules! cfg_if { }; } +/// Create an internal crate prelude with `core` reexports and common types. +macro_rules! prelude { + () => { + /// Frequently-used types that are available on all platforms + /// + /// We need to reexport the core types so this works with `rust-dep-of-std`. + mod prelude { + // Exports from `core` + #[allow(unused_imports)] + pub(crate) use core::clone::Clone; + #[allow(unused_imports)] + pub(crate) use core::marker::{Copy, Send, Sync}; + #[allow(unused_imports)] + pub(crate) use core::option::Option; + #[allow(unused_imports)] + pub(crate) use core::{fmt, hash, iter, mem}; + + // Commonly used types defined in this crate + #[allow(unused_imports)] + pub(crate) use crate::{ + c_char, c_double, c_float, c_int, c_long, c_longlong, c_short, c_uchar, c_uint, + c_ulong, c_ulonglong, c_ushort, c_void, intptr_t, size_t, ssize_t, uintptr_t, + }; + } + }; +} + /// Implement `Clone` and `Copy` for a struct, as well as `Debug`, `Eq`, `Hash`, and /// `PartialEq` if the `extra_traits` feature is enabled. /// From 108310db03e7db35ef48a902d9ce9a88ab8f9b77 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 17:48:51 -0500 Subject: [PATCH 8/9] Make use of the crate's prelude to replace individual imports Automatically apply changes with the following: #!/bin/bash set -eux files=() # Types either defined in this crate or in `core` prelude_types=( c_char c_double c_float c_int c_longlong c_long c_short c_uchar c_uint c_ulonglong c_ulong c_ushort c_void intptr_t size_t ssize_t Clone Copy Option Send Sync ) # Reexports from core prelude_modules=( fmt hash iter mem ) # Everything in the prelude prelude=( "${prelude_types[@]}" "${prelude_modules[@]}" ) # Generate a list of all files excluding `lib.rs` (since the prelude being # defined there makes string matching weird). while IFS= read -r -d '' file; do files+=("$file") done < <(find src -name '*.rs' -not -name '*lib.rs' -not -name '*macros.rs' -not -name 'fixed_width_ints.rs' -print0) for file in "${files[@]}"; do needs_prelude=0 # If the file already has some sort of glob import, skip it if rg --pcre2 -q 'use (crate|super)::(?!prelude).*\*' "$file"; then continue fi # Core types always require the prelude to handle rustc-dep-of-std if rg --pcre2 -q '\b(? "$file" printf "\n%s\n\n" "use crate::prelude::*;" >> "$file" printf "%s" "$rest" >> "$file" fi for ty in "${prelude[@]}"; do export TY="$ty" # env for perl to use # Remove simple imports `use crate::ty;` perl -pi -0777 -e 's/use ((crate|super)::)?($ENV{TY});//g' "$file" # Remove the type if it is part of a group import perl -pi -0777 -e 's/(use (crate|super)::\{?(.*|(\n.*){0,2}))\b$ENV{TY}\b,? ?/$1/g' "$file" # Replace pathed `crate::ty` perl -pi -0777 -e 's/(crate|super)::($ENV{TY})\b/$2/g' "$file" done # For some reason, rustfmt doesn't trim leading newlines. Do so manually here. perl -pi -0777 -e 's/\A\n+//' "$file" rustfmt "$file" done ./ci/style.sh (backport ) (cherry picked from commit f8a018a8e3efaf8cc4fbad84974255b0fa899fc2) Applied by rerunning the script rather than resolving conflicts manually. --- src/fuchsia/aarch64.rs | 3 +- src/fuchsia/mod.rs | 126 +++---- src/fuchsia/riscv64.rs | 3 +- src/fuchsia/x86_64.rs | 11 +- src/hermit.rs | 2 +- src/psp.rs | 2 +- src/solid/mod.rs | 2 +- src/teeos/mod.rs | 2 +- src/unix/aix/mod.rs | 53 ++- src/unix/aix/powerpc64.rs | 70 ++-- src/unix/bsd/apple/b32/mod.rs | 18 +- src/unix/bsd/apple/b64/aarch64/mod.rs | 2 +- src/unix/bsd/apple/b64/mod.rs | 18 +- src/unix/bsd/apple/b64/x86_64/mod.rs | 2 +- src/unix/bsd/apple/mod.rs | 348 +++++++++--------- src/unix/bsd/freebsdlike/dragonfly/errno.rs | 2 +- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 73 ++-- src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 28 +- src/unix/bsd/freebsdlike/freebsd/arm.rs | 12 +- .../bsd/freebsdlike/freebsd/freebsd11/b32.rs | 3 +- .../bsd/freebsdlike/freebsd/freebsd11/b64.rs | 3 +- .../bsd/freebsdlike/freebsd/freebsd11/mod.rs | 26 +- .../bsd/freebsdlike/freebsd/freebsd12/mod.rs | 30 +- .../freebsdlike/freebsd/freebsd12/x86_64.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd13/mod.rs | 30 +- .../freebsdlike/freebsd/freebsd13/x86_64.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd14/mod.rs | 30 +- .../freebsdlike/freebsd/freebsd14/x86_64.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd15/mod.rs | 30 +- .../freebsdlike/freebsd/freebsd15/x86_64.rs | 2 +- src/unix/bsd/freebsdlike/freebsd/mod.rs | 282 +++++++------- src/unix/bsd/freebsdlike/freebsd/powerpc.rs | 12 +- src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 12 +- src/unix/bsd/freebsdlike/freebsd/riscv64.rs | 28 +- src/unix/bsd/freebsdlike/freebsd/x86.rs | 12 +- .../bsd/freebsdlike/freebsd/x86_64/mod.rs | 44 +-- src/unix/bsd/freebsdlike/mod.rs | 16 +- src/unix/bsd/mod.rs | 26 +- src/unix/bsd/netbsdlike/mod.rs | 3 +- src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 13 +- src/unix/bsd/netbsdlike/netbsd/arm.rs | 5 +- src/unix/bsd/netbsdlike/netbsd/mips.rs | 5 +- src/unix/bsd/netbsdlike/netbsd/mod.rs | 123 +++---- src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 5 +- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 4 +- src/unix/bsd/netbsdlike/netbsd/sparc64.rs | 2 +- src/unix/bsd/netbsdlike/netbsd/x86.rs | 4 +- src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 5 +- src/unix/bsd/netbsdlike/openbsd/aarch64.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/arm.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/mod.rs | 82 ++--- src/unix/bsd/netbsdlike/openbsd/powerpc.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/powerpc64.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/riscv64.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/x86.rs | 4 +- src/unix/bsd/netbsdlike/openbsd/x86_64.rs | 13 +- src/unix/haiku/mod.rs | 62 ++-- src/unix/haiku/native.rs | 15 +- src/unix/haiku/x86_64.rs | 42 +-- src/unix/hurd/b32.rs | 2 +- src/unix/hurd/b64.rs | 2 +- src/unix/hurd/mod.rs | 44 ++- src/unix/linux_like/android/b32/arm.rs | 26 +- src/unix/linux_like/android/b32/mod.rs | 6 +- src/unix/linux_like/android/b32/x86/mod.rs | 26 +- .../linux_like/android/b64/aarch64/mod.rs | 3 +- src/unix/linux_like/android/b64/mod.rs | 30 +- .../linux_like/android/b64/riscv64/mod.rs | 3 +- src/unix/linux_like/android/b64/x86_64/mod.rs | 51 +-- src/unix/linux_like/android/mod.rs | 118 +++--- src/unix/linux_like/emscripten/lfs64.rs | 3 +- src/unix/linux_like/emscripten/mod.rs | 42 +-- src/unix/linux_like/linux/arch/generic/mod.rs | 7 +- src/unix/linux_like/linux/arch/mips/mod.rs | 3 +- src/unix/linux_like/linux/arch/powerpc/mod.rs | 3 +- src/unix/linux_like/linux/arch/sparc/mod.rs | 3 +- src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 11 +- src/unix/linux_like/linux/gnu/b32/csky/mod.rs | 3 +- src/unix/linux_like/linux/gnu/b32/m68k/mod.rs | 3 +- src/unix/linux_like/linux/gnu/b32/mips/mod.rs | 3 +- src/unix/linux_like/linux/gnu/b32/mod.rs | 7 +- src/unix/linux_like/linux/gnu/b32/powerpc.rs | 3 +- .../linux_like/linux/gnu/b32/riscv32/mod.rs | 5 +- .../linux_like/linux/gnu/b32/sparc/mod.rs | 5 +- src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 19 +- .../linux_like/linux/gnu/b64/aarch64/mod.rs | 5 +- .../linux/gnu/b64/loongarch64/mod.rs | 6 +- .../linux_like/linux/gnu/b64/mips64/mod.rs | 3 +- src/unix/linux_like/linux/gnu/b64/mod.rs | 4 +- .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 3 +- .../linux_like/linux/gnu/b64/riscv64/mod.rs | 5 +- src/unix/linux_like/linux/gnu/b64/s390x.rs | 15 +- .../linux_like/linux/gnu/b64/sparc64/mod.rs | 6 +- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 21 +- .../linux/gnu/b64/x86_64/not_x32.rs | 3 +- .../linux_like/linux/gnu/b64/x86_64/x32.rs | 3 +- src/unix/linux_like/linux/gnu/mod.rs | 21 +- src/unix/linux_like/linux/mod.rs | 164 ++++----- src/unix/linux_like/linux/musl/b32/arm/mod.rs | 11 +- src/unix/linux_like/linux/musl/b32/hexagon.rs | 2 +- .../linux_like/linux/musl/b32/mips/mod.rs | 3 +- src/unix/linux_like/linux/musl/b32/mod.rs | 2 +- src/unix/linux_like/linux/musl/b32/powerpc.rs | 3 +- .../linux_like/linux/musl/b32/riscv32/mod.rs | 3 +- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 19 +- .../linux_like/linux/musl/b64/aarch64/mod.rs | 5 +- .../linux/musl/b64/loongarch64/mod.rs | 6 +- src/unix/linux_like/linux/musl/b64/mips64.rs | 3 +- src/unix/linux_like/linux/musl/b64/mod.rs | 2 +- .../linux_like/linux/musl/b64/powerpc64.rs | 3 +- .../linux_like/linux/musl/b64/riscv64/mod.rs | 6 +- src/unix/linux_like/linux/musl/b64/s390x.rs | 13 +- .../linux_like/linux/musl/b64/x86_64/mod.rs | 21 +- src/unix/linux_like/linux/musl/lfs64.rs | 3 +- src/unix/linux_like/linux/musl/mod.rs | 21 +- src/unix/linux_like/linux/uclibc/arm/mod.rs | 3 +- .../linux/uclibc/mips/mips32/mod.rs | 3 +- .../linux/uclibc/mips/mips64/mod.rs | 3 +- src/unix/linux_like/linux/uclibc/mips/mod.rs | 2 +- src/unix/linux_like/linux/uclibc/mod.rs | 3 +- .../linux_like/linux/uclibc/x86_64/l4re.rs | 2 +- .../linux_like/linux/uclibc/x86_64/mod.rs | 3 +- .../linux_like/linux/uclibc/x86_64/other.rs | 2 +- src/unix/linux_like/mod.rs | 58 +-- src/unix/mod.rs | 2 +- src/unix/newlib/aarch64/mod.rs | 2 +- src/unix/newlib/arm/mod.rs | 2 +- src/unix/newlib/espidf/mod.rs | 2 +- src/unix/newlib/generic.rs | 5 +- src/unix/newlib/horizon/mod.rs | 5 +- src/unix/newlib/mod.rs | 14 +- src/unix/newlib/powerpc/mod.rs | 2 +- src/unix/newlib/rtems/mod.rs | 3 +- src/unix/newlib/vita/mod.rs | 3 +- src/unix/nto/aarch64.rs | 2 +- src/unix/nto/mod.rs | 118 +++--- src/unix/nto/neutrino.rs | 2 +- src/unix/nto/x86_64.rs | 10 +- src/unix/nuttx/mod.rs | 3 +- src/unix/redox/mod.rs | 45 ++- src/unix/solarish/illumos.rs | 20 +- src/unix/solarish/mod.rs | 84 +++-- src/unix/solarish/solaris.rs | 14 +- src/unix/solarish/x86.rs | 2 +- src/unix/solarish/x86_64.rs | 18 +- src/vxworks/mod.rs | 44 +-- src/wasi/mod.rs | 3 +- src/wasi/p2.rs | 2 +- src/windows/gnu/mod.rs | 2 +- src/windows/mod.rs | 2 +- src/windows/msvc/mod.rs | 2 +- 151 files changed, 1537 insertions(+), 1547 deletions(-) diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index ddcd9d3f5631e..b822375100948 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_uint, c_ulong, c_ulonglong, c_ushort, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type __u64 = c_ulonglong; diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 1d2bd948ce4df..82a0676bfbea3 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3,7 +3,7 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -use crate::c_void; +use crate::prelude::*; // PUB_TYPE @@ -1073,8 +1073,8 @@ cfg_if! { } } impl Eq for sysinfo {} - impl crate::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sysinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sysinfo") .field("uptime", &self.uptime) .field("loads", &self.loads) @@ -1093,8 +1093,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { + impl hash::Hash for sysinfo { + fn hash(&self, state: &mut H) { self.uptime.hash(state); self.loads.hash(state); self.totalram.hash(state); @@ -1123,16 +1123,16 @@ cfg_if! { } } impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_family", &self.sun_family) // FIXME: .field("sun_path", &self.sun_path) .finish() } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_family.hash(state); self.sun_path.hash(state); } @@ -1150,8 +1150,8 @@ cfg_if! { } } impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_family", &self.ss_family) .field("__ss_align", &self.__ss_align) @@ -1159,8 +1159,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_family.hash(state); self.__ss_align.hash(state); self.__ss_pad2.hash(state); @@ -1196,8 +1196,8 @@ cfg_if! { } } impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -1207,8 +1207,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); @@ -1231,8 +1231,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -1242,8 +1242,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -1266,8 +1266,8 @@ cfg_if! { } } impl Eq for dirent64 {} - impl crate::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent64") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -1277,8 +1277,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -1296,8 +1296,8 @@ cfg_if! { } } impl Eq for mq_attr {} - impl crate::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mq_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mq_attr") .field("mq_flags", &self.mq_flags) .field("mq_maxmsg", &self.mq_maxmsg) @@ -1306,8 +1306,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { self.mq_flags.hash(state); self.mq_maxmsg.hash(state); self.mq_msgsize.hash(state); @@ -1323,8 +1323,8 @@ cfg_if! { } } impl Eq for sockaddr_nl {} - impl crate::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_nl") .field("nl_family", &self.nl_family) .field("nl_pid", &self.nl_pid) @@ -1332,8 +1332,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { self.nl_family.hash(state); self.nl_pid.hash(state); self.nl_groups.hash(state); @@ -1350,8 +1350,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_value", &self.sigev_value) .field("sigev_signo", &self.sigev_signo) @@ -1361,8 +1361,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_value.hash(state); self.sigev_signo.hash(state); self.sigev_notify.hash(state); @@ -1377,15 +1377,15 @@ cfg_if! { } } impl Eq for pthread_cond_t {} - impl crate::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1396,15 +1396,15 @@ cfg_if! { } } impl Eq for pthread_mutex_t {} - impl crate::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_mutex_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1415,15 +1415,15 @@ cfg_if! { } } impl Eq for pthread_rwlock_t {} - impl crate::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -3372,20 +3372,20 @@ cfg_if! { f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } @@ -3403,21 +3403,21 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } @@ -3445,9 +3445,9 @@ f! { } pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as size_t) < crate::mem::size_of::() { + if ((*cmsg).cmsg_len as size_t) < mem::size_of::() { 0 as *mut cmsghdr - } else if __CMSG_NEXT(cmsg).add(crate::mem::size_of::()) >= __MHDR_END(mhdr) { + } else if __CMSG_NEXT(cmsg).add(mem::size_of::()) >= __MHDR_END(mhdr) { 0 as *mut cmsghdr } else { __CMSG_NEXT(cmsg).cast() @@ -3455,7 +3455,7 @@ f! { } pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as size_t >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as size_t >= mem::size_of::() { (*mhdr).msg_control.cast() } else { 0 as *mut cmsghdr @@ -3463,15 +3463,15 @@ f! { } pub {const} fn CMSG_ALIGN(len: size_t) -> size_t { - (len + crate::mem::size_of::() - 1) & !(crate::mem::size_of::() - 1) + (len + mem::size_of::() - 1) & !(mem::size_of::() - 1) } pub {const} fn CMSG_SPACE(len: c_uint) -> c_uint { - (CMSG_ALIGN(len as size_t) + CMSG_ALIGN(crate::mem::size_of::())) as c_uint + (CMSG_ALIGN(len as size_t) + CMSG_ALIGN(mem::size_of::())) as c_uint } pub {const} fn CMSG_LEN(len: c_uint) -> c_uint { - (CMSG_ALIGN(crate::mem::size_of::()) + len as size_t) as c_uint + (CMSG_ALIGN(mem::size_of::()) + len as size_t) as c_uint } } @@ -3525,8 +3525,8 @@ safe_f! { } fn __CMSG_LEN(cmsg: *const cmsghdr) -> ssize_t { - ((unsafe { (*cmsg).cmsg_len as size_t } + crate::mem::size_of::() - 1) - & !(crate::mem::size_of::() - 1)) as ssize_t + ((unsafe { (*cmsg).cmsg_len as size_t } + mem::size_of::() - 1) + & !(mem::size_of::() - 1)) as ssize_t } fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar { diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs index fcbd63673c9df..bed7a926030fe 100644 --- a/src/fuchsia/riscv64.rs +++ b/src/fuchsia/riscv64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_ulong, c_ulonglong, c_ushort, off_t}; +use crate::off_t; +use crate::prelude::*; // From psABI Calling Convention for RV64 pub type c_char = u8; diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index 632bace2d1d64..b82b86adcd41e 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_ulong, c_ulonglong, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -94,8 +95,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -106,8 +107,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/hermit.rs b/src/hermit.rs index 18429de548672..2b470e78d3afe 100644 --- a/src/hermit.rs +++ b/src/hermit.rs @@ -1,6 +1,6 @@ //! Hermit C type definitions -use crate::c_void; +use crate::prelude::*; cfg_if! { if #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] { diff --git a/src/psp.rs b/src/psp.rs index d1564798011b0..e1bf285967ede 100644 --- a/src/psp.rs +++ b/src/psp.rs @@ -4,7 +4,7 @@ //! by the linker. Crates that use these definitions must, somewhere in the //! crate graph, include a stub provider crate such as the `psp` crate. -use crate::c_void; +use crate::prelude::*; pub type c_schar = i8; pub type c_uchar = u8; diff --git a/src/solid/mod.rs b/src/solid/mod.rs index c52085c440f27..19c9b6aed344b 100644 --- a/src/solid/mod.rs +++ b/src/solid/mod.rs @@ -2,7 +2,7 @@ //! //! [SOLID]: https://solid.kmckk.com/ -use crate::c_void; +use crate::prelude::*; pub type c_schar = i8; pub type c_uchar = u8; diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index a46587d111108..b9a46f946a84d 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -8,7 +8,7 @@ // only supported on Rust > 1.59, so we can directly reexport c_void from core. pub use core::ffi::c_void; -use Option; +use crate::prelude::*; pub type c_schar = i8; diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 86ea4ca5cde12..bd087ea334dd2 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1,7 +1,4 @@ -use crate::{ - c_double, c_int, c_longlong, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, intptr_t, - size_t, ssize_t, -}; +use crate::prelude::*; pub type c_char = u8; pub type caddr_t = *mut c_char; @@ -578,16 +575,16 @@ cfg_if! { } } impl Eq for __sigaction_sa_union {} - impl crate::fmt::Debug for __sigaction_sa_union { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for __sigaction_sa_union { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("__sigaction_sa_union") .field("__su_handler", unsafe { &self.__su_handler }) .field("__su_sigaction", unsafe { &self.__su_sigaction }) .finish() } } - impl crate::hash::Hash for __sigaction_sa_union { - fn hash(&self, state: &mut H) { + impl hash::Hash for __sigaction_sa_union { + fn hash(&self, state: &mut H) { unsafe { self.__su_handler.hash(state); self.__su_sigaction.hash(state); @@ -603,8 +600,8 @@ cfg_if! { } } impl Eq for sigaction {} - impl crate::fmt::Debug for sigaction { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for sigaction { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("sigaction") .field("sa_union", &self.sa_union) .field("sa_mask", &self.sa_mask) @@ -612,8 +609,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigaction { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigaction { + fn hash(&self, state: &mut H) { self.sa_union.hash(state); self.sa_mask.hash(state); self.sa_flags.hash(state); @@ -630,8 +627,8 @@ cfg_if! { } } impl Eq for __poll_ctl_ext_u {} - impl crate::fmt::Debug for __poll_ctl_ext_u { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for __poll_ctl_ext_u { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("__poll_ctl_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -639,8 +636,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for __poll_ctl_ext_u { - fn hash(&self, state: &mut H) { + impl hash::Hash for __poll_ctl_ext_u { + fn hash(&self, state: &mut H) { unsafe { self.addr.hash(state); self.data32.hash(state); @@ -660,8 +657,8 @@ cfg_if! { } } impl Eq for poll_ctl_ext {} - impl crate::fmt::Debug for poll_ctl_ext { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for poll_ctl_ext { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("poll_ctl_ext") .field("version", &self.version) .field("command", &self.command) @@ -672,8 +669,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for poll_ctl_ext { - fn hash(&self, state: &mut H) { + impl hash::Hash for poll_ctl_ext { + fn hash(&self, state: &mut H) { self.version.hash(state); self.command.hash(state); self.events.hash(state); @@ -2508,7 +2505,7 @@ pub const ACCOUNTING: c_short = 9; f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -2519,7 +2516,7 @@ f! { if cmsg.is_null() { CMSG_FIRSTHDR(mhdr) } else { - if (cmsg as usize + (*cmsg).cmsg_len as usize + crate::mem::size_of::()) + if (cmsg as usize + (*cmsg).cmsg_len as usize + mem::size_of::()) > ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize) { 0 as *mut cmsghdr @@ -2531,15 +2528,15 @@ f! { } pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(crate::mem::size_of::() as isize) + (cmsg as *mut c_uchar).offset(mem::size_of::() as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - crate::mem::size_of::() as c_uint + length + mem::size_of::() as c_uint + length } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - crate::mem::size_of::() as c_uint + length + mem::size_of::() as c_uint + length } pub fn FD_ZERO(set: *mut fd_set) -> () { @@ -2549,21 +2546,21 @@ f! { } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of::() * 8; + let bits = mem::size_of::() * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return; } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of::() * 8; + let bits = mem::size_of::() * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { - let bits = crate::mem::size_of::() * 8; + let bits = mem::size_of::() * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index a54b014d8bf16..e9f5b1e1cf3ad 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -1,7 +1,5 @@ -use crate::{ - c_char, c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; @@ -321,8 +319,8 @@ cfg_if! { } } impl Eq for siginfo_t {} - impl crate::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("siginfo_t") .field("si_signo", &self.si_signo) .field("si_errno", &self.si_errno) @@ -337,8 +335,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { self.si_signo.hash(state); self.si_errno.hash(state); self.si_code.hash(state); @@ -358,16 +356,16 @@ cfg_if! { } } impl Eq for _kernel_simple_lock {} - impl crate::fmt::Debug for _kernel_simple_lock { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for _kernel_simple_lock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("_kernel_simple_lock") .field("_slock", unsafe { &self._slock }) .field("_slockp", unsafe { &self._slockp }) .finish() } } - impl crate::hash::Hash for _kernel_simple_lock { - fn hash(&self, state: &mut H) { + impl hash::Hash for _kernel_simple_lock { + fn hash(&self, state: &mut H) { unsafe { self._slock.hash(state); self._slockp.hash(state); @@ -385,8 +383,8 @@ cfg_if! { } } impl Eq for fileops_t {} - impl crate::fmt::Debug for fileops_t { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for fileops_t { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("fileops_t") .field("fo_rw", &self.fo_rw) .field("fo_ioctl", &self.fo_ioctl) @@ -396,8 +394,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fileops_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for fileops_t { + fn hash(&self, state: &mut H) { self.fo_rw.hash(state); self.fo_ioctl.hash(state); self.fo_select.hash(state); @@ -426,8 +424,8 @@ cfg_if! { } } impl Eq for file {} - impl crate::fmt::Debug for file { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for file { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("file") .field("f_flag", &self.f_flag) .field("f_count", &self.f_count) @@ -447,8 +445,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for file { - fn hash(&self, state: &mut H) { + impl hash::Hash for file { + fn hash(&self, state: &mut H) { self.f_flag.hash(state); self.f_count.hash(state); self.f_options.hash(state); @@ -477,8 +475,8 @@ cfg_if! { } } impl Eq for __ld_info_file {} - impl crate::fmt::Debug for __ld_info_file { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for __ld_info_file { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("__ld_info_file") .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) @@ -486,8 +484,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for __ld_info_file { - fn hash(&self, state: &mut H) { + impl hash::Hash for __ld_info_file { + fn hash(&self, state: &mut H) { unsafe { self._ldinfo_fd.hash(state); self._ldinfo_fp.hash(state); @@ -509,8 +507,8 @@ cfg_if! { } } impl Eq for ld_info {} - impl crate::fmt::Debug for ld_info { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for ld_info { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ld_info") .field("ldinfo_next", &self.ldinfo_next) .field("ldinfo_flags", &self.ldinfo_flags) @@ -523,8 +521,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ld_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for ld_info { + fn hash(&self, state: &mut H) { self.ldinfo_next.hash(state); self.ldinfo_flags.hash(state); self.ldinfo_textorg.hash(state); @@ -546,8 +544,8 @@ cfg_if! { } } impl Eq for __pollfd_ext_u {} - impl crate::fmt::Debug for __pollfd_ext_u { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for __pollfd_ext_u { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("__pollfd_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -555,8 +553,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for __pollfd_ext_u { - fn hash(&self, state: &mut H) { + impl hash::Hash for __pollfd_ext_u { + fn hash(&self, state: &mut H) { unsafe { self.addr.hash(state); self.data.hash(state); @@ -574,8 +572,8 @@ cfg_if! { } } impl Eq for pollfd_ext {} - impl crate::fmt::Debug for pollfd_ext { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for pollfd_ext { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("pollfd_ext") .field("fd", &self.fd) .field("events", &self.events) @@ -584,8 +582,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for pollfd_ext { - fn hash(&self, state: &mut H) { + impl hash::Hash for pollfd_ext { + fn hash(&self, state: &mut H) { self.fd.hash(state); self.events.hash(state); self.revents.hash(state); diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index 9088be7d1ed94..70f8de79af7b6 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -1,6 +1,6 @@ //! 32-bit specific Apple (ios/darwin) definitions -use crate::{c_char, c_int, c_uchar, c_ushort}; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; @@ -82,16 +82,16 @@ cfg_if! { } } impl Eq for pthread_attr_t {} - impl crate::fmt::Debug for pthread_attr_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_attr_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_attr_t") .field("__sig", &self.__sig) // FIXME: .field("__opaque", &self.__opaque) .finish() } } - impl crate::hash::Hash for pthread_attr_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_attr_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } @@ -107,15 +107,15 @@ cfg_if! { } } impl Eq for pthread_once_t {} - impl crate::fmt::Debug for pthread_once_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_once_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_once_t") .field("__sig", &self.__sig) .finish() } } - impl crate::hash::Hash for pthread_once_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_once_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index 6a9ea9c65f719..60b9d4bb4ce40 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub type boolean_t = c_int; pub type mcontext_t = *mut __darwin_mcontext64; diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs index c75608cdeeadc..b09bcb9dad332 100644 --- a/src/unix/bsd/apple/b64/mod.rs +++ b/src/unix/bsd/apple/b64/mod.rs @@ -1,6 +1,6 @@ //! 64-bit specific Apple (ios/darwin) definitions -use crate::{c_char, c_int, c_uchar, c_uint, c_ushort}; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; @@ -76,16 +76,16 @@ cfg_if! { } } impl Eq for pthread_attr_t {} - impl crate::fmt::Debug for pthread_attr_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_attr_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_attr_t") .field("__sig", &self.__sig) // FIXME: .field("__opaque", &self.__opaque) .finish() } } - impl crate::hash::Hash for pthread_attr_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_attr_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } @@ -101,15 +101,15 @@ cfg_if! { } } impl Eq for pthread_once_t {} - impl crate::fmt::Debug for pthread_once_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_once_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_once_t") .field("__sig", &self.__sig) .finish() } } - impl crate::hash::Hash for pthread_once_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_once_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } diff --git a/src/unix/bsd/apple/b64/x86_64/mod.rs b/src/unix/bsd/apple/b64/x86_64/mod.rs index c6a9261ed33e0..ea738497e98de 100644 --- a/src/unix/bsd/apple/b64/x86_64/mod.rs +++ b/src/unix/bsd/apple/b64/x86_64/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_short, c_uint, c_void, size_t}; +use crate::prelude::*; pub type boolean_t = c_uint; pub type mcontext_t = *mut __darwin_mcontext64; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 090a1c2d1ad1d..89c0e3197a9d0 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -2,10 +2,8 @@ //! //! This covers *-apple-* triples currently -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, cmsghdr, intptr_t, - off_t, size_t, ssize_t, -}; +use crate::prelude::*; +use crate::{cmsghdr, off_t}; pub type c_char = i8; pub type wchar_t = i32; @@ -1720,15 +1718,15 @@ cfg_if! { } } impl Eq for semun {} - impl crate::fmt::Debug for semun { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for semun { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("semun") .field("val", unsafe { &self.val }) .finish() } } - impl crate::hash::Hash for semun { - fn hash(&self, state: &mut H) { + impl hash::Hash for semun { + fn hash(&self, state: &mut H) { unsafe { self.val.hash(state) }; } } @@ -1757,8 +1755,8 @@ cfg_if! { } } impl Eq for ifconf {} - impl crate::fmt::Debug for ifconf { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifconf { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifconf").finish_non_exhaustive() } } @@ -1774,8 +1772,8 @@ cfg_if! { } } impl Eq for kevent {} - impl crate::fmt::Debug for kevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for kevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ident = self.ident; let filter = self.filter; let flags = self.flags; @@ -1792,8 +1790,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for kevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for kevent { + fn hash(&self, state: &mut H) { let ident = self.ident; let filter = self.filter; let flags = self.flags; @@ -1826,8 +1824,8 @@ cfg_if! { } } impl Eq for semid_ds {} - impl crate::fmt::Debug for semid_ds { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for semid_ds { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let sem_perm = self.sem_perm; let sem_base = self.sem_base; let sem_nsems = self.sem_nsems; @@ -1848,8 +1846,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for semid_ds { - fn hash(&self, state: &mut H) { + impl hash::Hash for semid_ds { + fn hash(&self, state: &mut H) { let sem_perm = self.sem_perm; let sem_base = self.sem_base; let sem_nsems = self.sem_nsems; @@ -1885,8 +1883,8 @@ cfg_if! { } } impl Eq for shmid_ds {} - impl crate::fmt::Debug for shmid_ds { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for shmid_ds { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let shm_perm = self.shm_perm; let shm_segsz = self.shm_segsz; let shm_lpid = self.shm_lpid; @@ -1909,8 +1907,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for shmid_ds { - fn hash(&self, state: &mut H) { + impl hash::Hash for shmid_ds { + fn hash(&self, state: &mut H) { let shm_perm = self.shm_perm; let shm_segsz = self.shm_segsz; let shm_lpid = self.shm_lpid; @@ -1952,8 +1950,8 @@ cfg_if! { } } impl Eq for proc_threadinfo {} - impl crate::fmt::Debug for proc_threadinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for proc_threadinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("proc_threadinfo") .field("pth_user_time", &self.pth_user_time) .field("pth_system_time", &self.pth_system_time) @@ -1969,8 +1967,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for proc_threadinfo { - fn hash(&self, state: &mut H) { + impl hash::Hash for proc_threadinfo { + fn hash(&self, state: &mut H) { self.pth_user_time.hash(state); self.pth_system_time.hash(state); self.pth_cpu_usage.hash(state); @@ -2015,8 +2013,8 @@ cfg_if! { } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -2038,8 +2036,8 @@ cfg_if! { } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_bsize.hash(state); self.f_iosize.hash(state); self.f_blocks.hash(state); @@ -2074,8 +2072,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_seekoff", &self.d_seekoff) @@ -2086,8 +2084,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_seekoff.hash(state); self.d_reclen.hash(state); @@ -2107,16 +2105,16 @@ cfg_if! { } } impl Eq for pthread_rwlock_t {} - impl crate::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") .field("__sig", &self.__sig) // FIXME: .field("__opaque", &self.__opaque) .finish() } } - impl crate::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } @@ -2135,8 +2133,8 @@ cfg_if! { impl Eq for pthread_mutex_t {} - impl crate::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_mutex_t") .field("__sig", &self.__sig) // FIXME: .field("__opaque", &self.__opaque) @@ -2144,8 +2142,8 @@ cfg_if! { } } - impl crate::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } @@ -2164,8 +2162,8 @@ cfg_if! { impl Eq for pthread_cond_t {} - impl crate::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") .field("__sig", &self.__sig) // FIXME: .field("__opaque", &self.__opaque) @@ -2173,8 +2171,8 @@ cfg_if! { } } - impl crate::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { self.__sig.hash(state); self.__opaque.hash(state); } @@ -2200,8 +2198,8 @@ cfg_if! { impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -2212,8 +2210,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); self.__ss_pad1.hash(state); @@ -2244,8 +2242,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") // FIXME: .field("ut_user", &self.ut_user) .field("ut_id", &self.ut_id) @@ -2259,8 +2257,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_user.hash(state); self.ut_id.hash(state); self.ut_line.hash(state); @@ -2283,8 +2281,8 @@ cfg_if! { impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -2294,8 +2292,8 @@ cfg_if! { } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -2309,15 +2307,15 @@ cfg_if! { } } impl Eq for processor_cpu_load_info {} - impl crate::fmt::Debug for processor_cpu_load_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for processor_cpu_load_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("processor_cpu_load_info") .field("cpu_ticks", &self.cpu_ticks) .finish() } } - impl crate::hash::Hash for processor_cpu_load_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for processor_cpu_load_info { + fn hash(&self, state: &mut H) { self.cpu_ticks.hash(state); } } @@ -2332,8 +2330,8 @@ cfg_if! { } } impl Eq for processor_basic_info {} - impl crate::fmt::Debug for processor_basic_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for processor_basic_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("processor_basic_info") .field("cpu_type", &self.cpu_type) .field("cpu_subtype", &self.cpu_subtype) @@ -2343,8 +2341,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for processor_basic_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for processor_basic_info { + fn hash(&self, state: &mut H) { self.cpu_type.hash(state); self.cpu_subtype.hash(state); self.running.hash(state); @@ -2360,16 +2358,16 @@ cfg_if! { } } impl Eq for processor_set_basic_info {} - impl crate::fmt::Debug for processor_set_basic_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for processor_set_basic_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("processor_set_basic_info") .field("processor_count", &self.processor_count) .field("default_policy", &self.default_policy) .finish() } } - impl crate::hash::Hash for processor_set_basic_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for processor_set_basic_info { + fn hash(&self, state: &mut H) { self.processor_count.hash(state); self.default_policy.hash(state); } @@ -2384,8 +2382,8 @@ cfg_if! { } } impl Eq for processor_set_load_info {} - impl crate::fmt::Debug for processor_set_load_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for processor_set_load_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("processor_set_load_info") .field("task_count", &self.task_count) .field("thread_count", &self.thread_count) @@ -2394,8 +2392,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for processor_set_load_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for processor_set_load_info { + fn hash(&self, state: &mut H) { self.task_count.hash(state); self.thread_count.hash(state); self.load_average.hash(state); @@ -2409,16 +2407,16 @@ cfg_if! { } } impl Eq for time_value_t {} - impl crate::fmt::Debug for time_value_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for time_value_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("time_value_t") .field("seconds", &self.seconds) .field("microseconds", &self.microseconds) .finish() } } - impl crate::hash::Hash for time_value_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for time_value_t { + fn hash(&self, state: &mut H) { self.seconds.hash(state); self.microseconds.hash(state); } @@ -2436,8 +2434,8 @@ cfg_if! { } } impl Eq for thread_basic_info {} - impl crate::fmt::Debug for thread_basic_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for thread_basic_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("thread_basic_info") .field("user_time", &self.user_time) .field("system_time", &self.system_time) @@ -2450,8 +2448,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for thread_basic_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for thread_basic_info { + fn hash(&self, state: &mut H) { self.user_time.hash(state); self.system_time.hash(state); self.cpu_usage.hash(state); @@ -2482,8 +2480,8 @@ cfg_if! { } } impl Eq for thread_extended_info {} - impl crate::fmt::Debug for thread_extended_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for thread_extended_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("proc_threadinfo") .field("pth_user_time", &self.pth_user_time) .field("pth_system_time", &self.pth_system_time) @@ -2499,8 +2497,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for thread_extended_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for thread_extended_info { + fn hash(&self, state: &mut H) { self.pth_user_time.hash(state); self.pth_system_time.hash(state); self.pth_cpu_usage.hash(state); @@ -2522,8 +2520,8 @@ cfg_if! { } } impl Eq for thread_identifier_info {} - impl crate::fmt::Debug for thread_identifier_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for thread_identifier_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("thread_identifier_info") .field("thread_id", &self.thread_id) .field("thread_handle", &self.thread_handle) @@ -2531,8 +2529,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for thread_identifier_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for thread_identifier_info { + fn hash(&self, state: &mut H) { self.thread_id.hash(state); self.thread_handle.hash(state); self.dispatch_qaddr.hash(state); @@ -2568,8 +2566,8 @@ cfg_if! { } } impl Eq for if_data64 {} - impl crate::fmt::Debug for if_data64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for if_data64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ifi_type = self.ifi_type; let ifi_typelen = self.ifi_typelen; let ifi_physical = self.ifi_physical; @@ -2624,8 +2622,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for if_data64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for if_data64 { + fn hash(&self, state: &mut H) { let ifi_type = self.ifi_type; let ifi_typelen = self.ifi_typelen; let ifi_physical = self.ifi_physical; @@ -2694,8 +2692,8 @@ cfg_if! { } } impl Eq for if_msghdr2 {} - impl crate::fmt::Debug for if_msghdr2 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for if_msghdr2 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ifm_msglen = self.ifm_msglen; let ifm_version = self.ifm_version; let ifm_type = self.ifm_type; @@ -2722,8 +2720,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for if_msghdr2 { - fn hash(&self, state: &mut H) { + impl hash::Hash for if_msghdr2 { + fn hash(&self, state: &mut H) { let ifm_msglen = self.ifm_msglen; let ifm_version = self.ifm_version; let ifm_type = self.ifm_type; @@ -2779,8 +2777,8 @@ cfg_if! { } } impl Eq for vm_statistics64 {} - impl crate::fmt::Debug for vm_statistics64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vm_statistics64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let free_count = self.free_count; let active_count = self.active_count; let inactive_count = self.inactive_count; @@ -2837,8 +2835,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vm_statistics64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for vm_statistics64 { + fn hash(&self, state: &mut H) { let free_count = self.free_count; let active_count = self.active_count; let inactive_count = self.inactive_count; @@ -2903,8 +2901,8 @@ cfg_if! { } } impl Eq for mach_task_basic_info {} - impl crate::fmt::Debug for mach_task_basic_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mach_task_basic_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let virtual_size = self.virtual_size; let resident_size = self.resident_size; let resident_size_max = self.resident_size_max; @@ -2923,8 +2921,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mach_task_basic_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for mach_task_basic_info { + fn hash(&self, state: &mut H) { let virtual_size = self.virtual_size; let resident_size = self.resident_size; let resident_size_max = self.resident_size_max; @@ -2950,8 +2948,8 @@ cfg_if! { } } impl Eq for log2phys {} - impl crate::fmt::Debug for log2phys { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for log2phys { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let l2p_flags = self.l2p_flags; let l2p_contigbytes = self.l2p_contigbytes; let l2p_devoffset = self.l2p_devoffset; @@ -2962,8 +2960,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for log2phys { - fn hash(&self, state: &mut H) { + impl hash::Hash for log2phys { + fn hash(&self, state: &mut H) { let l2p_flags = self.l2p_flags; let l2p_contigbytes = self.l2p_contigbytes; let l2p_devoffset = self.l2p_devoffset; @@ -2980,16 +2978,16 @@ cfg_if! { impl Eq for os_unfair_lock {} - impl crate::fmt::Debug for os_unfair_lock { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for os_unfair_lock { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("os_unfair_lock") .field("_os_unfair_lock_opaque", &self._os_unfair_lock_opaque) .finish() } } - impl crate::hash::Hash for os_unfair_lock { - fn hash(&self, state: &mut H) { + impl hash::Hash for os_unfair_lock { + fn hash(&self, state: &mut H) { self._os_unfair_lock_opaque.hash(state); } } @@ -3006,8 +3004,8 @@ cfg_if! { impl Eq for sockaddr_vm {} - impl crate::fmt::Debug for sockaddr_vm { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_vm { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let svm_len = self.svm_len; let svm_family = self.svm_family; let svm_reserved1 = self.svm_reserved1; @@ -3024,8 +3022,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_vm { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_vm { + fn hash(&self, state: &mut H) { let svm_len = self.svm_len; let svm_family = self.svm_family; let svm_reserved1 = self.svm_reserved1; @@ -3050,8 +3048,8 @@ cfg_if! { impl Eq for ifdevmtu {} - impl crate::fmt::Debug for ifdevmtu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifdevmtu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifdevmtu") .field("ifdm_current", &self.ifdm_current) .field("ifdm_min", &self.ifdm_min) @@ -3060,8 +3058,8 @@ cfg_if! { } } - impl crate::hash::Hash for ifdevmtu { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifdevmtu { + fn hash(&self, state: &mut H) { self.ifdm_current.hash(state); self.ifdm_min.hash(state); self.ifdm_max.hash(state); @@ -3076,16 +3074,16 @@ cfg_if! { impl Eq for __c_anonymous_ifk_data {} - impl crate::fmt::Debug for __c_anonymous_ifk_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifk_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifk_data") .field("ifk_ptr", unsafe { &self.ifk_ptr }) .field("ifk_value", unsafe { &self.ifk_value }) .finish() } } - impl crate::hash::Hash for __c_anonymous_ifk_data { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifk_data { + fn hash(&self, state: &mut H) { unsafe { self.ifk_ptr.hash(state); self.ifk_value.hash(state); @@ -3101,8 +3099,8 @@ cfg_if! { impl Eq for ifkpi {} - impl crate::fmt::Debug for ifkpi { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifkpi { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifkpi") .field("ifk_module_id", &self.ifk_module_id) .field("ifk_type", &self.ifk_type) @@ -3110,8 +3108,8 @@ cfg_if! { } } - impl crate::hash::Hash for ifkpi { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifkpi { + fn hash(&self, state: &mut H) { self.ifk_module_id.hash(state); self.ifk_type.hash(state); } @@ -3146,8 +3144,8 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru {} - impl crate::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifr_ifru") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -3171,8 +3169,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifr_ifru { + fn hash(&self, state: &mut H) { unsafe { self.ifru_addr.hash(state); self.ifru_dstaddr.hash(state); @@ -3202,8 +3200,8 @@ cfg_if! { impl Eq for ifreq {} - impl crate::fmt::Debug for ifreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") .field("ifr_name", &self.ifr_name) .field("ifr_ifru", &self.ifr_ifru) @@ -3211,8 +3209,8 @@ cfg_if! { } } - impl crate::hash::Hash for ifreq { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifreq { + fn hash(&self, state: &mut H) { self.ifr_name.hash(state); self.ifr_ifru.hash(state); } @@ -3226,8 +3224,8 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifc_ifcu") .field("ifcu_buf", unsafe { &self.ifcu_buf }) .field("ifcu_req", unsafe { &self.ifcu_req }) @@ -3235,8 +3233,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifc_ifcu { + fn hash(&self, state: &mut H) { unsafe { self.ifcu_buf.hash(state) }; unsafe { self.ifcu_req.hash(state) }; } @@ -3263,8 +3261,8 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru6 {} - impl crate::fmt::Debug for __c_anonymous_ifr_ifru6 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru6 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifr_ifru6") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -3278,8 +3276,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifr_ifru6 { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifr_ifru6 { + fn hash(&self, state: &mut H) { unsafe { self.ifru_addr.hash(state); self.ifru_dstaddr.hash(state); @@ -3301,8 +3299,8 @@ cfg_if! { impl Eq for in6_ifreq {} - impl crate::fmt::Debug for in6_ifreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for in6_ifreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("in6_ifreq") .field("ifr_name", &self.ifr_name) .field("ifr_ifru", &self.ifr_ifru) @@ -5681,51 +5679,48 @@ pub const VMADDR_CID_HOST: c_uint = 2; pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF; const fn __DARWIN_ALIGN32(p: usize) -> usize { - const __DARWIN_ALIGNBYTES32: usize = crate::mem::size_of::() - 1; + const __DARWIN_ALIGNBYTES32: usize = mem::size_of::() - 1; p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32 } pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() - / crate::mem::size_of::()) as mach_msg_type_number_t; + (mem::size_of::() / mem::size_of::()) + as mach_msg_type_number_t; pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) + as mach_msg_type_number_t; +pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t = + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; -pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t = (crate::mem::size_of::< - thread_latency_qos_policy_data_t, ->() / crate::mem::size_of::< - integer_t, ->()) as mach_msg_type_number_t; pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() - / crate::mem::size_of::()) as mach_msg_type_number_t; + (mem::size_of::() / mem::size_of::()) + as mach_msg_type_number_t; pub const THREAD_BASIC_INFO_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const THREAD_IDENTIFIER_INFO_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const THREAD_EXTENDED_INFO_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) + (mem::size_of::() / mem::size_of::()) as mach_msg_type_number_t; pub const TASK_THREAD_TIMES_INFO_COUNT: u32 = - (crate::mem::size_of::() / crate::mem::size_of::()) - as u32; -pub const MACH_TASK_BASIC_INFO_COUNT: u32 = (crate::mem::size_of::() - / crate::mem::size_of::()) as u32; -pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t = - (crate::mem::size_of::() / crate::mem::size_of::()) - as mach_msg_type_number_t; + (mem::size_of::() / mem::size_of::()) as u32; +pub const MACH_TASK_BASIC_INFO_COUNT: u32 = + (mem::size_of::() / mem::size_of::()) as u32; +pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t = (mem::size_of::() + / mem::size_of::()) + as mach_msg_type_number_t; // bsd/net/if_mib.h /// Non-interface-specific @@ -5764,7 +5759,7 @@ f! { let cmsg_len = (*cmsg).cmsg_len as usize; let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; - if next + __DARWIN_ALIGN32(crate::mem::size_of::()) > max { + if next + __DARWIN_ALIGN32(mem::size_of::()) > max { core::ptr::null_mut() } else { next as *mut cmsghdr @@ -5772,16 +5767,15 @@ f! { } pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(crate::mem::size_of::())) + (cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(mem::size_of::())) } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (__DARWIN_ALIGN32(crate::mem::size_of::()) + __DARWIN_ALIGN32(length as usize)) - as c_uint + (__DARWIN_ALIGN32(mem::size_of::()) + __DARWIN_ALIGN32(length as usize)) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - (__DARWIN_ALIGN32(crate::mem::size_of::()) + length as usize) as c_uint + (__DARWIN_ALIGN32(mem::size_of::()) + length as usize) as c_uint } pub {const} fn VM_MAKE_TAG(id: u8) -> u32 { diff --git a/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/src/unix/bsd/freebsdlike/dragonfly/errno.rs index 2a6452c635a34..874c1da84d3a5 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/errno.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/errno.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; /* DIFF(main): module removed in de76fee6 */ diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index ffda3bf3312d1..a97ead4757b1a 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_short, c_uchar, c_uint, c_ushort, c_void, cmsghdr, intptr_t, off_t, size_t, ssize_t, -}; +use crate::prelude::*; +use crate::{cmsghdr, off_t}; pub type dev_t = u32; pub type c_char = i8; @@ -558,8 +557,8 @@ cfg_if! { } } impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_name", &self.ut_name) .field("ut_id", &self.ut_id) @@ -576,8 +575,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_name.hash(state); self.ut_id.hash(state); self.ut_line.hash(state); @@ -601,8 +600,8 @@ cfg_if! { } } impl Eq for lastlogx {} - impl crate::fmt::Debug for lastlogx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for lastlogx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("lastlogx") .field("ll_tv", &self.ll_tv) .field("ll_line", &self.ll_line) @@ -611,8 +610,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for lastlogx { - fn hash(&self, state: &mut H) { + impl hash::Hash for lastlogx { + fn hash(&self, state: &mut H) { self.ll_tv.hash(state); self.ll_line.hash(state); self.ll_host.hash(state); @@ -635,8 +634,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_namlen", &self.d_namlen) @@ -647,8 +646,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_namlen.hash(state); self.d_type.hash(state); @@ -689,8 +688,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -712,8 +711,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_bsize.hash(state); self.f_iosize.hash(state); self.f_blocks.hash(state); @@ -743,8 +742,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -752,8 +751,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -794,8 +793,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_onstack", &self.mc_onstack) .field("mc_rdi", &self.mc_rdi) @@ -830,8 +829,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_onstack.hash(state); self.mc_rdi.hash(state); self.mc_rsi.hash(state); @@ -877,8 +876,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_sigmask", &self.uc_sigmask) .field("uc_mcontext", &self.uc_mcontext) @@ -889,8 +888,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_sigmask.hash(state); self.uc_mcontext.hash(state); self.uc_link.hash(state); @@ -1069,7 +1068,7 @@ pub const CPUCTL_MSRSBIT: c_int = 0xc0106305; pub const CPUCTL_MSRCBIT: c_int = 0xc0106306; pub const CPUCTL_CPUID_COUNT: c_int = 0xc0106307; -pub const CPU_SETSIZE: size_t = crate::mem::size_of::() * 8; +pub const CPU_SETSIZE: size_t = mem::size_of::() * 8; pub const EVFILT_READ: i16 = -1; pub const EVFILT_WRITE: i16 = -2; @@ -1541,23 +1540,23 @@ pub const RTAX_MAX: c_int = 11; const_fn! { {const} fn _CMSG_ALIGN(n: usize) -> usize { - (n + (crate::mem::size_of::() - 1)) & !(crate::mem::size_of::() - 1) + (n + (mem::size_of::() - 1)) & !(mem::size_of::() - 1) } } f! { pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - (_CMSG_ALIGN(crate::mem::size_of::()) + length as usize) as c_uint + (_CMSG_ALIGN(mem::size_of::()) + length as usize) as c_uint } pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize) - + _CMSG_ALIGN(crate::mem::size_of::()); + + _CMSG_ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next <= max { (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr @@ -1567,7 +1566,7 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (_CMSG_ALIGN(crate::mem::size_of::()) + _CMSG_ALIGN(length as usize)) as c_uint + (_CMSG_ALIGN(mem::size_of::()) + _CMSG_ALIGN(length as usize)) as c_uint } pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index 2e9dcdf15151e..81d3eb351cdb6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i64; @@ -36,7 +36,7 @@ s_no_extra_traits! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; cfg_if! { if #[cfg(feature = "extra_traits")] { @@ -51,8 +51,8 @@ cfg_if! { } } impl Eq for gpregs {} - impl crate::fmt::Debug for gpregs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for gpregs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("gpregs") .field("gp_x", &self.gp_x) .field("gp_lr", &self.gp_lr) @@ -63,8 +63,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for gpregs { - fn hash(&self, state: &mut H) { + impl hash::Hash for gpregs { + fn hash(&self, state: &mut H) { self.gp_x.hash(state); self.gp_lr.hash(state); self.gp_sp.hash(state); @@ -83,8 +83,8 @@ cfg_if! { } } impl Eq for fpregs {} - impl crate::fmt::Debug for fpregs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpregs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpregs") .field("fp_q", &self.fp_q) .field("fp_sr", &self.fp_sr) @@ -94,8 +94,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fpregs { - fn hash(&self, state: &mut H) { + impl hash::Hash for fpregs { + fn hash(&self, state: &mut H) { self.fp_q.hash(state); self.fp_sr.hash(state); self.fp_cr.hash(state); @@ -117,8 +117,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_gpregs", &self.mc_gpregs) .field("mc_fpregs", &self.mc_fpregs) @@ -128,8 +128,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_gpregs.hash(state); self.mc_fpregs.hash(state); self.mc_flags.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index c9eb88be6ebb3..07492c9333d75 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_uint, c_void, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i32; @@ -35,8 +35,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("__gregs", &self.__gregs) .field("mc_vfp_size", &self.mc_vfp_size) @@ -45,8 +45,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.__gregs.hash(state); self.mc_vfp_size.hash(state); self.mc_vfp_ptr.hash(state); @@ -56,7 +56,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs index 0ea44c348f58c..4b96972433ec9 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs @@ -1,4 +1,5 @@ -use crate::{c_long, off_t}; +use crate::off_t; +use crate::prelude::*; #[repr(C)] #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs index 500676a665d79..c492ceb47aa41 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs @@ -1,4 +1,5 @@ -use crate::{c_long, off_t}; +use crate::off_t; +use crate::prelude::*; #[repr(C)] #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 49b448a1be7dc..6a484e4a0b229 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ushort, c_void, intptr_t, size_t}; +use crate::prelude::*; // APIs that were changed after FreeBSD 11 @@ -297,8 +297,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -320,8 +320,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -358,8 +358,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_reclen", &self.d_reclen) @@ -369,8 +369,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_reclen.hash(state); self.d_type.hash(state); @@ -395,8 +395,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl crate::fmt::Debug for vnstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vnstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -411,8 +411,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 6bffccfc9fc70..d419433efeb9b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; // APIs in FreeBSD 12 that have changed since 11. @@ -343,8 +341,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -366,8 +364,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -406,8 +404,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -418,8 +416,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -445,8 +443,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl crate::fmt::Debug for vnstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vnstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -461,8 +459,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs index 24713993f90a7..b29171cc509c5 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index f777c990d8d93..c5944a69988e8 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; // APIs in FreeBSD 13 that have changed since 11. @@ -356,8 +354,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -379,8 +377,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -419,8 +417,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -431,8 +429,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -458,8 +456,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl crate::fmt::Debug for vnstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vnstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -474,8 +472,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs index 24713993f90a7..b29171cc509c5 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 380791488bf97..34dd48f486f4a 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; // APIs in FreeBSD 14 that have changed since 11. @@ -356,8 +354,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -379,8 +377,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -419,8 +417,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -431,8 +429,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -458,8 +456,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl crate::fmt::Debug for vnstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vnstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -474,8 +472,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs index 2c403114c0305..3e037471fbf68 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index d5c068ec49cef..4a454619ef06c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; // APIs in FreeBSD 15 that have changed since 11. @@ -356,8 +354,8 @@ cfg_if! { } } impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_bsize", &self.f_bsize) .field("f_iosize", &self.f_iosize) @@ -379,8 +377,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_version.hash(state); self.f_type.hash(state); self.f_flags.hash(state); @@ -419,8 +417,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -431,8 +429,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -458,8 +456,8 @@ cfg_if! { } } impl Eq for vnstat {} - impl crate::fmt::Debug for vnstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for vnstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_vn_devname: &[c_char] = &self.vn_devname; f.debug_struct("vnstat") @@ -474,8 +472,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for vnstat { + fn hash(&self, state: &mut H) { let self_vn_devname: &[c_char] = &self.vn_devname; self.vn_fileid.hash(state); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs index 2c403114c0305..3e037471fbf68 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 6a443d93b6c46..fdaf2d46d35c0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ushort, c_void, cmsghdr, off_t, size_t, ssize_t, -}; +use crate::prelude::*; +use crate::{cmsghdr, off_t}; pub type fflags_t = u32; @@ -1666,8 +1665,8 @@ cfg_if! { } } impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_type", &self.ut_type) .field("ut_tv", &self.ut_tv) @@ -1680,8 +1679,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); self.ut_tv.hash(state); self.ut_id.hash(state); @@ -1699,15 +1698,15 @@ cfg_if! { } } impl Eq for __c_anonymous_cr_pid {} - impl crate::fmt::Debug for __c_anonymous_cr_pid { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_cr_pid { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("cr_pid") .field("cr_pid", unsafe { &self.cr_pid }) .finish() } } - impl crate::hash::Hash for __c_anonymous_cr_pid { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_cr_pid { + fn hash(&self, state: &mut H) { unsafe { self.cr_pid.hash(state) }; } } @@ -1722,8 +1721,8 @@ cfg_if! { } } impl Eq for xucred {} - impl crate::fmt::Debug for xucred { - fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + impl fmt::Debug for xucred { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("xucred") .field("cr_version", &self.cr_version) .field("cr_uid", &self.cr_uid) @@ -1733,8 +1732,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for xucred { - fn hash(&self, state: &mut H) { + impl hash::Hash for xucred { + fn hash(&self, state: &mut H) { self.cr_version.hash(state); self.cr_uid.hash(state); self.cr_ngroups.hash(state); @@ -1760,8 +1759,8 @@ cfg_if! { } } impl Eq for sockaddr_dl {} - impl crate::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_dl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_dl") .field("sdl_len", &self.sdl_len) .field("sdl_family", &self.sdl_family) @@ -1774,8 +1773,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_dl { + fn hash(&self, state: &mut H) { self.sdl_len.hash(state); self.sdl_family.hash(state); self.sdl_index.hash(state); @@ -1796,8 +1795,8 @@ cfg_if! { } } impl Eq for mq_attr {} - impl crate::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mq_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mq_attr") .field("mq_flags", &self.mq_flags) .field("mq_maxmsg", &self.mq_maxmsg) @@ -1806,8 +1805,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { self.mq_flags.hash(state); self.mq_maxmsg.hash(state); self.mq_msgsize.hash(state); @@ -1824,8 +1823,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -1834,8 +1833,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -1852,8 +1851,8 @@ cfg_if! { } } impl Eq for ptsstat {} - impl crate::fmt::Debug for ptsstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ptsstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let self_devname: &[c_char] = &self.devname; f.debug_struct("ptsstat") @@ -1862,8 +1861,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ptsstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for ptsstat { + fn hash(&self, state: &mut H) { let self_devname: &[c_char] = &self.devname; self.dev.hash(state); @@ -1877,8 +1876,8 @@ cfg_if! { } } impl Eq for __c_anonymous_elf32_auxv_union {} - impl crate::fmt::Debug for __c_anonymous_elf32_auxv_union { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_elf32_auxv_union { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("a_val") .field("a_val", unsafe { &self.a_val }) .finish() @@ -1890,8 +1889,8 @@ cfg_if! { } } impl Eq for Elf32_Auxinfo {} - impl crate::fmt::Debug for Elf32_Auxinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for Elf32_Auxinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Elf32_Auxinfo") .field("a_type", &self.a_type) .field("a_un", &self.a_un) @@ -1921,8 +1920,8 @@ cfg_if! { } } impl Eq for __c_anonymous_ifr_ifru {} - impl crate::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifr_ifru") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -1942,8 +1941,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifr_ifru { + fn hash(&self, state: &mut H) { unsafe { self.ifru_addr.hash(state) }; unsafe { self.ifru_dstaddr.hash(state) }; unsafe { self.ifru_broadaddr.hash(state) }; @@ -1968,16 +1967,16 @@ cfg_if! { } } impl Eq for ifreq {} - impl crate::fmt::Debug for ifreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") .field("ifr_name", &self.ifr_name) .field("ifr_ifru", &self.ifr_ifru) .finish() } } - impl crate::hash::Hash for ifreq { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifreq { + fn hash(&self, state: &mut H) { self.ifr_name.hash(state); self.ifr_ifru.hash(state); } @@ -1991,8 +1990,8 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifc_ifcu") .field("ifcu_buf", unsafe { &self.ifcu_buf }) .field("ifcu_req", unsafe { &self.ifcu_req }) @@ -2000,8 +1999,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifc_ifcu { + fn hash(&self, state: &mut H) { unsafe { self.ifcu_buf.hash(state) }; unsafe { self.ifcu_req.hash(state) }; } @@ -2016,8 +2015,8 @@ cfg_if! { } } impl Eq for ifstat {} - impl crate::fmt::Debug for ifstat { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifstat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ascii: &[c_char] = &self.ascii; f.debug_struct("ifstat") @@ -2026,8 +2025,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ifstat { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifstat { + fn hash(&self, state: &mut H) { self.ifs_name.hash(state); self.ascii.hash(state); } @@ -2046,8 +2045,8 @@ cfg_if! { } } impl Eq for ifrsskey {} - impl crate::fmt::Debug for ifrsskey { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifrsskey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ifrk_key: &[u8] = &self.ifrk_key; f.debug_struct("ifrsskey") @@ -2059,8 +2058,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ifrsskey { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifrsskey { + fn hash(&self, state: &mut H) { self.ifrk_name.hash(state); self.ifrk_func.hash(state); self.ifrk_spare0.hash(state); @@ -2081,8 +2080,8 @@ cfg_if! { } } impl Eq for ifdownreason {} - impl crate::fmt::Debug for ifdownreason { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifdownreason { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ifdr_msg: &[c_char] = &self.ifdr_msg; f.debug_struct("ifdownreason") @@ -2093,8 +2092,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ifdownreason { - fn hash(&self, state: &mut H) { + impl hash::Hash for ifdownreason { + fn hash(&self, state: &mut H) { self.ifdr_name.hash(state); self.ifdr_reason.hash(state); self.ifdr_vendor.hash(state); @@ -2108,16 +2107,16 @@ cfg_if! { } } impl Eq for __c_anonymous_ifi_epoch {} - impl crate::fmt::Debug for __c_anonymous_ifi_epoch { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifi_epoch { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifi_epoch") .field("tt", unsafe { &self.tt }) .field("ph", unsafe { &self.ph }) .finish() } } - impl crate::hash::Hash for __c_anonymous_ifi_epoch { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifi_epoch { + fn hash(&self, state: &mut H) { unsafe { self.tt.hash(state); self.ph.hash(state); @@ -2131,16 +2130,16 @@ cfg_if! { } } impl Eq for __c_anonymous_ifi_lastchange {} - impl crate::fmt::Debug for __c_anonymous_ifi_lastchange { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifi_lastchange { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifi_lastchange") .field("tv", unsafe { &self.tv }) .field("ph", unsafe { &self.ph }) .finish() } } - impl crate::hash::Hash for __c_anonymous_ifi_lastchange { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifi_lastchange { + fn hash(&self, state: &mut H) { unsafe { self.tv.hash(state); self.ph.hash(state); @@ -2178,8 +2177,8 @@ cfg_if! { } } impl Eq for if_data {} - impl crate::fmt::Debug for if_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for if_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("if_data") .field("ifi_type", &self.ifi_type) .field("ifi_physical", &self.ifi_physical) @@ -2209,8 +2208,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for if_data { - fn hash(&self, state: &mut H) { + impl hash::Hash for if_data { + fn hash(&self, state: &mut H) { self.ifi_type.hash(state); self.ifi_physical.hash(state); self.ifi_addrlen.hash(state); @@ -2248,8 +2247,8 @@ cfg_if! { } } impl Eq for sctphdr {} - impl crate::fmt::Debug for sctphdr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctphdr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctphdr") .field("src_port", &{ self.src_port }) .field("dest_port", &{ self.dest_port }) @@ -2258,8 +2257,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sctphdr { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctphdr { + fn hash(&self, state: &mut H) { { self.src_port }.hash(state); { self.dest_port }.hash(state); { self.v_tag }.hash(state); @@ -2275,8 +2274,8 @@ cfg_if! { } } impl Eq for sctp_chunkhdr {} - impl crate::fmt::Debug for sctp_chunkhdr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_chunkhdr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_chunkhdr") .field("chunk_type", &{ self.chunk_type }) .field("chunk_flags", &{ self.chunk_flags }) @@ -2284,8 +2283,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sctp_chunkhdr { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_chunkhdr { + fn hash(&self, state: &mut H) { { self.chunk_type }.hash(state); { self.chunk_flags }.hash(state); { self.chunk_length }.hash(state); @@ -2300,16 +2299,16 @@ cfg_if! { } } impl Eq for sctp_paramhdr {} - impl crate::fmt::Debug for sctp_paramhdr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_paramhdr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_paramhdr") .field("param_type", &{ self.param_type }) .field("param_length", &{ self.param_length }) .finish() } } - impl crate::hash::Hash for sctp_paramhdr { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_paramhdr { + fn hash(&self, state: &mut H) { { self.param_type }.hash(state); { self.param_length }.hash(state); } @@ -2326,8 +2325,8 @@ cfg_if! { } } impl Eq for sctp_gen_error_cause {} - impl crate::fmt::Debug for sctp_gen_error_cause { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_gen_error_cause { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_gen_error_cause") .field("code", &{ self.code }) .field("length", &{ self.length }) @@ -2335,8 +2334,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sctp_gen_error_cause { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_gen_error_cause { + fn hash(&self, state: &mut H) { { self.code }.hash(state); { self.length }.hash(state); { self.info }.hash(state); @@ -2349,16 +2348,16 @@ cfg_if! { } } impl Eq for sctp_error_cause {} - impl crate::fmt::Debug for sctp_error_cause { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_cause { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_cause") .field("code", &{ self.code }) .field("length", &{ self.length }) .finish() } } - impl crate::hash::Hash for sctp_error_cause { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_cause { + fn hash(&self, state: &mut H) { { self.code }.hash(state); { self.length }.hash(state); } @@ -2372,16 +2371,16 @@ cfg_if! { } } impl Eq for sctp_error_invalid_stream {} - impl crate::fmt::Debug for sctp_error_invalid_stream { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_invalid_stream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_invalid_stream") .field("cause", &{ self.cause }) .field("stream_id", &{ self.stream_id }) .finish() } } - impl crate::hash::Hash for sctp_error_invalid_stream { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_invalid_stream { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.stream_id }.hash(state); } @@ -2398,8 +2397,8 @@ cfg_if! { } } impl Eq for sctp_error_missing_param {} - impl crate::fmt::Debug for sctp_error_missing_param { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_missing_param { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_missing_param") .field("cause", &{ self.cause }) .field("num_missing_params", &{ self.num_missing_params }) @@ -2407,8 +2406,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sctp_error_missing_param { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_missing_param { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.num_missing_params }.hash(state); { self.tpe }.hash(state); @@ -2423,16 +2422,16 @@ cfg_if! { } } impl Eq for sctp_error_stale_cookie {} - impl crate::fmt::Debug for sctp_error_stale_cookie { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_stale_cookie { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_stale_cookie") .field("cause", &{ self.cause }) .field("stale_time", &{ self.stale_time }) .finish() } } - impl crate::hash::Hash for sctp_error_stale_cookie { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_stale_cookie { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.stale_time }.hash(state); } @@ -2444,15 +2443,15 @@ cfg_if! { } } impl Eq for sctp_error_out_of_resource {} - impl crate::fmt::Debug for sctp_error_out_of_resource { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_out_of_resource { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_out_of_resource") .field("cause", &{ self.cause }) .finish() } } - impl crate::hash::Hash for sctp_error_out_of_resource { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_out_of_resource { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); } } @@ -2463,15 +2462,15 @@ cfg_if! { } } impl Eq for sctp_error_unresolv_addr {} - impl crate::fmt::Debug for sctp_error_unresolv_addr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_unresolv_addr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_unresolv_addr") .field("cause", &{ self.cause }) .finish() } } - impl crate::hash::Hash for sctp_error_unresolv_addr { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_unresolv_addr { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); } } @@ -2482,16 +2481,16 @@ cfg_if! { } } impl Eq for sctp_error_unrecognized_chunk {} - impl crate::fmt::Debug for sctp_error_unrecognized_chunk { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_unrecognized_chunk { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_unrecognized_chunk") .field("cause", &{ self.cause }) .field("ch", &{ self.ch }) .finish() } } - impl crate::hash::Hash for sctp_error_unrecognized_chunk { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_unrecognized_chunk { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.ch }.hash(state); } @@ -2503,16 +2502,16 @@ cfg_if! { } } impl Eq for sctp_error_no_user_data {} - impl crate::fmt::Debug for sctp_error_no_user_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_no_user_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_no_user_data") .field("cause", &{ self.cause }) .field("tsn", &{ self.tsn }) .finish() } } - impl crate::hash::Hash for sctp_error_no_user_data { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_no_user_data { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.tsn }.hash(state); } @@ -2524,16 +2523,16 @@ cfg_if! { } } impl Eq for sctp_error_auth_invalid_hmac {} - impl crate::fmt::Debug for sctp_error_auth_invalid_hmac { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sctp_error_auth_invalid_hmac { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sctp_error_invalid_hmac") .field("cause", &{ self.cause }) .field("hmac_id", &{ self.hmac_id }) .finish() } } - impl crate::hash::Hash for sctp_error_auth_invalid_hmac { - fn hash(&self, state: &mut H) { + impl hash::Hash for sctp_error_auth_invalid_hmac { + fn hash(&self, state: &mut H) { { self.cause }.hash(state); { self.hmac_id }.hash(state); } @@ -2557,8 +2556,8 @@ cfg_if! { } } impl Eq for kinfo_file {} - impl crate::fmt::Debug for kinfo_file { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for kinfo_file { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("kinfo_file") .field("kf_structsize", &self.kf_structsize) .field("kf_type", &self.kf_type) @@ -2572,8 +2571,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for kinfo_file { - fn hash(&self, state: &mut H) { + impl hash::Hash for kinfo_file { + fn hash(&self, state: &mut H) { self.kf_structsize.hash(state); self.kf_type.hash(state); self.kf_fd.hash(state); @@ -2586,8 +2585,8 @@ cfg_if! { } } - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_sigmask", &self.uc_sigmask) .field("uc_mcontext", &self.uc_mcontext) @@ -4912,20 +4911,19 @@ const_fn! { f! { pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - _ALIGN(crate::mem::size_of::()) as c_uint + length + _ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { if cmsg.is_null() { return crate::CMSG_FIRSTHDR(mhdr); }; - let next = cmsg as usize - + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(crate::mem::size_of::()); + let next = + cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { 0 as *mut cmsghdr @@ -4935,7 +4933,7 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (_ALIGN(crate::mem::size_of::()) + _ALIGN(length as usize)) as c_uint + (_ALIGN(mem::size_of::()) + _ALIGN(length as usize)) as c_uint } pub fn MALLOCX_ALIGN(lg: c_uint) -> c_int { @@ -4952,7 +4950,7 @@ f! { pub fn SOCKCREDSIZE(ngrps: usize) -> usize { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; - crate::mem::size_of::() + crate::mem::size_of::() * ngrps + mem::size_of::() + mem::size_of::() * ngrps } pub fn uname(buf: *mut crate::utsname) -> c_int { @@ -4972,29 +4970,29 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = 8 * crate::mem::size_of::(); + let bitset_bits = 8 * mem::size_of::(); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = 8 * crate::mem::size_of::(); + let bitset_bits = 8 * mem::size_of::(); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpuset_t) -> bool { - let bitset_bits = 8 * crate::mem::size_of::(); + let bitset_bits = 8 * mem::size_of::(); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); 0 != cpuset.__bits[idx] & (1 << offset) } pub fn CPU_COUNT(cpuset: &cpuset_t) -> c_int { let mut s: u32 = 0; - let cpuset_size = crate::mem::size_of::(); - let bitset_size = crate::mem::size_of::(); + let cpuset_size = mem::size_of::(); + let bitset_size = mem::size_of::(); for i in cpuset.__bits[..(cpuset_size / bitset_size)].iter() { s += i.count_ones(); @@ -5004,7 +5002,7 @@ f! { pub fn SOCKCRED2SIZE(ngrps: usize) -> usize { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; - crate::mem::size_of::() + crate::mem::size_of::() * ngrps + mem::size_of::() + mem::size_of::() * ngrps } pub fn PROT_MAX(x: c_int) -> c_int { diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs index beec2dfae9679..0bd678c9821b6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs @@ -1,4 +1,4 @@ -use crate::{c_int, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i32; @@ -40,8 +40,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_vers", &self.mc_vers) .field("mc_flags", &self.mc_flags) @@ -55,8 +55,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_vers.hash(state); self.mc_flags.hash(state); self.mc_onstack.hash(state); @@ -71,7 +71,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index 5f9ed7a5c2d95..e1548a2fa4a09 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i64; @@ -40,8 +40,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_vers", &self.mc_vers) .field("mc_flags", &self.mc_flags) @@ -55,8 +55,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_vers.hash(state); self.mc_flags.hash(state); self.mc_onstack.hash(state); @@ -71,7 +71,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index 5864a88d7d616..e425411436d2b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i64; @@ -54,8 +54,8 @@ cfg_if! { } } impl Eq for gpregs {} - impl crate::fmt::Debug for gpregs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for gpregs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("gpregs") .field("gp_ra", &self.gp_ra) .field("gp_sp", &self.gp_sp) @@ -69,8 +69,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for gpregs { - fn hash(&self, state: &mut H) { + impl hash::Hash for gpregs { + fn hash(&self, state: &mut H) { self.gp_ra.hash(state); self.gp_sp.hash(state); self.gp_gp.hash(state); @@ -91,8 +91,8 @@ cfg_if! { } } impl Eq for fpregs {} - impl crate::fmt::Debug for fpregs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpregs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpregs") .field("fp_x", &self.fp_x) .field("fp_fcsr", &self.fp_fcsr) @@ -101,8 +101,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fpregs { - fn hash(&self, state: &mut H) { + impl hash::Hash for fpregs { + fn hash(&self, state: &mut H) { self.fp_x.hash(state); self.fp_fcsr.hash(state); self.fp_flags.hash(state); @@ -123,8 +123,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_gpregs", &self.mc_gpregs) .field("mc_fpregs", &self.mc_fpregs) @@ -134,8 +134,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_gpregs.hash(state); self.mc_fpregs.hash(state); self.mc_flags.hash(state); @@ -146,7 +146,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 40c3b25b1375e..5af53cd76f665 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -1,4 +1,4 @@ -use crate::{c_int, size_t}; +use crate::prelude::*; pub type c_char = i8; pub type c_long = i32; @@ -90,8 +90,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_onstack", &self.mc_onstack) .field("mc_gs", &self.mc_gs) @@ -126,8 +126,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_onstack.hash(state); self.mc_gs.hash(state); self.mc_fs.hash(state); @@ -163,7 +163,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const MINSIGSTKSZ: size_t = 2048; // 512 * 4 diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index 912b5f39b6d80..b3ed7684154a9 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_void, size_t}; +use crate::prelude::*; pub type c_char = i8; pub type c_long = i64; @@ -159,8 +159,8 @@ cfg_if! { } } impl Eq for fpreg32 {} - impl crate::fmt::Debug for fpreg32 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpreg32 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpreg32") .field("fpr_env", &&self.fpr_env[..]) .field("fpr_acc", &self.fpr_acc) @@ -169,8 +169,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fpreg32 { - fn hash(&self, state: &mut H) { + impl hash::Hash for fpreg32 { + fn hash(&self, state: &mut H) { self.fpr_env.hash(state); self.fpr_acc.hash(state); self.fpr_ex_sw.hash(state); @@ -187,8 +187,8 @@ cfg_if! { } } impl Eq for fpreg {} - impl crate::fmt::Debug for fpreg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpreg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpreg") .field("fpr_env", &self.fpr_env) .field("fpr_acc", &self.fpr_acc) @@ -197,8 +197,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fpreg { - fn hash(&self, state: &mut H) { + impl hash::Hash for fpreg { + fn hash(&self, state: &mut H) { self.fpr_env.hash(state); self.fpr_acc.hash(state); self.fpr_xacc.hash(state); @@ -219,8 +219,8 @@ cfg_if! { } } impl Eq for xmmreg {} - impl crate::fmt::Debug for xmmreg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for xmmreg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("xmmreg") .field("xmm_env", &self.xmm_env) .field("xmm_acc", &self.xmm_acc) @@ -229,8 +229,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for xmmreg { - fn hash(&self, state: &mut H) { + impl hash::Hash for xmmreg { + fn hash(&self, state: &mut H) { self.xmm_env.hash(state); self.xmm_acc.hash(state); self.xmm_reg.hash(state); @@ -248,8 +248,8 @@ cfg_if! { } } impl Eq for __c_anonymous_elf64_auxv_union {} - impl crate::fmt::Debug for __c_anonymous_elf64_auxv_union { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_elf64_auxv_union { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("a_val") .field("a_val", unsafe { &self.a_val }) .finish() @@ -261,8 +261,8 @@ cfg_if! { } } impl Eq for Elf64_Auxinfo {} - impl crate::fmt::Debug for Elf64_Auxinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for Elf64_Auxinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Elf64_Auxinfo") .field("a_type", &self.a_type) .field("a_un", &self.a_un) @@ -317,8 +317,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("mc_onstack", &self.mc_onstack) .field("mc_rdi", &self.mc_rdi) @@ -361,8 +361,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.mc_onstack.hash(state); self.mc_rdi.hash(state); self.mc_rsi.hash(state); @@ -406,7 +406,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index fcedc565e3655..3c62e7d5e8271 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_double, c_int, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, off_t, size_t, - ssize_t, -}; +use crate::off_t; +use crate::prelude::*; pub type mode_t = u16; pub type pthread_attr_t = *mut c_void; @@ -413,8 +411,8 @@ cfg_if! { } } impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -424,8 +422,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); self.__ss_pad1.hash(state); @@ -437,7 +435,7 @@ cfg_if! { } // Non-public helper constant -const SIZEOF_LONG: usize = crate::mem::size_of::(); +const SIZEOF_LONG: usize = mem::size_of::(); #[deprecated( since = "0.2.64", diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 0ce8fd9d1dd92..d8e52f5f74245 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_double, c_int, c_short, c_uint, c_ushort, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type off_t = i64; pub type useconds_t = u32; @@ -180,8 +180,8 @@ cfg_if! { impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) @@ -190,8 +190,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_len.hash(state); self.sun_family.hash(state); self.sun_path.hash(state); @@ -229,8 +229,8 @@ cfg_if! { impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -241,8 +241,8 @@ cfg_if! { } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); @@ -595,7 +595,7 @@ pub const RTAX_BRD: c_int = 7; f! { pub fn CMSG_FIRSTHDR(mhdr: *const crate::msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { core::ptr::null_mut() @@ -603,20 +603,20 @@ f! { } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 6cd40777468db..7e5fa2ca87ef5 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_short, c_uint, c_ushort, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; pub type wchar_t = i32; pub type time_t = i64; diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index b74f57636ffe8..8ed84021e895e 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_uchar, c_uint, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; @@ -53,8 +54,8 @@ cfg_if! { } } impl Eq for __c_anonymous__freg {} - impl crate::fmt::Debug for __c_anonymous__freg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous__freg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous__freg") .field("__b8", &self.__b8) @@ -66,8 +67,8 @@ cfg_if! { } } } - impl crate::hash::Hash for __c_anonymous__freg { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous__freg { + fn hash(&self, state: &mut H) { unsafe { self.__b8.hash(state); self.__h16.hash(state); @@ -80,7 +81,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/arm.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs index aff875801e89c..1f54c8135bf47 100644 --- a/src/unix/bsd/netbsdlike/netbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -1,11 +1,12 @@ -use crate::{c_int, c_longlong, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; pub type __cpu_simple_lock_nv_t = c_int; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: c_int = PT_FIRSTMACH + 2; diff --git a/src/unix/bsd/netbsdlike/netbsd/mips.rs b/src/unix/bsd/netbsdlike/netbsd/mips.rs index 089154cd2a40a..7129c0f54eb6f 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mips.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mips.rs @@ -1,11 +1,12 @@ -use crate::{c_int, c_longlong, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; pub type __cpu_simple_lock_nv_t = c_int; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: c_int = PT_FIRSTMACH + 2; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 6efb197cb6431..9af0efc40f97d 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_int, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, cmsghdr, intptr_t, off_t, - size_t, ssize_t, -}; +use crate::prelude::*; +use crate::{cmsghdr, off_t}; pub type clock_t = c_uint; pub type suseconds_t = c_int; @@ -941,8 +939,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_name", &self.ut_name) .field("ut_id", &self.ut_id) @@ -959,8 +957,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_name.hash(state); self.ut_type.hash(state); self.ut_pid.hash(state); @@ -990,8 +988,8 @@ cfg_if! { impl Eq for lastlogx {} - impl crate::fmt::Debug for lastlogx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for lastlogx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("lastlogx") .field("ll_tv", &self.ll_tv) .field("ll_line", &self.ll_line) @@ -1001,8 +999,8 @@ cfg_if! { } } - impl crate::hash::Hash for lastlogx { - fn hash(&self, state: &mut H) { + impl hash::Hash for lastlogx { + fn hash(&self, state: &mut H) { self.ll_tv.hash(state); self.ll_line.hash(state); self.ll_host.hash(state); @@ -1016,16 +1014,16 @@ cfg_if! { } } impl Eq for in_pktinfo {} - impl crate::fmt::Debug for in_pktinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for in_pktinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("in_pktinfo") .field("ipi_addr", &self.ipi_addr) .field("ipi_ifindex", &self.ipi_ifindex) .finish() } } - impl crate::hash::Hash for in_pktinfo { - fn hash(&self, state: &mut H) { + impl hash::Hash for in_pktinfo { + fn hash(&self, state: &mut H) { self.ipi_addr.hash(state); self.ipi_ifindex.hash(state); } @@ -1041,8 +1039,8 @@ cfg_if! { } } impl Eq for arphdr {} - impl crate::fmt::Debug for arphdr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for arphdr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let ar_hrd = self.ar_hrd; let ar_pro = self.ar_pro; let ar_op = self.ar_op; @@ -1055,8 +1053,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for arphdr { - fn hash(&self, state: &mut H) { + impl hash::Hash for arphdr { + fn hash(&self, state: &mut H) { let ar_hrd = self.ar_hrd; let ar_pro = self.ar_pro; let ar_op = self.ar_op; @@ -1074,14 +1072,14 @@ cfg_if! { } } impl Eq for in_addr {} - impl crate::fmt::Debug for in_addr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for in_addr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let s_addr = self.s_addr; f.debug_struct("in_addr").field("s_addr", &s_addr).finish() } } - impl crate::hash::Hash for in_addr { - fn hash(&self, state: &mut H) { + impl hash::Hash for in_addr { + fn hash(&self, state: &mut H) { let s_addr = self.s_addr; s_addr.hash(state); } @@ -1094,16 +1092,16 @@ cfg_if! { } } impl Eq for ip_mreq {} - impl crate::fmt::Debug for ip_mreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ip_mreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ip_mreq") .field("imr_multiaddr", &self.imr_multiaddr) .field("imr_interface", &self.imr_interface) .finish() } } - impl crate::hash::Hash for ip_mreq { - fn hash(&self, state: &mut H) { + impl hash::Hash for ip_mreq { + fn hash(&self, state: &mut H) { self.imr_multiaddr.hash(state); self.imr_interface.hash(state); } @@ -1119,8 +1117,8 @@ cfg_if! { } } impl Eq for sockaddr_in {} - impl crate::fmt::Debug for sockaddr_in { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_in { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_in") .field("sin_len", &self.sin_len) .field("sin_family", &self.sin_family) @@ -1130,8 +1128,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_in { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_in { + fn hash(&self, state: &mut H) { self.sin_len.hash(state); self.sin_family.hash(state); self.sin_port.hash(state); @@ -1154,8 +1152,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_reclen", &self.d_reclen) @@ -1165,8 +1163,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_reclen.hash(state); self.d_namlen.hash(state); @@ -1212,8 +1210,8 @@ cfg_if! { } } impl Eq for statvfs {} - impl crate::fmt::Debug for statvfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statvfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statvfs") .field("f_flag", &self.f_flag) .field("f_bsize", &self.f_bsize) @@ -1242,8 +1240,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for statvfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statvfs { + fn hash(&self, state: &mut H) { self.f_flag.hash(state); self.f_bsize.hash(state); self.f_frsize.hash(state); @@ -1285,8 +1283,8 @@ cfg_if! { } } impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -1296,8 +1294,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); self.__ss_pad1.hash(state); @@ -1315,8 +1313,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -1325,8 +1323,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -1342,8 +1340,8 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_posix_spawn_fae { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_posix_spawn_fae { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous_posix_fae") .field("open", &self.open) @@ -1353,8 +1351,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_posix_spawn_fae { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_posix_spawn_fae { + fn hash(&self, state: &mut H) { unsafe { self.open.hash(state); self.dup2.hash(state); @@ -1370,8 +1368,8 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous_ifc_ifcu") .field("ifcu_buf", &self.ifcu_buf) @@ -1381,8 +1379,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifc_ifcu { + fn hash(&self, state: &mut H) { unsafe { self.ifcu_buf.hash(state); self.ifcu_req.hash(state); @@ -2440,20 +2438,19 @@ const_fn! { f! { pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - _ALIGN(crate::mem::size_of::()) as c_uint + length + _ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { if cmsg.is_null() { return crate::CMSG_FIRSTHDR(mhdr); }; - let next = cmsg as usize - + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(crate::mem::size_of::()); + let next = + cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { 0 as *mut cmsghdr @@ -2463,7 +2460,7 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (_ALIGN(crate::mem::size_of::()) + _ALIGN(length as usize)) as c_uint + (_ALIGN(mem::size_of::()) + _ALIGN(length as usize)) as c_uint } // dirfd() is a macro on netbsd to access @@ -2475,7 +2472,7 @@ f! { pub fn SOCKCREDSIZE(ngrps: usize) -> usize { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; - crate::mem::size_of::() + crate::mem::size_of::() * ngrps + mem::size_of::() + mem::size_of::() * ngrps } pub fn PROT_MPROTECT(x: c_int) -> c_int { diff --git a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs index 1d74f171aa01c..a086396ed610a 100644 --- a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs +++ b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -1,11 +1,12 @@ -use crate::{c_double, c_int, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; pub type __cpu_simple_lock_nv_t = c_int; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_STEP: c_int = PT_FIRSTMACH + 0; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index 0eddbc0bea115..b5e72084d5aa1 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,6 +1,6 @@ use PT_FIRSTMACH; -use crate::{c_double, c_int}; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; @@ -26,7 +26,7 @@ s_no_extra_traits! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs index ff0320a9a81da..d564f58a3e688 100644 --- a/src/unix/bsd/netbsdlike/netbsd/sparc64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs @@ -1,4 +1,4 @@ -use crate::c_uchar; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86.rs b/src/unix/bsd/netbsdlike/netbsd/x86.rs index db21dc326cc53..3c55792defcbd 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -1,8 +1,8 @@ -use crate::{c_int, c_uchar}; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; pub type __cpu_simple_lock_nv_t = c_uchar; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index 28829ee11ea83..f968e36d67aa2 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_uchar, c_uint, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; @@ -22,7 +23,7 @@ s! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const PT_STEP: c_int = PT_FIRSTMACH + 0; pub const PT_GETREGS: c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/openbsd/aarch64.rs b/src/unix/bsd/netbsdlike/openbsd/aarch64.rs index 02f3f1bc61577..bf704757c59d6 100644 --- a/src/unix/bsd/netbsdlike/openbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/aarch64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; @@ -18,6 +18,6 @@ s! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/arm.rs b/src/unix/bsd/netbsdlike/openbsd/arm.rs index e781fa7484ac1..1e66ed247a2eb 100644 --- a/src/unix/bsd/netbsdlike/openbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/openbsd/arm.rs @@ -1,9 +1,9 @@ -use crate::c_double; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index eded05a7bdb9b..515b3ba9d05f4 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1,7 +1,6 @@ +use crate::prelude::*; use crate::unix::bsd::O_SYNC; -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ushort, c_void, cmsghdr, off_t, size_t, -}; +use crate::{cmsghdr, off_t}; pub type clock_t = i64; pub type suseconds_t = c_long; @@ -774,8 +773,8 @@ cfg_if! { impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_fileno", &self.d_fileno) .field("d_off", &self.d_off) @@ -787,8 +786,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_fileno.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -806,8 +805,8 @@ cfg_if! { impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -815,8 +814,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); } @@ -833,8 +832,8 @@ cfg_if! { impl Eq for siginfo_t {} - impl crate::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("siginfo_t") .field("si_signo", &self.si_signo) .field("si_code", &self.si_code) @@ -844,8 +843,8 @@ cfg_if! { } } - impl crate::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { self.si_signo.hash(state); self.si_code.hash(state); self.si_errno.hash(state); @@ -871,8 +870,8 @@ cfg_if! { impl Eq for lastlog {} - impl crate::fmt::Debug for lastlog { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for lastlog { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("lastlog") .field("ll_time", &self.ll_time) // FIXME: .field("ll_line", &self.ll_line) @@ -881,8 +880,8 @@ cfg_if! { } } - impl crate::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { + impl hash::Hash for lastlog { + fn hash(&self, state: &mut H) { self.ll_time.hash(state); self.ll_line.hash(state); self.ll_host.hash(state); @@ -912,8 +911,8 @@ cfg_if! { impl Eq for utmp {} - impl crate::fmt::Debug for utmp { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmp { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmp") // FIXME: .field("ut_line", &self.ut_line) // FIXME: .field("ut_name", &self.ut_name) @@ -923,8 +922,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmp { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmp { + fn hash(&self, state: &mut H) { self.ut_line.hash(state); self.ut_name.hash(state); self.ut_host.hash(state); @@ -945,16 +944,16 @@ cfg_if! { impl Eq for mount_info {} - impl crate::fmt::Debug for mount_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mount_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mount_info") // FIXME: .field("align", &self.align) .finish() } } - impl crate::hash::Hash for mount_info { - fn hash(&self, state: &mut H) { + impl hash::Hash for mount_info { + fn hash(&self, state: &mut H) { unsafe { self.align.hash(state) }; } } @@ -977,8 +976,8 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru {} - impl crate::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_ifr_ifru") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -993,8 +992,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ifr_ifru { + fn hash(&self, state: &mut H) { unsafe { self.ifru_addr.hash(state); self.ifru_dstaddr.hash(state); @@ -1054,8 +1053,8 @@ cfg_if! { impl Eq for statfs {} - impl crate::fmt::Debug for statfs { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for statfs { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("statfs") .field("f_flags", &self.f_flags) .field("f_bsize", &self.f_bsize) @@ -1083,8 +1082,8 @@ cfg_if! { } } - impl crate::hash::Hash for statfs { - fn hash(&self, state: &mut H) { + impl hash::Hash for statfs { + fn hash(&self, state: &mut H) { self.f_flags.hash(state); self.f_bsize.hash(state); self.f_iosize.hash(state); @@ -1741,7 +1740,7 @@ pub const NTFS_MFLAG_ALLNAMES: c_int = 0x2; pub const TMPFS_ARGS_VERSION: c_int = 1; const SI_MAXSZ: size_t = 128; -const SI_PAD: size_t = (SI_MAXSZ / crate::mem::size_of::()) - 3; +const SI_PAD: size_t = (SI_MAXSZ / mem::size_of::()) - 3; pub const MAP_STACK: c_int = 0x4000; pub const MAP_CONCEAL: c_int = 0x8000; @@ -1967,20 +1966,19 @@ const_fn! { f! { pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - _ALIGN(crate::mem::size_of::()) as c_uint + length + _ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { if cmsg.is_null() { return crate::CMSG_FIRSTHDR(mhdr); }; - let next = cmsg as usize - + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(crate::mem::size_of::()); + let next = + cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { 0 as *mut cmsghdr @@ -1990,7 +1988,7 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (_ALIGN(crate::mem::size_of::()) + _ALIGN(length as usize)) as c_uint + (_ALIGN(mem::size_of::()) + _ALIGN(length as usize)) as c_uint } pub fn major(dev: crate::dev_t) -> c_uint { diff --git a/src/unix/bsd/netbsdlike/openbsd/powerpc.rs b/src/unix/bsd/netbsdlike/openbsd/powerpc.rs index e781fa7484ac1..1e66ed247a2eb 100644 --- a/src/unix/bsd/netbsdlike/openbsd/powerpc.rs +++ b/src/unix/bsd/netbsdlike/openbsd/powerpc.rs @@ -1,9 +1,9 @@ -use crate::c_double; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs b/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs index 7aec9eb638772..cb808719fb8ea 100644 --- a/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs @@ -1,7 +1,9 @@ +use crate::prelude::*; + pub type c_long = i64; pub type c_ulong = u64; pub type c_char = u8; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/riscv64.rs b/src/unix/bsd/netbsdlike/openbsd/riscv64.rs index baaab22337c39..6a39f3494dd14 100644 --- a/src/unix/bsd/netbsdlike/openbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/riscv64.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; @@ -23,6 +23,6 @@ s! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/x86.rs b/src/unix/bsd/netbsdlike/openbsd/x86.rs index bad2eddc84b48..4b495d0c16de8 100644 --- a/src/unix/bsd/netbsdlike/openbsd/x86.rs +++ b/src/unix/bsd/netbsdlike/openbsd/x86.rs @@ -1,9 +1,9 @@ -use crate::c_int; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs index d75b20f8fcebb..4380c1d118922 100644 --- a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, PT_FIRSTMACH}; +use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; @@ -83,8 +84,8 @@ cfg_if! { } } impl Eq for fxsave64 {} - impl crate::fmt::Debug for fxsave64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fxsave64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fxsave64") .field("fx_fcw", &{ self.fx_fcw }) .field("fx_fsw", &{ self.fx_fsw }) @@ -99,8 +100,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fxsave64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for fxsave64 { + fn hash(&self, state: &mut H) { { self.fx_fcw }.hash(state); { self.fx_fsw }.hash(state); { self.fx_ftw }.hash(state); @@ -116,7 +117,7 @@ cfg_if! { } } -pub(crate) const _ALIGNBYTES: usize = crate::mem::size_of::() - 1; +pub(crate) const _ALIGNBYTES: usize = mem::size_of::() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 9bee01185f6a0..78477a10bfc51 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1,6 +1,4 @@ -use crate::{ - c_double, c_int, c_short, c_uchar, c_uint, c_ushort, c_void, intptr_t, size_t, ssize_t, -}; +use crate::prelude::*; pub type rlim_t = crate::uintptr_t; pub type sa_family_t = u8; @@ -521,8 +519,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_type", &self.ut_type) .field("ut_tv", &self.ut_tv) @@ -536,8 +534,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); self.ut_tv.hash(state); self.ut_id.hash(state); @@ -560,8 +558,8 @@ cfg_if! { } } impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) @@ -569,8 +567,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_len.hash(state); self.sun_family.hash(state); self.sun_path.hash(state); @@ -595,8 +593,8 @@ cfg_if! { } } impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -606,8 +604,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); self.__ss_pad1.hash(state); @@ -631,8 +629,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_dev", &self.d_dev) .field("d_pdev", &self.d_pdev) @@ -643,8 +641,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_dev.hash(state); self.d_pdev.hash(state); self.d_ino.hash(state); @@ -663,8 +661,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -673,8 +671,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -1566,13 +1564,13 @@ pub const POSIX_SPAWN_SETSID: c_int = 0x40; const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { - len + crate::mem::size_of::() - 1 & !(crate::mem::size_of::() - 1) + len + mem::size_of::() - 1 & !(mem::size_of::() - 1) } } f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -1580,15 +1578,15 @@ f! { } pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(CMSG_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(CMSG_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(crate::mem::size_of::())) as c_uint + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::())) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - CMSG_ALIGN(crate::mem::size_of::()) as c_uint + length + CMSG_ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { @@ -1597,7 +1595,7 @@ f! { }; let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize) - + CMSG_ALIGN(crate::mem::size_of::()); + + CMSG_ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { 0 as *mut cmsghdr @@ -1608,20 +1606,20 @@ f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 4d51a38e97f41..84ca0e146294b 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -1,4 +1,5 @@ -use crate::{c_char, c_double, c_int, c_uint, c_ulong, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; // This module contains bindings to the native Haiku API. The Haiku API // originates from BeOS, and it was the original way to perform low level @@ -500,8 +501,8 @@ cfg_if! { } } impl Eq for cpuid_info {} - impl crate::fmt::Debug for cpuid_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for cpuid_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("cpuid_info") .field("eax_0", &self.eax_0) @@ -525,8 +526,8 @@ cfg_if! { } } impl Eq for __c_anonymous_cpu_topology_info_data {} - impl crate::fmt::Debug for __c_anonymous_cpu_topology_info_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_cpu_topology_info_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous_cpu_topology_info_data") .field("root", &self.root) @@ -544,8 +545,8 @@ cfg_if! { } impl Eq for cpu_topology_node_info {} - impl crate::fmt::Debug for cpu_topology_node_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for cpu_topology_node_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("cpu_topology_node_info") .field("id", &self.id) .field("type", &self.type_) diff --git a/src/unix/haiku/x86_64.rs b/src/unix/haiku/x86_64.rs index 0b6f03b6daf6d..e77588df59f4f 100644 --- a/src/unix/haiku/x86_64.rs +++ b/src/unix/haiku/x86_64.rs @@ -1,4 +1,4 @@ -use crate::{c_uchar, c_uint, c_ulong, c_ushort}; +use crate::prelude::*; s_no_extra_traits! { pub struct fpu_state { @@ -83,8 +83,8 @@ cfg_if! { } } impl Eq for fpu_state {} - impl crate::fmt::Debug for fpu_state { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpu_state { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpu_state") .field("control", &self.control) .field("status", &self.status) @@ -100,8 +100,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for fpu_state { - fn hash(&self, state: &mut H) { + impl hash::Hash for fpu_state { + fn hash(&self, state: &mut H) { self.control.hash(state); self.status.hash(state); self.tag.hash(state); @@ -128,8 +128,8 @@ cfg_if! { } } impl Eq for xstate_hdr {} - impl crate::fmt::Debug for xstate_hdr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for xstate_hdr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("xstate_hdr") .field("bv", &self.bv) .field("xcomp_bv", &self.xcomp_bv) @@ -137,8 +137,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for xstate_hdr { - fn hash(&self, state: &mut H) { + impl hash::Hash for xstate_hdr { + fn hash(&self, state: &mut H) { self.bv.hash(state); self.xcomp_bv.hash(state); self._reserved.hash(state); @@ -157,8 +157,8 @@ cfg_if! { } } impl Eq for savefpu {} - impl crate::fmt::Debug for savefpu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for savefpu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("savefpu") .field("fp_fxsave", &self.fp_fxsave) .field("fp_xstate", &self.fp_xstate) @@ -166,8 +166,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for savefpu { - fn hash(&self, state: &mut H) { + impl hash::Hash for savefpu { + fn hash(&self, state: &mut H) { self.fp_fxsave.hash(state); self.fp_xstate.hash(state); self._fp_ymm.hash(state); @@ -198,8 +198,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("rax", &self.rax) .field("rbx", &self.rbx) @@ -223,8 +223,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.rax.hash(state); self.rbx.hash(state); self.rcx.hash(state); @@ -256,8 +256,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_link", &self.uc_link) .field("uc_sigmask", &self.uc_sigmask) @@ -266,8 +266,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_link.hash(state); self.uc_sigmask.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs index d98b97268fbb1..5223d549dd025 100644 --- a/src/unix/hurd/b32.rs +++ b/src/unix/hurd/b32.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, c_uchar, c_uint, c_ulonglong, c_ushort}; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; diff --git a/src/unix/hurd/b64.rs b/src/unix/hurd/b64.rs index 41ba87ae59bf3..1954c27f88563 100644 --- a/src/unix/hurd/b64.rs +++ b/src/unix/hurd/b64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_uchar, c_uint}; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index c6720e5534841..1a04a725ada56 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -1,9 +1,7 @@ #![allow(dead_code)] -use crate::{ - c_double, c_int, c_schar, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, intptr_t, - size_t, ssize_t, -}; +use crate::c_schar; +use crate::prelude::*; // types pub type c_char = i8; @@ -1088,8 +1086,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_type", &self.ut_type) .field("ut_pid", &self.ut_pid) @@ -1106,8 +1104,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); self.ut_pid.hash(state); self.ut_line.hash(state); @@ -3438,14 +3436,14 @@ const _UTSNAME_LENGTH: usize = 1024; const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { - len + crate::mem::size_of::() - 1 & !(crate::mem::size_of::() - 1) + len + mem::size_of::() - 1 & !(mem::size_of::() - 1) } } // functions f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -3457,15 +3455,15 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(crate::mem::size_of::())) as c_uint + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::())) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - CMSG_ALIGN(crate::mem::size_of::()) as c_uint + length + CMSG_ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < crate::mem::size_of::() { + if ((*cmsg).cmsg_len as usize) < mem::size_of::() { return 0 as *mut cmsghdr; }; let next = (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr; @@ -3480,8 +3478,8 @@ f! { } pub fn CPU_ALLOC_SIZE(count: c_int) -> size_t { - let _dummy: cpu_set_t = crate::mem::zeroed(); - let size_in_bits = 8 * crate::mem::size_of_val(&_dummy.bits[0]); + let _dummy: cpu_set_t = mem::zeroed(); + let size_in_bits = 8 * mem::size_of_val(&_dummy.bits[0]); ((count as size_t + size_in_bits - 1) / 8) as size_t } @@ -3492,28 +3490,28 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; - let size_of_mask = crate::mem::size_of_val(&cpuset.bits[0]); + let size_of_mask = mem::size_of_val(&cpuset.bits[0]); for i in cpuset.bits[..(size / size_of_mask)].iter() { s += i.count_ones(); } @@ -3521,7 +3519,7 @@ f! { } pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int { - CPU_COUNT_S(crate::mem::size_of::(), cpuset) + CPU_COUNT_S(mem::size_of::(), cpuset) } pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { @@ -3546,20 +3544,20 @@ f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index c9bf6c8bee3dc..8a3b02dcc4022 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_long, c_longlong, c_ulong}; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = u32; @@ -66,16 +66,16 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask_with_padding {} - impl crate::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_uc_sigmask_with_padding { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uc_sigmask_with_padding") .field("uc_sigmask_with_padding", &self.uc_sigmask) // Ignore padding .finish() } } - impl crate::hash::Hash for __c_anonymous_uc_sigmask_with_padding { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_uc_sigmask_with_padding { + fn hash(&self, state: &mut H) { self.uc_sigmask.hash(state) // Ignore padding } @@ -87,15 +87,15 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl crate::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uc_sigmask") .field("uc_sigmask", unsafe { &self.uc_sigmask }) .finish() } } - impl crate::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } } } @@ -112,8 +112,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -128,8 +128,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index 8ef7a917007a1..3e3485757ce98 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, size_t}; +use crate::prelude::*; // The following definitions are correct for arm and i686, // but may be wrong for mips @@ -185,8 +185,8 @@ s_no_extra_traits! { cfg_if! { if #[cfg(feature = "extra_traits")] { - impl crate::fmt::Debug for sigset64_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigset64_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigset64_t") .field("__bits", &self.__bits) .finish() diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index a456ad6a4a34b..8421f389ed9c8 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_long, c_ulong}; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -68,16 +68,16 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask_with_padding {} - impl crate::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_uc_sigmask_with_padding { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uc_sigmask_with_padding") .field("uc_sigmask_with_padding", &self.uc_sigmask) // Ignore padding .finish() } } - impl crate::hash::Hash for __c_anonymous_uc_sigmask_with_padding { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_uc_sigmask_with_padding { + fn hash(&self, state: &mut H) { self.uc_sigmask.hash(state) // Ignore padding } @@ -89,15 +89,15 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl crate::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uc_sigmask") .field("uc_sigmask", unsafe { &self.uc_sigmask }) .finish() } } - impl crate::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } } } @@ -113,8 +113,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -128,8 +128,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index aceb52c0722d6..39d8bc07c4dd5 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = u32; diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index 73390421602d1..ffa79ead870e8 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_uint, c_ulonglong, c_ushort, c_void, size_t}; +use crate::prelude::*; // The following definitions are correct for aarch64 and x86_64, // but may be wrong for mips64 @@ -157,8 +157,8 @@ cfg_if! { impl Eq for pthread_mutex_t {} - impl crate::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_mutex_t") .field("value", &self.value) // FIXME: .field("__reserved", &self.__reserved) @@ -166,8 +166,8 @@ cfg_if! { } } - impl crate::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { self.value.hash(state); self.__reserved.hash(state); } @@ -186,8 +186,8 @@ cfg_if! { impl Eq for pthread_cond_t {} - impl crate::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") .field("value", &self.value) // FIXME: .field("__reserved", &self.__reserved) @@ -195,8 +195,8 @@ cfg_if! { } } - impl crate::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { self.value.hash(state); self.__reserved.hash(state); } @@ -219,8 +219,8 @@ cfg_if! { impl Eq for pthread_rwlock_t {} - impl crate::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") .field("numLocks", &self.numLocks) .field("writerThreadId", &self.writerThreadId) @@ -232,8 +232,8 @@ cfg_if! { } } - impl crate::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { self.numLocks.hash(state); self.writerThreadId.hash(state); self.pendingReaders.hash(state); @@ -243,8 +243,8 @@ cfg_if! { } } - impl crate::fmt::Debug for sigset64_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigset64_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigset64_t") .field("__bits", &self.__bits) .finish() diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index 8fff9a6793335..f214fe33702a4 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = u32; diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 609def88b2d97..2118b926af9cb 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong, c_ushort, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -127,15 +128,15 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl crate::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uc_sigmask") .field("uc_sigmask", unsafe { &self.uc_sigmask }) .finish() } } - impl crate::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } } } @@ -202,8 +203,8 @@ cfg_if! { } } impl Eq for _libc_fpxreg {} - impl crate::fmt::Debug for _libc_fpxreg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for _libc_fpxreg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("_libc_fpxreg") .field("significand", &self.significand) .field("exponent", &self.exponent) @@ -211,8 +212,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for _libc_fpxreg { - fn hash(&self, state: &mut H) { + impl hash::Hash for _libc_fpxreg { + fn hash(&self, state: &mut H) { self.significand.hash(state); self.exponent.hash(state); // Ignore padding field @@ -235,8 +236,8 @@ cfg_if! { } } impl Eq for _libc_fpstate {} - impl crate::fmt::Debug for _libc_fpstate { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for _libc_fpstate { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("_libc_fpstate") .field("cwd", &self.cwd) .field("swd", &self.swd) @@ -252,8 +253,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for _libc_fpstate { - fn hash(&self, state: &mut H) { + impl hash::Hash for _libc_fpstate { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.swd.hash(state); self.ftw.hash(state); @@ -275,8 +276,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("gregs", &self.gregs) .field("fpregs", &self.fpregs) @@ -284,8 +285,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { self.gregs.hash(state); self.fpregs.hash(state); // Ignore padding field @@ -303,8 +304,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -315,8 +316,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); @@ -348,8 +349,8 @@ cfg_if! { impl Eq for user_fpregs_struct {} - impl crate::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for user_fpregs_struct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("user_fpregs_struct") .field("cwd", &self.cwd) .field("swd", &self.swd) @@ -366,8 +367,8 @@ cfg_if! { } } - impl crate::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { + impl hash::Hash for user_fpregs_struct { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.swd.hash(state); self.ftw.hash(state); diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 8c3c488cbcc82..8f477be82c941 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1,8 +1,6 @@ //! Android-specific definitions for linux-like values -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, size_t, ssize_t, -}; +use crate::prelude::*; pub type clock_t = c_long; pub type time_t = c_long; @@ -661,8 +659,8 @@ cfg_if! { } } impl Eq for sockaddr_nl {} - impl crate::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_nl") .field("nl_family", &self.nl_family) .field("nl_pid", &self.nl_pid) @@ -670,8 +668,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { self.nl_family.hash(state); self.nl_pid.hash(state); self.nl_groups.hash(state); @@ -694,8 +692,8 @@ cfg_if! { impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -706,8 +704,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -732,8 +730,8 @@ cfg_if! { impl Eq for dirent64 {} - impl crate::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent64") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -744,8 +742,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -766,8 +764,8 @@ cfg_if! { impl Eq for siginfo_t {} - impl crate::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("siginfo_t") .field("si_signo", &self.si_signo) .field("si_errno", &self.si_errno) @@ -778,8 +776,8 @@ cfg_if! { } } - impl crate::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { self.si_signo.hash(state); self.si_errno.hash(state); self.si_code.hash(state); @@ -806,8 +804,8 @@ cfg_if! { impl Eq for lastlog {} - impl crate::fmt::Debug for lastlog { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for lastlog { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("lastlog") .field("ll_time", &self.ll_time) .field("ll_line", &self.ll_line) @@ -816,8 +814,8 @@ cfg_if! { } } - impl crate::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { + impl hash::Hash for lastlog { + fn hash(&self, state: &mut H) { self.ll_time.hash(state); self.ll_line.hash(state); self.ll_host.hash(state); @@ -854,8 +852,8 @@ cfg_if! { impl Eq for utmp {} - impl crate::fmt::Debug for utmp { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmp { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmp") .field("ut_type", &self.ut_type) .field("ut_pid", &self.ut_pid) @@ -872,8 +870,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmp { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmp { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); self.ut_pid.hash(state); self.ut_line.hash(state); @@ -908,8 +906,8 @@ cfg_if! { impl Eq for sockaddr_alg {} - impl crate::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_alg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_alg") .field("salg_family", &self.salg_family) .field("salg_type", &self.salg_type) @@ -920,8 +918,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_alg { + fn hash(&self, state: &mut H) { self.salg_family.hash(state); self.salg_type.hash(state); self.salg_feat.hash(state); @@ -939,8 +937,8 @@ cfg_if! { } impl Eq for uinput_setup {} - impl crate::fmt::Debug for uinput_setup { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for uinput_setup { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uinput_setup") .field("id", &self.id) .field("name", &&self.name[..]) @@ -949,8 +947,8 @@ cfg_if! { } } - impl crate::hash::Hash for uinput_setup { - fn hash(&self, state: &mut H) { + impl hash::Hash for uinput_setup { + fn hash(&self, state: &mut H) { self.id.hash(state); self.name.hash(state); self.ff_effects_max.hash(state); @@ -970,8 +968,8 @@ cfg_if! { } impl Eq for uinput_user_dev {} - impl crate::fmt::Debug for uinput_user_dev { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for uinput_user_dev { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uinput_setup") .field("name", &&self.name[..]) .field("id", &self.id) @@ -984,8 +982,8 @@ cfg_if! { } } - impl crate::hash::Hash for uinput_user_dev { - fn hash(&self, state: &mut H) { + impl hash::Hash for uinput_user_dev { + fn hash(&self, state: &mut H) { self.name.hash(state); self.id.hash(state); self.ff_effects_max.hash(state); @@ -996,8 +994,8 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifr_ifru") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -1015,8 +1013,8 @@ cfg_if! { .finish() } } - impl crate::fmt::Debug for ifreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") .field("ifr_name", &self.ifr_name) .field("ifr_ifru", &self.ifr_ifru) @@ -1024,16 +1022,16 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifr_ifru") .field("ifcu_buf", unsafe { &self.ifcu_buf }) .field("ifcu_req", unsafe { &self.ifcu_req }) .finish() } } - impl crate::fmt::Debug for ifconf { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifconf { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifconf") .field("ifc_len", &self.ifc_len) .field("ifc_ifcu", &self.ifc_ifcu) @@ -1059,8 +1057,8 @@ cfg_if! { impl Eq for af_alg_iv {} #[allow(deprecated)] - impl crate::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for af_alg_iv { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("af_alg_iv") .field("ivlen", &self.ivlen) .finish() @@ -1068,8 +1066,8 @@ cfg_if! { } #[allow(deprecated)] - impl crate::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { + impl hash::Hash for af_alg_iv { + fn hash(&self, state: &mut H) { self.as_slice().hash(state); } } @@ -1082,8 +1080,8 @@ cfg_if! { } } impl Eq for prop_info {} - impl crate::fmt::Debug for prop_info { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for prop_info { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("prop_info") .field("__name", &self.__name) .field("__serial", &self.__serial) @@ -3620,8 +3618,8 @@ f! { } pub fn CPU_ALLOC_SIZE(count: c_int) -> size_t { - let _dummy: cpu_set_t = crate::mem::zeroed(); - let size_in_bits = 8 * crate::mem::size_of_val(&_dummy.__bits[0]); + let _dummy: cpu_set_t = mem::zeroed(); + let size_in_bits = 8 * mem::size_of_val(&_dummy.__bits[0]); ((count as size_t + size_in_bits - 1) / 8) as size_t } @@ -3632,28 +3630,28 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.__bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.__bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.__bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.__bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.__bits[0]); + let size_in_bits = 8 * mem::size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.__bits[idx] & (1 << offset)) } pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; - let size_of_mask = crate::mem::size_of_val(&cpuset.__bits[0]); + let size_of_mask = mem::size_of_val(&cpuset.__bits[0]); for i in cpuset.__bits[..(size / size_of_mask)].iter() { s += i.count_ones(); } @@ -3661,7 +3659,7 @@ f! { } pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int { - CPU_COUNT_S(crate::mem::size_of::(), cpuset) + CPU_COUNT_S(mem::size_of::(), cpuset) } pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { diff --git a/src/unix/linux_like/emscripten/lfs64.rs b/src/unix/linux_like/emscripten/lfs64.rs index 70d10dba393b1..06be875446bb6 100644 --- a/src/unix/linux_like/emscripten/lfs64.rs +++ b/src/unix/linux_like/emscripten/lfs64.rs @@ -1,4 +1,5 @@ -use crate::{c_char, c_int, c_void, off64_t, size_t, ssize_t}; +use crate::off64_t; +use crate::prelude::*; // In-sync with ../linux/musl/lfs64.rs except for fallocate64, prlimit64 and sendfile64 diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 32d19da2e2a49..866a20cd00722 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_double, c_int, c_short, c_uchar, c_uint, c_ushort, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -406,8 +406,8 @@ cfg_if! { } } impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -417,8 +417,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -450,8 +450,8 @@ cfg_if! { } } impl Eq for sysinfo {} - impl crate::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sysinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sysinfo") .field("uptime", &self.uptime) .field("loads", &self.loads) @@ -470,8 +470,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { + impl hash::Hash for sysinfo { + fn hash(&self, state: &mut H) { self.uptime.hash(state); self.loads.hash(state); self.totalram.hash(state); @@ -498,8 +498,8 @@ cfg_if! { } } impl Eq for mq_attr {} - impl crate::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mq_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mq_attr") .field("mq_flags", &self.mq_flags) .field("mq_maxmsg", &self.mq_maxmsg) @@ -508,8 +508,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { self.mq_flags.hash(state); self.mq_maxmsg.hash(state); self.mq_msgsize.hash(state); @@ -523,15 +523,15 @@ cfg_if! { } } impl Eq for pthread_cond_t {} - impl crate::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1414,7 +1414,7 @@ pub const SOMAXCONN: c_int = 128; f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < crate::mem::size_of::() { + if ((*cmsg).cmsg_len as usize) < mem::size_of::() { return 0 as *mut cmsghdr; }; let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr; @@ -1433,21 +1433,21 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 3e7d3a1117d52..10953fe789df3 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, Ioctl}; +use crate::prelude::*; +use crate::Ioctl; s! { pub struct termios2 { @@ -126,8 +127,8 @@ cfg_if! { target_arch = "csky", target_arch = "loongarch64" ))] { - pub const FICLONE: crate::c_ulong = 0x40049409; - pub const FICLONERANGE: crate::c_ulong = 0x4020940D; + pub const FICLONE: c_ulong = 0x40049409; + pub const FICLONERANGE: c_ulong = 0x4020940D; } } diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 52469befdccc0..950ad5f118dfb 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_ulong, Ioctl}; +use crate::prelude::*; +use crate::Ioctl; s! { pub struct termios2 { diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 2c856061d3391..de39df0d8323a 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_ulong, Ioctl}; +use crate::prelude::*; +use crate::Ioctl; // arch/powerpc/include/uapi/asm/socket.h diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index 40454fde34f5d..829307aa71039 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, Ioctl}; +use crate::prelude::*; +use crate::Ioctl; s! { pub struct termios2 { diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index f318b4ad9223f..f3869723996cb 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = u32; @@ -242,8 +243,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_link) .field("uc_link", &self.uc_link) @@ -253,8 +254,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs index 7677f10571912..eb6f70d8fed07 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = u32; diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 2dc51bb4b9fe7..3d252c6253035 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 19fe9b23d4ade..73da7739dabf5 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs index c4550e183de19..adb36cc169fef 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -1,6 +1,7 @@ //! 32-bit specific definitions for linux-like values -use crate::{c_int, c_longlong, c_uint, c_ulonglong, c_ushort, c_void, pthread_mutex_t, size_t}; +use crate::prelude::*; +use crate::pthread_mutex_t; pub type c_long = i32; pub type c_ulong = u32; @@ -49,7 +50,7 @@ s! { pub st_dev: c_ulong, #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad1: crate::c_short, + __pad1: c_short, #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] st_pad1: [c_long; 3], pub st_ino: crate::ino_t, @@ -62,7 +63,7 @@ s! { #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] pub st_rdev: c_ulong, #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad2: crate::c_short, + __pad2: c_short, #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] st_pad2: [c_long; 2], pub st_size: off_t, diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/linux_like/linux/gnu/b32/powerpc.rs index e2e5088bb390d..75ec2385a1230 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index 2b86d5eacc8fd..4ab40c628a1eb 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -1,8 +1,7 @@ //! RISC-V-specific definitions for 32-bit linux-like values -use crate::{ - c_int, c_long, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, off64_t, off_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = c_int; diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index d14309f45a8ed..cfe62018f5fdd 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -1,8 +1,7 @@ //! SPARC-specific definitions for 32-bit linux-like values -use crate::{ - c_int, c_long, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, off64_t, off_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index 7e7de0ce2dfaf..d626236dda792 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = i32; @@ -296,8 +297,8 @@ cfg_if! { impl Eq for user_fpxregs_struct {} - impl crate::fmt::Debug for user_fpxregs_struct { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for user_fpxregs_struct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("user_fpxregs_struct") .field("cwd", &self.cwd) .field("swd", &self.swd) @@ -316,8 +317,8 @@ cfg_if! { } } - impl crate::hash::Hash for user_fpxregs_struct { - fn hash(&self, state: &mut H) { + impl hash::Hash for user_fpxregs_struct { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.swd.hash(state); self.twd.hash(state); @@ -347,8 +348,8 @@ cfg_if! { impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -360,8 +361,8 @@ cfg_if! { } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index a12614e8f8c71..27ba5263c5361 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -1,8 +1,7 @@ //! AArch64-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, off_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = u32; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 5e4d3f0a2837e..8c05659dc09a7 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -1,7 +1,5 @@ -use crate::{ - c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, off_t, - pthread_mutex_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t, pthread_mutex_t}; pub type c_char = i8; pub type c_long = i64; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index 1f82bb18aec34..2d85df1385a10 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_short, c_uint, c_ushort, c_void, off64_t, off_t, pthread_mutex_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t, pthread_mutex_t}; pub type blksize_t = i64; pub type c_char = i8; diff --git a/src/unix/linux_like/linux/gnu/b64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mod.rs index 6d2927a465241..fde7a5c6c3602 100644 --- a/src/unix/linux_like/linux/gnu/b64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mod.rs @@ -1,6 +1,6 @@ //! 64-bit specific definitions for linux-like values -use crate::{c_int, c_uint, c_ushort}; +use crate::prelude::*; pub type ino_t = u64; pub type off_t = i64; @@ -12,7 +12,7 @@ pub type fsblkcnt_t = u64; pub type fsfilcnt_t = u64; pub type rlim_t = u64; #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] -pub type __syscall_ulong_t = crate::c_ulonglong; +pub type __syscall_ulong_t = c_ulonglong; #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub type __syscall_ulong_t = c_ulong; diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index 3cfdf2fa8a88d..86d047dbf3878 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -1,6 +1,7 @@ //! PowerPC64-specific definitions for 64-bit linux-like values -use crate::{c_int, c_short, c_uint, c_void, off64_t, off_t, pthread_mutex_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t, pthread_mutex_t}; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index 27c96dca3d8bc..6eaa3cda10fcf 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -1,8 +1,7 @@ //! RISC-V-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, off_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type c_long = i64; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index 210db71ae84b6..95dacc9f91cbd 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -1,8 +1,7 @@ //! s390x -use crate::{ - c_double, c_int, c_short, c_uint, c_ushort, c_void, off64_t, off_t, pthread_mutex_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t, pthread_mutex_t}; pub type blksize_t = i64; pub type c_char = u8; @@ -231,15 +230,15 @@ cfg_if! { impl Eq for fpreg_t {} - impl crate::fmt::Debug for fpreg_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpreg_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpreg_t").field("d", &self.d).finish() } } - impl crate::hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = unsafe { crate::mem::transmute(self.d) }; + impl hash::Hash for fpreg_t { + fn hash(&self, state: &mut H) { + let d: u64 = unsafe { mem::transmute(self.d) }; d.hash(state); } } diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 8dd7b85032beb..5626cd3e46933 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -1,9 +1,7 @@ //! SPARC64-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, off_t, - pthread_mutex_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t, pthread_mutex_t}; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 98838accea1b8..0d9971252391b 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -1,8 +1,7 @@ //! x86_64-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, off_t, size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = i32; @@ -348,8 +347,8 @@ cfg_if! { impl Eq for user_fpregs_struct {} - impl crate::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for user_fpregs_struct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("user_fpregs_struct") .field("cwd", &self.cwd) .field("ftw", &self.ftw) @@ -365,8 +364,8 @@ cfg_if! { } } - impl crate::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { + impl hash::Hash for user_fpregs_struct { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.ftw.hash(state); self.fop.hash(state); @@ -393,8 +392,8 @@ cfg_if! { impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -406,8 +405,8 @@ cfg_if! { } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs index 19e28e91f5b33..5e7d6e5da5523 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_void, pthread_mutex_t, size_t}; +use crate::prelude::*; +use crate::pthread_mutex_t; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs index 74a4581b0bda4..eafb5246c9edc 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs @@ -1,4 +1,5 @@ -use crate::{c_int, pthread_mutex_t}; +use crate::prelude::*; +use crate::pthread_mutex_t; pub type c_long = i32; pub type c_ulong = u32; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 7e909d86a0d1e..948ec35f36b0d 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, off64_t, size_t, ssize_t, -}; +use crate::off64_t; +use crate::prelude::*; pub type pthread_t = c_ulong; pub type __priority_which_t = c_uint; @@ -654,8 +653,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_type", &self.ut_type) .field("ut_pid", &self.ut_pid) @@ -672,8 +671,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); self.ut_pid.hash(state); self.ut_line.hash(state); @@ -700,8 +699,8 @@ cfg_if! { impl Eq for __c_anonymous_ptrace_syscall_info_data {} - impl crate::fmt::Debug for __c_anonymous_ptrace_syscall_info_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ptrace_syscall_info_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous_ptrace_syscall_info_data") .field("entry", &self.entry) @@ -712,8 +711,8 @@ cfg_if! { } } - impl crate::hash::Hash for __c_anonymous_ptrace_syscall_info_data { - fn hash(&self, state: &mut H) { + impl hash::Hash for __c_anonymous_ptrace_syscall_info_data { + fn hash(&self, state: &mut H) { unsafe { self.entry.hash(state); self.exit.hash(state); diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 43b9d725ecb3a..b942641542713 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -2,9 +2,7 @@ use core::mem::size_of; -use crate::{ - c_double, c_int, c_longlong, c_short, c_uchar, c_uint, c_ushort, c_void, size_t, ssize_t, -}; +use crate::prelude::*; pub type useconds_t = u32; pub type dev_t = u64; @@ -478,9 +476,9 @@ s! { // will probably need including here. tsidea, skrap // QNX (NTO) platform does not define these fields #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] - pub dlpi_adds: crate::c_ulonglong, + pub dlpi_adds: c_ulonglong, #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] - pub dlpi_subs: crate::c_ulonglong, + pub dlpi_subs: c_ulonglong, #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_tls_modid: size_t, #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] @@ -1716,8 +1714,8 @@ cfg_if! { } } impl Eq for sockaddr_nl {} - impl crate::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_nl") .field("nl_family", &self.nl_family) .field("nl_pid", &self.nl_pid) @@ -1725,8 +1723,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { self.nl_family.hash(state); self.nl_pid.hash(state); self.nl_groups.hash(state); @@ -1749,8 +1747,8 @@ cfg_if! { impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -1761,8 +1759,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -1787,8 +1785,8 @@ cfg_if! { impl Eq for dirent64 {} - impl crate::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent64") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -1799,8 +1797,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -1817,16 +1815,16 @@ cfg_if! { impl Eq for pthread_cond_t {} - impl crate::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1839,16 +1837,16 @@ cfg_if! { impl Eq for pthread_mutex_t {} - impl crate::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_mutex_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1861,16 +1859,16 @@ cfg_if! { impl Eq for pthread_rwlock_t {} - impl crate::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") // FIXME: .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1883,16 +1881,16 @@ cfg_if! { impl Eq for pthread_barrier_t {} - impl crate::fmt::Debug for pthread_barrier_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_barrier_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_barrier_t") .field("size", &self.size) .finish() } } - impl crate::hash::Hash for pthread_barrier_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pthread_barrier_t { + fn hash(&self, state: &mut H) { self.size.hash(state); } } @@ -1917,8 +1915,8 @@ cfg_if! { impl Eq for sockaddr_alg {} - impl crate::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_alg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_alg") .field("salg_family", &self.salg_family) .field("salg_type", &self.salg_type) @@ -1929,8 +1927,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_alg { + fn hash(&self, state: &mut H) { self.salg_family.hash(state); self.salg_type.hash(state); self.salg_feat.hash(state); @@ -1948,8 +1946,8 @@ cfg_if! { } impl Eq for uinput_setup {} - impl crate::fmt::Debug for uinput_setup { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for uinput_setup { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uinput_setup") .field("id", &self.id) .field("name", &&self.name[..]) @@ -1958,8 +1956,8 @@ cfg_if! { } } - impl crate::hash::Hash for uinput_setup { - fn hash(&self, state: &mut H) { + impl hash::Hash for uinput_setup { + fn hash(&self, state: &mut H) { self.id.hash(state); self.name.hash(state); self.ff_effects_max.hash(state); @@ -1979,8 +1977,8 @@ cfg_if! { } impl Eq for uinput_user_dev {} - impl crate::fmt::Debug for uinput_user_dev { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for uinput_user_dev { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("uinput_setup") .field("name", &&self.name[..]) .field("id", &self.id) @@ -1993,8 +1991,8 @@ cfg_if! { } } - impl crate::hash::Hash for uinput_user_dev { - fn hash(&self, state: &mut H) { + impl hash::Hash for uinput_user_dev { + fn hash(&self, state: &mut H) { self.name.hash(state); self.id.hash(state); self.ff_effects_max.hash(state); @@ -2023,8 +2021,8 @@ cfg_if! { impl Eq for af_alg_iv {} #[allow(deprecated)] - impl crate::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for af_alg_iv { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("af_alg_iv") .field("ivlen", &self.ivlen) .finish() @@ -2032,8 +2030,8 @@ cfg_if! { } #[allow(deprecated)] - impl crate::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { + impl hash::Hash for af_alg_iv { + fn hash(&self, state: &mut H) { self.as_slice().hash(state); } } @@ -2047,8 +2045,8 @@ cfg_if! { } } impl Eq for mq_attr {} - impl crate::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mq_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mq_attr") .field("mq_flags", &self.mq_flags) .field("mq_maxmsg", &self.mq_maxmsg) @@ -2057,16 +2055,16 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { self.mq_flags.hash(state); self.mq_maxmsg.hash(state); self.mq_msgsize.hash(state); self.mq_curmsgs.hash(state); } } - impl crate::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifr_ifru") .field("ifru_addr", unsafe { &self.ifru_addr }) .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) @@ -2084,8 +2082,8 @@ cfg_if! { .finish() } } - impl crate::fmt::Debug for ifreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") .field("ifr_name", &self.ifr_name) .field("ifr_ifru", &self.ifr_ifru) @@ -2093,24 +2091,24 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifr_ifru") .field("ifcu_buf", unsafe { &self.ifcu_buf }) .field("ifcu_req", unsafe { &self.ifcu_req }) .finish() } } - impl crate::fmt::Debug for ifconf { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ifconf { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifconf") .field("ifc_len", &self.ifc_len) .field("ifc_ifcu", &self.ifc_ifcu) .finish() } } - impl crate::fmt::Debug for hwtstamp_config { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for hwtstamp_config { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("hwtstamp_config") .field("flags", &self.flags) .field("tx_type", &self.tx_type) @@ -2126,16 +2124,16 @@ cfg_if! { } } impl Eq for hwtstamp_config {} - impl crate::hash::Hash for hwtstamp_config { - fn hash(&self, state: &mut H) { + impl hash::Hash for hwtstamp_config { + fn hash(&self, state: &mut H) { self.flags.hash(state); self.tx_type.hash(state); self.rx_filter.hash(state); } } - impl crate::fmt::Debug for sched_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sched_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sched_attr") .field("size", &self.size) .field("sched_policy", &self.sched_policy) @@ -2161,8 +2159,8 @@ cfg_if! { } } impl Eq for sched_attr {} - impl crate::hash::Hash for sched_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for sched_attr { + fn hash(&self, state: &mut H) { self.size.hash(state); self.sched_policy.hash(state); self.sched_flags.hash(state); @@ -2174,8 +2172,8 @@ cfg_if! { } } - impl crate::fmt::Debug for iwreq_data { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for iwreq_data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("iwreq_data") .field("name", unsafe { &self.name }) .field("essid", unsafe { &self.essid }) @@ -2199,8 +2197,8 @@ cfg_if! { } } - impl crate::fmt::Debug for iw_event { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for iw_event { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("iw_event") .field("len", &self.len) .field("cmd", &self.cmd) @@ -2209,16 +2207,16 @@ cfg_if! { } } - impl crate::fmt::Debug for __c_anonymous_iwreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_iwreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("__c_anonymous_iwreq") .field("ifrn_name", unsafe { &self.ifrn_name }) .finish() } } - impl crate::fmt::Debug for iwreq { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for iwreq { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("iwreq") .field("ifr_ifrn", &self.ifr_ifrn) .field("u", &self.u) @@ -5838,8 +5836,8 @@ f! { } pub fn CPU_ALLOC_SIZE(count: c_int) -> size_t { - let _dummy: cpu_set_t = crate::mem::zeroed(); - let size_in_bits = 8 * crate::mem::size_of_val(&_dummy.bits[0]); + let _dummy: cpu_set_t = mem::zeroed(); + let size_in_bits = 8 * mem::size_of_val(&_dummy.bits[0]); ((count as size_t + size_in_bits - 1) / 8) as size_t } @@ -5850,28 +5848,28 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * crate::mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; - let size_of_mask = crate::mem::size_of_val(&cpuset.bits[0]); + let size_of_mask = mem::size_of_val(&cpuset.bits[0]); for i in cpuset.bits[..(size / size_of_mask)].iter() { s += i.count_ones(); } diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index 789a35548d702..3116837322b60 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ulonglong, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = u32; @@ -154,8 +155,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_link) .field("uc_link", &self.uc_link) @@ -165,8 +166,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index 720464b79f441..9becabd146f8d 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = u32; diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index af64d4d462324..aacdc44579496 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_ulong, c_void, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = c_int; diff --git a/src/unix/linux_like/linux/musl/b32/mod.rs b/src/unix/linux_like/linux/musl/b32/mod.rs index 37f9c3ab2c24a..4a62ef1906ffb 100644 --- a/src/unix/linux_like/linux/musl/b32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, c_ulonglong, c_void}; +use crate::prelude::*; pub type c_long = i32; pub type c_ulong = u32; diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index 2fff41545ee56..29e797959123d 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 46de7219dbf8b..ff5839c64bc42 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -1,6 +1,7 @@ //! RISC-V-specific definitions for 32-bit linux-like values -use crate::{c_int, c_long, c_short, c_ulong, c_ushort, c_void, off64_t, off_t, size_t}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = c_int; diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index 6c68c3406cbe2..476bacdb6b88d 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -159,8 +160,8 @@ cfg_if! { impl Eq for user_fpxregs_struct {} - impl crate::fmt::Debug for user_fpxregs_struct { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for user_fpxregs_struct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("user_fpxregs_struct") .field("cwd", &self.cwd) .field("swd", &self.swd) @@ -179,8 +180,8 @@ cfg_if! { } } - impl crate::hash::Hash for user_fpxregs_struct { - fn hash(&self, state: &mut H) { + impl hash::Hash for user_fpxregs_struct { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.swd.hash(state); self.twd.hash(state); @@ -214,8 +215,8 @@ cfg_if! { impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -227,8 +228,8 @@ cfg_if! { } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 7c5ecc6a2453e..c660ec5c3453f 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, off_t, size_t, -}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type __u64 = c_ulonglong; diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs index 1de3fdb123ac6..1be59ada9aad5 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -1,9 +1,7 @@ //! LoongArch-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, off64_t, off_t, - size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = i8; pub type wchar_t = c_int; diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs index b3f660931c44f..09191a5f8275c 100644 --- a/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_uint, c_ulong, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index eaab68d565399..50d862f570426 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_uint, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type c_long = i64; pub type c_ulong = u64; diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs index 13d2fbb690e74..3753293c8e0cf 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_long, c_short, c_ulong, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = i32; diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index 53ae3d64c25b9..729e873668873 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -1,9 +1,7 @@ //! RISC-V-specific definitions for 64-bit linux-like values -use crate::{ - c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, off64_t, off_t, - size_t, -}; +use crate::prelude::*; +use crate::{off64_t, off_t}; pub type c_char = u8; pub type wchar_t = c_int; diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index ad8ba3bb26e18..22a6cec4185f0 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -1,4 +1,5 @@ -use crate::{c_double, c_int, c_long, c_short, off_t, size_t}; +use crate::off_t; +use crate::prelude::*; pub type blksize_t = i64; pub type c_char = u8; @@ -80,15 +81,15 @@ cfg_if! { impl Eq for fpreg_t {} - impl crate::fmt::Debug for fpreg_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpreg_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpreg_t").field("d", &self.d).finish() } } - impl crate::hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = unsafe { crate::mem::transmute(self.d) }; + impl hash::Hash for fpreg_t { + fn hash(&self, state: &mut H) { + let d: u64 = unsafe { mem::transmute(self.d) }; d.hash(state); } } diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index 62ce8aadc7443..6399f33209ac2 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, off_t, size_t, -}; +use crate::off_t; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -196,8 +195,8 @@ cfg_if! { impl Eq for user_fpregs_struct {} - impl crate::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for user_fpregs_struct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("user_fpregs_struct") .field("cwd", &self.cwd) .field("ftw", &self.ftw) @@ -213,8 +212,8 @@ cfg_if! { } } - impl crate::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { + impl hash::Hash for user_fpregs_struct { + fn hash(&self, state: &mut H) { self.cwd.hash(state); self.ftw.hash(state); self.fop.hash(state); @@ -245,8 +244,8 @@ cfg_if! { impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) @@ -258,8 +257,8 @@ cfg_if! { } } - impl crate::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { self.uc_flags.hash(state); self.uc_link.hash(state); self.uc_stack.hash(state); diff --git a/src/unix/linux_like/linux/musl/lfs64.rs b/src/unix/linux_like/linux/musl/lfs64.rs index 582e20a45545e..e6506fd3d385d 100644 --- a/src/unix/linux_like/linux/musl/lfs64.rs +++ b/src/unix/linux_like/linux/musl/lfs64.rs @@ -1,4 +1,5 @@ -use crate::{c_char, c_int, c_void, off64_t, size_t, ssize_t}; +use crate::off64_t; +use crate::prelude::*; #[inline] pub unsafe extern "C" fn creat64(path: *const c_char, mode: crate::mode_t) -> c_int { diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 9e16736564f68..4d31996d9c96e 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -1,6 +1,5 @@ -use crate::{ - c_int, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, off64_t, size_t, ssize_t, -}; +use crate::off64_t; +use crate::prelude::*; pub type pthread_t = *mut c_void; pub type clock_t = c_long; @@ -593,8 +592,8 @@ cfg_if! { impl Eq for sysinfo {} - impl crate::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sysinfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sysinfo") .field("uptime", &self.uptime) .field("loads", &self.loads) @@ -614,8 +613,8 @@ cfg_if! { } } - impl crate::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { + impl hash::Hash for sysinfo { + fn hash(&self, state: &mut H) { self.uptime.hash(state); self.loads.hash(state); self.totalram.hash(state); @@ -657,8 +656,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_type", &self.ut_type) //.field("__ut_pad1", &self.__ut_pad1) @@ -677,8 +676,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_type.hash(state); //self.__ut_pad1.hash(state); self.ut_pid.hash(state); diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs index 5991d4651c1bb..da3203f98a3de 100644 --- a/src/unix/linux_like/linux/uclibc/arm/mod.rs +++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = c_uint; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs index dced826fc9130..6118928312b91 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_longlong, c_short, c_uint, c_ulonglong, c_ushort, c_void, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type c_char = i8; pub type c_long = i32; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs index 4000ab147504c..86ee7bdff472b 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_uint, c_ushort, c_void, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type blkcnt_t = i64; pub type blksize_t = i64; diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs index 488a4a499d176..f1934c396773a 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short, c_uint, size_t}; +use crate::prelude::*; pub type pthread_t = c_ulong; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 95aed917fe400..7495f07878119 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void, off64_t, size_t, ssize_t}; +use crate::off64_t; +use crate::prelude::*; pub type shmatt_t = c_ulong; pub type msgqnum_t = c_ulong; diff --git a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs index cbf8c033d7414..7e1499a1fd8bd 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_uint, c_ulong, c_void, size_t}; +use crate::prelude::*; /// L4Re specifics /// This module contains definitions required by various L4Re libc backends. diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 9c2cf3fe25715..ce91914765581 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -1,6 +1,7 @@ //! Definitions for uclibc on 64bit systems -use crate::{c_int, c_uint, c_ushort, c_void, off64_t, size_t}; +use crate::off64_t; +use crate::prelude::*; pub type blkcnt_t = i64; pub type blksize_t = i64; diff --git a/src/unix/linux_like/linux/uclibc/x86_64/other.rs b/src/unix/linux_like/linux/uclibc/x86_64/other.rs index 7890d76f24b43..dc16d02c87977 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/other.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/other.rs @@ -1,4 +1,4 @@ -use crate::c_ulong; +use crate::prelude::*; // Thestyle checker discourages the use of #[cfg], so this has to go into a // separate module diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 3a4a181518165..ff8b63a9abaef 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void, intptr_t, size_t, ssize_t}; +use crate::prelude::*; pub type sa_family_t = u16; pub type speed_t = c_uint; @@ -308,8 +308,8 @@ cfg_if! { } } impl Eq for epoll_event {} - impl crate::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for epoll_event { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let events = self.events; let u64 = self.u64; f.debug_struct("epoll_event") @@ -318,8 +318,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { + impl hash::Hash for epoll_event { + fn hash(&self, state: &mut H) { let events = self.events; let u64 = self.u64; events.hash(state); @@ -338,16 +338,16 @@ cfg_if! { } } impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_family", &self.sun_family) // FIXME: .field("sun_path", &self.sun_path) .finish() } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_family.hash(state); self.sun_path.hash(state); } @@ -366,8 +366,8 @@ cfg_if! { impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_family", &self.ss_family) .field("__ss_align", &self.__ss_align) @@ -376,8 +376,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_family.hash(state); self.__ss_pad2.hash(state); } @@ -419,8 +419,8 @@ cfg_if! { impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -432,8 +432,8 @@ cfg_if! { } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); @@ -452,8 +452,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_value", &self.sigev_value) .field("sigev_signo", &self.sigev_signo) @@ -462,8 +462,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_value.hash(state); self.sigev_signo.hash(state); self.sigev_notify.hash(state); @@ -594,7 +594,7 @@ pub const XATTR_REPLACE: c_int = 0x2; cfg_if! { if #[cfg(target_os = "android")] { - pub const RLIM64_INFINITY: crate::c_ulonglong = !0; + pub const RLIM64_INFINITY: c_ulonglong = !0; } else { pub const RLIM64_INFINITY: crate::rlim64_t = !0; } @@ -1607,13 +1607,13 @@ cfg_if! { const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { - len + crate::mem::size_of::() - 1 & !(crate::mem::size_of::() - 1) + len + mem::size_of::() - 1 & !(mem::size_of::() - 1) } } f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -1625,29 +1625,29 @@ f! { } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(crate::mem::size_of::())) as c_uint + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::())) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - CMSG_ALIGN(crate::mem::size_of::()) as c_uint + length + CMSG_ALIGN(mem::size_of::()) as c_uint + length } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index fc0e561dca8e8..661405f50eb1d 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -3,7 +3,7 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -use crate::c_void; +use crate::prelude::*; pub type c_schar = i8; pub type c_uchar = u8; diff --git a/src/unix/newlib/aarch64/mod.rs b/src/unix/newlib/aarch64/mod.rs index 87952650e5d12..0aa1de7dcc828 100644 --- a/src/unix/newlib/aarch64/mod.rs +++ b/src/unix/newlib/aarch64/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short}; +use crate::prelude::*; pub type clock_t = c_long; pub type c_char = u8; diff --git a/src/unix/newlib/arm/mod.rs b/src/unix/newlib/arm/mod.rs index 558a70da6b79b..a32e37ede596a 100644 --- a/src/unix/newlib/arm/mod.rs +++ b/src/unix/newlib/arm/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short}; +use crate::prelude::*; pub type clock_t = c_long; pub type c_char = u8; diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index c33d6ba4bc05a..4e3898153357d 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short, c_uint, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type clock_t = c_ulong; pub type c_char = i8; diff --git a/src/unix/newlib/generic.rs b/src/unix/newlib/generic.rs index fe2216cee356a..ba4dfbe528b69 100644 --- a/src/unix/newlib/generic.rs +++ b/src/unix/newlib/generic.rs @@ -1,11 +1,12 @@ //! Common types used by most newlib platforms -use crate::{c_char, c_long, c_uchar, off_t}; +use crate::off_t; +use crate::prelude::*; s! { pub struct sigset_t { #[cfg(target_os = "horizon")] - __val: [crate::c_ulong; 16], + __val: [c_ulong; 16], #[cfg(not(target_os = "horizon"))] __val: u32, } diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs index 055e81fe70767..8c662f2a4517a 100644 --- a/src/unix/newlib/horizon/mod.rs +++ b/src/unix/newlib/horizon/mod.rs @@ -1,8 +1,7 @@ //! ARMv6K Nintendo 3DS C Newlib definitions -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ushort, c_void, off_t, size_t, ssize_t, -}; +use crate::off_t; +use crate::prelude::*; pub type c_char = u8; pub type c_long = i32; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index ff856f4845d05..ae118b4719a65 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_longlong, c_uint, c_ushort, c_void, size_t}; +use crate::prelude::*; pub type blkcnt_t = i32; pub type blksize_t = i32; @@ -7,11 +7,11 @@ pub type clockid_t = c_ulong; cfg_if! { if #[cfg(any(target_os = "espidf"))] { - pub type dev_t = crate::c_short; + pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_long; } else if #[cfg(any(target_os = "vita"))] { - pub type dev_t = crate::c_short; + pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_int; } else { @@ -253,7 +253,7 @@ s! { #[cfg(target_os = "espidf")] pub is_initialized: i32, #[cfg(target_os = "espidf")] - pub stackaddr: *mut crate::c_void, + pub stackaddr: *mut c_void, #[cfg(target_os = "espidf")] pub stacksize: i32, #[cfg(target_os = "espidf")] @@ -837,20 +837,20 @@ pub const PRIO_USER: c_int = 2; f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return; diff --git a/src/unix/newlib/powerpc/mod.rs b/src/unix/newlib/powerpc/mod.rs index 6b73b6fb39dea..6a9c42bdb7228 100644 --- a/src/unix/newlib/powerpc/mod.rs +++ b/src/unix/newlib/powerpc/mod.rs @@ -1,4 +1,4 @@ -use crate::c_int; +use crate::prelude::*; pub type clock_t = c_ulong; pub type c_char = u8; diff --git a/src/unix/newlib/rtems/mod.rs b/src/unix/newlib/rtems/mod.rs index cf390f9fa5eb0..f14967da0aad1 100644 --- a/src/unix/newlib/rtems/mod.rs +++ b/src/unix/newlib/rtems/mod.rs @@ -1,5 +1,6 @@ // defined in architecture specific module -use crate::{c_char, c_int, c_long, c_ulong, c_void, size_t, ssize_t}; + +use crate::prelude::*; s! { pub struct sockaddr_un { diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs index e9b12dd0914b8..120c4d54972f5 100644 --- a/src/unix/newlib/vita/mod.rs +++ b/src/unix/newlib/vita/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_int, c_short, c_void, off_t, size_t, ssize_t}; +use crate::off_t; +use crate::prelude::*; pub type clock_t = c_long; diff --git a/src/unix/nto/aarch64.rs b/src/unix/nto/aarch64.rs index 0e4694315c73b..d0987f28be6b2 100644 --- a/src/unix/nto/aarch64.rs +++ b/src/unix/nto/aarch64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_void, size_t}; +use crate::prelude::*; pub type c_char = u8; pub type wchar_t = u32; diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 85a3bfaf3d2c7..ad4b390d61c07 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type clock_t = u32; @@ -770,8 +770,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -780,8 +780,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -801,8 +801,8 @@ cfg_if! { } } impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) @@ -811,8 +811,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_len.hash(state); self.sun_family.hash(state); self.sun_path.hash(state); @@ -826,22 +826,22 @@ cfg_if! { } } impl Eq for sigset_t {} - impl crate::fmt::Debug for sigset_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigset_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigset_t") .field("__val", &self.__val) .finish() } } - impl crate::hash::Hash for sigset_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigset_t { + fn hash(&self, state: &mut H) { self.__val.hash(state); } } // msg - impl crate::fmt::Debug for msg { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for msg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("msg") .field("msg_next", &self.msg_next) .field("msg_type", &self.msg_type) @@ -852,8 +852,8 @@ cfg_if! { } // msqid_ds - impl crate::fmt::Debug for msqid_ds { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for msqid_ds { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("msqid_ds") .field("msg_perm", &self.msg_perm) .field("msg_first", &self.msg_first) @@ -870,8 +870,8 @@ cfg_if! { } // sockaddr_dl - impl crate::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_dl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_dl") .field("sdl_len", &self.sdl_len) .field("sdl_family", &self.sdl_family) @@ -901,8 +901,8 @@ cfg_if! { } } impl Eq for sockaddr_dl {} - impl crate::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_dl { + fn hash(&self, state: &mut H) { self.sdl_len.hash(state); self.sdl_family.hash(state); self.sdl_index.hash(state); @@ -915,8 +915,8 @@ cfg_if! { } // sync_t - impl crate::fmt::Debug for sync_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sync_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sync_t") .field("__owner", &self.__owner) .field("__u", &self.__u) @@ -925,8 +925,8 @@ cfg_if! { } // pthread_barrier_t - impl crate::fmt::Debug for pthread_barrier_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_barrier_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_barrier_t") .field("__pad", &self.__pad) .finish() @@ -934,8 +934,8 @@ cfg_if! { } // pthread_rwlock_t - impl crate::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") .field("__active", &self.__active) .field("__blockedwriters", &self.__blockedwriters) @@ -951,8 +951,8 @@ cfg_if! { } // syspage_entry - impl crate::fmt::Debug for syspage_entry { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for syspage_entry { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("syspage_entry") .field("size", &self.size) .field("total_size", &self.total_size) @@ -1012,8 +1012,8 @@ cfg_if! { impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -1024,8 +1024,8 @@ cfg_if! { } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); @@ -1048,8 +1048,8 @@ cfg_if! { impl Eq for mq_attr {} - impl crate::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mq_attr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mq_attr") .field("mq_maxmsg", &self.mq_maxmsg) .field("mq_msgsize", &self.mq_msgsize) @@ -1061,8 +1061,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { + impl hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { self.mq_maxmsg.hash(state); self.mq_msgsize.hash(state); self.mq_flags.hash(state); @@ -1088,8 +1088,8 @@ cfg_if! { impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -1100,8 +1100,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_len.hash(state); self.ss_family.hash(state); self.__ss_pad1.hash(state); @@ -1125,8 +1125,8 @@ cfg_if! { impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_offset", &self.d_offset) @@ -1137,8 +1137,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_offset.hash(state); self.d_reclen.hash(state); @@ -2379,7 +2379,7 @@ pub const BIOCSRTIMEOUT: c_int = -2146418067; pub const BIOCSSEESENT: c_int = -2147204487; pub const BIOCVERSION: c_int = 1074020977; -pub const BPF_ALIGNMENT: usize = crate::mem::size_of::(); +pub const BPF_ALIGNMENT: usize = mem::size_of::(); pub const CHAR_BIT: usize = 8; pub const CODESET: crate::nl_item = 1; pub const CRNCYSTR: crate::nl_item = 55; @@ -2580,7 +2580,7 @@ pub const SO_SETFIB: c_int = 0x100a; pub const SO_TXPRIO: c_int = 0x100b; pub const SO_USELOOPBACK: c_int = 0x0040; pub const SO_VLANPRIO: c_int = 0x100c; -pub const _SS_ALIGNSIZE: usize = crate::mem::size_of::(); +pub const _SS_ALIGNSIZE: usize = mem::size_of::(); pub const _SS_MAXSIZE: usize = 128; pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - 2; pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE; @@ -2710,7 +2710,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { const_fn! { {const} fn _CMSG_ALIGN(len: usize) -> usize { - len + crate::mem::size_of::() - 1 & !(crate::mem::size_of::() - 1) + len + mem::size_of::() - 1 & !(mem::size_of::() - 1) } {const} fn _ALIGN(p: usize, b: usize) -> usize { @@ -2720,7 +2720,7 @@ const_fn! { f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= crate::mem::size_of::() { + if (*mhdr).msg_controllen as usize >= mem::size_of::() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -2729,7 +2729,7 @@ f! { pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { let msg = _CMSG_ALIGN((*cmsg).cmsg_len as usize); - let next = cmsg as usize + msg + _CMSG_ALIGN(crate::mem::size_of::()); + let next = cmsg as usize + msg + _CMSG_ALIGN(mem::size_of::()); if next > (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize { 0 as *mut cmsghdr } else { @@ -2738,33 +2738,33 @@ f! { } pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - _CMSG_ALIGN(crate::mem::size_of::()) as c_uint + length + _CMSG_ALIGN(mem::size_of::()) as c_uint + length } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (_CMSG_ALIGN(crate::mem::size_of::()) + _CMSG_ALIGN(length as usize)) as c_uint + (_CMSG_ALIGN(mem::size_of::()) + _CMSG_ALIGN(length as usize)) as c_uint } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } @@ -2783,7 +2783,7 @@ f! { } pub fn _DEXTRA_VALID(_x: *const crate::dirent_extra, _d: *const dirent) -> bool { - let sz = _x as usize - _d as usize + crate::mem::size_of::(); + let sz = _x as usize - _d as usize + mem::size_of::(); let rsz = (*_d).d_reclen as usize; if sz > rsz || sz + (*_x).d_datalen as usize > rsz { @@ -2795,14 +2795,14 @@ f! { pub fn _DEXTRA_NEXT(_x: *const crate::dirent_extra) -> *mut crate::dirent_extra { _ALIGN( - _x as usize + crate::mem::size_of::() + (*_x).d_datalen as usize, + _x as usize + mem::size_of::() + (*_x).d_datalen as usize, 8, ) as *mut crate::dirent_extra } pub fn SOCKCREDSIZE(ngrps: usize) -> usize { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; - crate::mem::size_of::() + crate::mem::size_of::() * ngrps + mem::size_of::() + mem::size_of::() * ngrps } pub fn major(dev: crate::dev_t) -> c_uint { diff --git a/src/unix/nto/neutrino.rs b/src/unix/nto/neutrino.rs index 8d559015ac8cb..71a2301d1b968 100644 --- a/src/unix/nto/neutrino.rs +++ b/src/unix/nto/neutrino.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_long, c_uint, c_void, size_t}; +use crate::prelude::*; pub type nto_job_t = crate::sync_t; diff --git a/src/unix/nto/x86_64.rs b/src/unix/nto/x86_64.rs index ef720ac0a3373..8e938c3bba4fc 100644 --- a/src/unix/nto/x86_64.rs +++ b/src/unix/nto/x86_64.rs @@ -1,4 +1,4 @@ -use crate::{c_int, c_void, size_t}; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = u32; @@ -101,8 +101,8 @@ cfg_if! { } } - impl crate::fmt::Debug for x86_64_fpu_registers { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for x86_64_fpu_registers { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("x86_64_fpu_registers") .field("fsave_area", &self.fsave_area) @@ -113,8 +113,8 @@ cfg_if! { } } - impl crate::hash::Hash for x86_64_fpu_registers { - fn hash(&self, state: &mut H) { + impl hash::Hash for x86_64_fpu_registers { + fn hash(&self, state: &mut H) { unsafe { self.fsave_area.hash(state); self.fxsave_area.hash(state); diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index 014122e421ab8..95d1156bfc48b 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -1,4 +1,5 @@ -use crate::{c_void, in6_addr, in_addr_t, timespec, DIR}; +use crate::prelude::*; +use crate::{in6_addr, in_addr_t, timespec, DIR}; pub type nlink_t = u16; pub type ino_t = u16; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 1d2738a45cd49..3a8886e289a32 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -1,6 +1,4 @@ -use crate::{ - c_int, c_longlong, c_short, c_uchar, c_uint, c_ulonglong, c_ushort, c_void, size_t, ssize_t, -}; +use crate::prelude::*; pub type c_char = i8; pub type wchar_t = i32; @@ -84,8 +82,7 @@ s_no_extra_traits! { pub struct sockaddr_storage { pub ss_family: crate::sa_family_t, - __ss_padding: - [u8; 128 - crate::mem::size_of::() - crate::mem::size_of::()], + __ss_padding: [u8; 128 - mem::size_of::() - mem::size_of::()], __ss_align: c_ulong, } } @@ -1020,20 +1017,20 @@ pub const PRIO_USER: c_int = 2; f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return; } @@ -1280,8 +1277,8 @@ cfg_if! { impl Eq for dirent {} - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_off", &self.d_off) @@ -1292,8 +1289,8 @@ cfg_if! { } } - impl crate::hash::Hash for dirent { - fn hash(&self, state: &mut H) { + impl hash::Hash for dirent { + fn hash(&self, state: &mut H) { self.d_ino.hash(state); self.d_off.hash(state); self.d_reclen.hash(state); @@ -1315,8 +1312,8 @@ cfg_if! { impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_family", &self.sun_family) // FIXME: .field("sun_path", &self.sun_path) @@ -1324,8 +1321,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_family.hash(state); self.sun_path.hash(state); } @@ -1345,8 +1342,8 @@ cfg_if! { impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_family", &self.ss_family) .field("__ss_align", &self.__ss_align) @@ -1355,8 +1352,8 @@ cfg_if! { } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_family.hash(state); self.__ss_padding.hash(state); self.__ss_align.hash(state); @@ -1399,8 +1396,8 @@ cfg_if! { impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -1412,8 +1409,8 @@ cfg_if! { } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 0fea3b7dd24ba..a1adae00dcc12 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -1,6 +1,6 @@ +use crate::prelude::*; use crate::{ - c_char, c_double, c_int, c_short, c_uint, c_ulong, c_ushort, c_void, exit_status, off_t, - size_t, ssize_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, + exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, PRIV_PFEXEC, PRIV_XPOLICY, }; @@ -89,8 +89,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_user", &self.ut_user) .field("ut_id", &self.ut_id) @@ -107,8 +107,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_user.hash(state); self.ut_type.hash(state); self.ut_pid.hash(state); @@ -129,8 +129,8 @@ cfg_if! { } } impl Eq for epoll_event {} - impl crate::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for epoll_event { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let events = self.events; let u64 = self.u64; f.debug_struct("epoll_event") @@ -139,8 +139,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { + impl hash::Hash for epoll_event { + fn hash(&self, state: &mut H) { let events = self.events; let u64 = self.u64; events.hash(state); diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 981c697e923f3..4b986e1e9c0c2 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1,8 +1,6 @@ use core::mem::size_of; -use crate::{ - c_double, c_int, c_longlong, c_short, c_uchar, c_uint, c_ushort, c_void, size_t, ssize_t, -}; +use crate::prelude::*; pub type c_char = i8; pub type c_long = i64; @@ -587,16 +585,16 @@ cfg_if! { } } impl Eq for sockaddr_un {} - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_family", &self.sun_family) // FIXME: .field("sun_path", &self.sun_path) .finish() } } - impl crate::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { self.sun_family.hash(state); self.sun_path.hash(state); } @@ -631,8 +629,8 @@ cfg_if! { } } impl Eq for utsname {} - impl crate::fmt::Debug for utsname { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utsname { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utsname") // FIXME: .field("sysname", &self.sysname) // FIXME: .field("nodename", &self.nodename) @@ -642,8 +640,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for utsname { - fn hash(&self, state: &mut H) { + impl hash::Hash for utsname { + fn hash(&self, state: &mut H) { self.sysname.hash(state); self.nodename.hash(state); self.release.hash(state); @@ -661,15 +659,15 @@ cfg_if! { } } impl Eq for fd_set {} - impl crate::fmt::Debug for fd_set { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fd_set { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fd_set") // FIXME: .field("fds_bits", &self.fds_bits) .finish() } } - impl crate::hash::Hash for fd_set { - fn hash(&self, state: &mut H) { + impl hash::Hash for fd_set { + fn hash(&self, state: &mut H) { self.fds_bits.hash(state); } } @@ -687,8 +685,8 @@ cfg_if! { } } impl Eq for sockaddr_storage {} - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) @@ -697,8 +695,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { self.ss_family.hash(state); self.__ss_pad1.hash(state); self.__ss_align.hash(state); @@ -756,8 +754,8 @@ cfg_if! { } } impl Eq for siginfo_t {} - impl crate::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("siginfo_t") .field("si_signo", &self.si_signo) .field("si_code", &self.si_code) @@ -766,8 +764,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { self.si_signo.hash(state); self.si_code.hash(state); self.si_errno.hash(state); @@ -796,8 +794,8 @@ cfg_if! { } } impl Eq for sockaddr_dl {} - impl crate::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_dl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_dl") .field("sdl_family", &self.sdl_family) .field("sdl_index", &self.sdl_index) @@ -809,8 +807,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { + impl hash::Hash for sockaddr_dl { + fn hash(&self, state: &mut H) { self.sdl_family.hash(state); self.sdl_index.hash(state); self.sdl_type.hash(state); @@ -831,8 +829,8 @@ cfg_if! { } } impl Eq for sigevent {} - impl crate::fmt::Debug for sigevent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigevent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigevent") .field("sigev_notify", &self.sigev_notify) .field("sigev_signo", &self.sigev_signo) @@ -842,8 +840,8 @@ cfg_if! { .finish() } } - impl crate::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigevent { + fn hash(&self, state: &mut H) { self.sigev_notify.hash(state); self.sigev_signo.hash(state); self.sigev_value.hash(state); @@ -861,8 +859,8 @@ cfg_if! { } } impl Eq for pad128_t {} - impl crate::fmt::Debug for pad128_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for pad128_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("pad128_t") // FIXME: .field("_q", &{self._q}) @@ -871,8 +869,8 @@ cfg_if! { } } } - impl crate::hash::Hash for pad128_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for pad128_t { + fn hash(&self, state: &mut H) { unsafe { // FIXME: state.write_i64(self._q as i64); self._l.hash(state); @@ -888,8 +886,8 @@ cfg_if! { } } impl Eq for upad128_t {} - impl crate::fmt::Debug for upad128_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for upad128_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("upad128_t") // FIXME: .field("_q", &{self._q}) @@ -898,8 +896,8 @@ cfg_if! { } } } - impl crate::hash::Hash for upad128_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for upad128_t { + fn hash(&self, state: &mut H) { unsafe { // FIXME: state.write_i64(self._q as i64); self._l.hash(state); @@ -2487,7 +2485,7 @@ f! { } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - _CMSG_DATA_ALIGN(crate::mem::size_of::()) as c_uint + length + _CMSG_DATA_ALIGN(mem::size_of::()) as c_uint + length } pub fn CMSG_FIRSTHDR(mhdr: *const crate::msghdr) -> *mut cmsghdr { @@ -2517,20 +2515,20 @@ f! { } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return; } pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () { - let bits = crate::mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return; diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 63009c2105d17..f4a8031756798 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -1,7 +1,7 @@ +use crate::prelude::*; use crate::{ - c_char, c_int, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, exit_status, off_t, - size_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, PRIV_PFEXEC, - PRIV_XPOLICY, + exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, + PRIV_PFEXEC, PRIV_XPOLICY, }; pub type door_attr_t = c_uint; @@ -126,8 +126,8 @@ cfg_if! { impl Eq for utmpx {} - impl crate::fmt::Debug for utmpx { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for utmpx { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") .field("ut_user", &self.ut_user) .field("ut_id", &self.ut_id) @@ -144,8 +144,8 @@ cfg_if! { } } - impl crate::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { + impl hash::Hash for utmpx { + fn hash(&self, state: &mut H) { self.ut_user.hash(state); self.ut_type.hash(state); self.ut_pid.hash(state); diff --git a/src/unix/solarish/x86.rs b/src/unix/solarish/x86.rs index db449b1e86690..a37ed3d74e978 100644 --- a/src/unix/solarish/x86.rs +++ b/src/unix/solarish/x86.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_long, c_ulong, c_ulonglong, c_ushort}; +use crate::prelude::*; pub type Elf32_Addr = c_ulong; pub type Elf32_Half = c_ushort; diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index d69fc9a5afbda..1ea8ce987dab5 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_long, c_uint, c_ulong, c_ulonglong, c_ushort, c_void}; +use crate::prelude::*; cfg_if! { if #[cfg(target_os = "solaris")] { @@ -110,8 +110,8 @@ cfg_if! { } } impl Eq for __c_anonymous_fp_reg_set {} - impl crate::fmt::Debug for __c_anonymous_fp_reg_set { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for __c_anonymous_fp_reg_set { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { f.debug_struct("__c_anonymous_fp_reg_set") .field("fpchip_state", &{ self.fpchip_state }) @@ -126,8 +126,8 @@ cfg_if! { } } impl Eq for fpregset_t {} - impl crate::fmt::Debug for fpregset_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for fpregset_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fpregset_t") .field("fp_reg_set", &self.fp_reg_set) .finish() @@ -139,8 +139,8 @@ cfg_if! { } } impl Eq for mcontext_t {} - impl crate::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("mcontext_t") .field("gregs", &self.gregs) .field("fpregs", &self.fpregs) @@ -158,8 +158,8 @@ cfg_if! { } } impl Eq for ucontext_t {} - impl crate::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ucontext_t") .field("uc_flags", &self.uc_flags) .field("uc_link", &self.uc_link) diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 2781538569c36..f5e582055a5cb 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -3,7 +3,7 @@ use core::mem::size_of; use core::ptr::null_mut; -use crate::c_void; +use crate::prelude::*; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} @@ -463,8 +463,8 @@ s_no_extra_traits! { cfg_if! { if #[cfg(feature = "extra_traits")] { - impl crate::fmt::Debug for dirent { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for dirent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_name", &&self.d_name[..]) @@ -472,8 +472,8 @@ cfg_if! { } } - impl crate::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) @@ -482,8 +482,8 @@ cfg_if! { } } - impl crate::fmt::Debug for RTP_DESC { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for RTP_DESC { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RTP_DESC") .field("status", &self.status) .field("options", &self.options) @@ -497,8 +497,8 @@ cfg_if! { .finish() } } - impl crate::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sockaddr_storage") .field("ss_len", &self.ss_len) .field("ss_family", &self.ss_family) @@ -525,8 +525,8 @@ cfg_if! { } } impl Eq for sa_u_t {} - impl crate::fmt::Debug for sa_u_t { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sa_u_t { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { let h = match self.sa_handler { Some(handler) => handler as usize, @@ -537,8 +537,8 @@ cfg_if! { } } } - impl crate::hash::Hash for sa_u_t { - fn hash(&self, state: &mut H) { + impl hash::Hash for sa_u_t { + fn hash(&self, state: &mut H) { unsafe { let h = match self.sa_handler { Some(handler) => handler as usize, @@ -555,15 +555,15 @@ cfg_if! { } } impl Eq for sigval {} - impl crate::fmt::Debug for sigval { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + impl fmt::Debug for sigval { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("sigval") .field("sival_ptr", unsafe { &(self.sival_ptr as usize) }) .finish() } } - impl crate::hash::Hash for sigval { - fn hash(&self, state: &mut H) { + impl hash::Hash for sigval { + fn hash(&self, state: &mut H) { unsafe { (self.sival_ptr as usize).hash(state) }; } } @@ -1095,13 +1095,13 @@ impl Clone for fpos_t { f! { pub {const} fn CMSG_ALIGN(len: usize) -> usize { - len + crate::mem::size_of::() - 1 & !(crate::mem::size_of::() - 1) + len + mem::size_of::() - 1 & !(mem::size_of::() - 1) } pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize) - + CMSG_ALIGN(crate::mem::size_of::()); + + CMSG_ALIGN(mem::size_of::()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next <= max { (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr @@ -1119,15 +1119,15 @@ f! { } pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { - (cmsg as *mut c_uchar).offset(CMSG_ALIGN(crate::mem::size_of::()) as isize) + (cmsg as *mut c_uchar).offset(CMSG_ALIGN(mem::size_of::()) as isize) } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(crate::mem::size_of::())) as c_uint + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::())) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - CMSG_ALIGN(crate::mem::size_of::()) as c_uint + length + CMSG_ALIGN(mem::size_of::()) as c_uint + length } } diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index f04081bad1fa7..5919d43b857b8 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -5,8 +5,7 @@ use core::iter::Iterator; -use super::{Send, Sync}; -use crate::c_void; +use crate::prelude::*; pub type c_char = i8; pub type c_uchar = u8; diff --git a/src/wasi/p2.rs b/src/wasi/p2.rs index 344029f222334..7332a779396d3 100644 --- a/src/wasi/p2.rs +++ b/src/wasi/p2.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_uchar, c_uint, c_ushort, c_void, size_t, ssize_t}; +use crate::prelude::*; pub type sa_family_t = c_ushort; pub type in_port_t = c_ushort; diff --git a/src/windows/gnu/mod.rs b/src/windows/gnu/mod.rs index e593dff519e04..a263dfa736bba 100644 --- a/src/windows/gnu/mod.rs +++ b/src/windows/gnu/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_uint, size_t}; +use crate::prelude::*; cfg_if! { if #[cfg(target_pointer_width = "64")] { diff --git a/src/windows/mod.rs b/src/windows/mod.rs index f900bf0e16c25..927f01f409785 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -1,6 +1,6 @@ //! Windows CRT definitions -use crate::c_void; +use crate::prelude::*; pub type c_schar = i8; pub type c_uchar = u8; diff --git a/src/windows/msvc/mod.rs b/src/windows/msvc/mod.rs index 3f9f34e7e24ff..5b620bc6c1afa 100644 --- a/src/windows/msvc/mod.rs +++ b/src/windows/msvc/mod.rs @@ -1,4 +1,4 @@ -use crate::{c_char, c_int, c_uint, c_void, size_t}; +use crate::prelude::*; pub const L_tmpnam: c_uint = 260; pub const TMP_MAX: c_uint = 0x7fff_ffff; From b52375d8365241597c7d37733caee83be1f8bf64 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 19:59:53 -0500 Subject: [PATCH 9/9] Add a `.git-blame-ignore-revs` entry for adding the prelude Ignore 108310db03 ("Make use of the crate's prelude...") since this was an automated refactoring that updated type paths in most files. This is the `main` version of 744fce2a23 ("Add a .git-blame-ignore-revs entry for adding the prelude"). --- .git-blame-ignore-revs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 64da908d6e919..d358a2cd3d349 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,5 +1,6 @@ # Format macro bodies 50f26e08e146b7e9c7d1af9614486eba327d1e31 -# Automated changes to upgrade to the 2021 edition +# Automated changes related to the 2021 edition upgrade 643182f7da26cedb09349b8bb3735c2e58ba24e6 +108310db03e7db35ef48a902d9ce9a88ab8f9b77