From 5d77970a4e20c79c75319942a38e213b3a59ad43 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 27 Nov 2024 03:25:37 -0500 Subject: [PATCH] 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 b763d34e5fdf..6bffccfc9fc7 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 7c2d6853a851..24713993f90a 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;