From c4ef05fd6dd1c627530bf8306aa7f0628b8ec039 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 4 Sep 2024 19:38:05 -0700 Subject: [PATCH] Fix compilation on Linux on SPARC. Also fix capitalization in various comments. --- src/backend/linux_raw/arch/mips.rs | 2 +- src/backend/linux_raw/arch/mips32r6.rs | 2 +- src/backend/linux_raw/arch/mips64.rs | 2 +- src/backend/linux_raw/arch/mips64r6.rs | 2 +- src/fs/ioctl.rs | 2 +- src/termios/types.rs | 36 +++++++++++++++++++------- tests/fs/ioctl.rs | 2 +- 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/backend/linux_raw/arch/mips.rs b/src/backend/linux_raw/arch/mips.rs index 37932e02b..3bd96fa00 100644 --- a/src/backend/linux_raw/arch/mips.rs +++ b/src/backend/linux_raw/arch/mips.rs @@ -3,7 +3,7 @@ //! On mipsel, Linux indicates success or failure using `$a3` rather //! than by returning a negative error code as most other architectures do. //! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! MIPS-family platforms have a special calling convention for `__NR_pipe`, //! however we use `__NR_pipe2` instead to avoid having to implement it. use crate::backend::reg::{ diff --git a/src/backend/linux_raw/arch/mips32r6.rs b/src/backend/linux_raw/arch/mips32r6.rs index c2d92447b..2b5b9076e 100644 --- a/src/backend/linux_raw/arch/mips32r6.rs +++ b/src/backend/linux_raw/arch/mips32r6.rs @@ -3,7 +3,7 @@ //! On mipsisa32r6el, Linux indicates success or failure using `$a3` rather //! than by returning a negative error code as most other architectures do. //! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! MIPS-family platforms have a special calling convention for `__NR_pipe`, //! however we use `__NR_pipe2` instead to avoid having to implement it. use crate::backend::reg::{ diff --git a/src/backend/linux_raw/arch/mips64.rs b/src/backend/linux_raw/arch/mips64.rs index 244daf3ef..5937344ab 100644 --- a/src/backend/linux_raw/arch/mips64.rs +++ b/src/backend/linux_raw/arch/mips64.rs @@ -3,7 +3,7 @@ //! On mips64el, Linux indicates success or failure using `$a3` (`$7`) rather //! than by returning a negative error code as most other architectures do. //! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! MIPS-family platforms have a special calling convention for `__NR_pipe`, //! however we use `__NR_pipe2` instead to avoid having to implement it. use crate::backend::reg::{ diff --git a/src/backend/linux_raw/arch/mips64r6.rs b/src/backend/linux_raw/arch/mips64r6.rs index 8c06d9ee9..d7284a239 100644 --- a/src/backend/linux_raw/arch/mips64r6.rs +++ b/src/backend/linux_raw/arch/mips64r6.rs @@ -4,7 +4,7 @@ //! rather than by returning a negative error code as most other architectures //! do. //! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! MIPS-family platforms have a special calling convention for `__NR_pipe`, //! however we use `__NR_pipe2` instead to avoid having to implement it. //! //! Note that MIPS R6 inline assembly currently doesn't differ from MIPS, diff --git a/src/fs/ioctl.rs b/src/fs/ioctl.rs index b44bd174e..718a2a404 100644 --- a/src/fs/ioctl.rs +++ b/src/fs/ioctl.rs @@ -44,7 +44,7 @@ pub fn ioctl_blkpbszget(fd: Fd) -> io::Result { /// `ioctl(fd, FICLONE, src_fd)`—Share data between open files. /// -/// This ioctl is not available on Sparc platforms. +/// This ioctl is not available on SPARC platforms. /// /// # References /// - [Linux] diff --git a/src/termios/types.rs b/src/termios/types.rs index 902002ea4..e92943778 100644 --- a/src/termios/types.rs +++ b/src/termios/types.rs @@ -1191,18 +1191,33 @@ impl core::fmt::Debug for SpecialCodeIndex { Self::VQUIT => write!(f, "VQUIT"), Self::VERASE => write!(f, "VERASE"), Self::VKILL => write!(f, "VKILL"), - #[cfg(not(solarish))] + #[cfg(not(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + )))] Self::VEOF => write!(f, "VEOF"), - #[cfg(not(solarish))] + #[cfg(not(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + )))] Self::VTIME => write!(f, "VTIME"), - #[cfg(not(solarish))] + #[cfg(not(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + )))] Self::VMIN => write!(f, "VMIN"), - // On Solarish platforms, `VMIN` and `VTIME` have the same value - // as `VEOF` and `VEOL`. - #[cfg(solarish)] + // On Solarish platforms, and Linux on SPARC, `VMIN` and `VTIME` + // have the same value as `VEOF` and `VEOL`. + #[cfg(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + ))] Self::VMIN => write!(f, "VMIN/VEOF"), - #[cfg(solarish)] + #[cfg(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + ))] Self::VTIME => write!(f, "VTIME/VEOL"), #[cfg(not(any( @@ -1217,7 +1232,10 @@ impl core::fmt::Debug for SpecialCodeIndex { Self::VSTART => write!(f, "VSTART"), Self::VSTOP => write!(f, "VSTOP"), Self::VSUSP => write!(f, "VSUSP"), - #[cfg(not(solarish))] + #[cfg(not(any( + solarish, + all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")) + )))] Self::VEOL => write!(f, "VEOL"), #[cfg(not(target_os = "haiku"))] Self::VREPRINT => write!(f, "VREPRINT"), @@ -1344,7 +1362,7 @@ fn termios_layouts() { #[cfg(not(linux_raw))] { - // On Mips, Sparc, and Android, the libc lacks the ospeed and ispeed + // On MIPS, SPARC, and Android, the libc lacks the ospeed and ispeed // fields. #[cfg(all( not(all( diff --git a/tests/fs/ioctl.rs b/tests/fs/ioctl.rs index e95ea2750..d84d8eb0f 100644 --- a/tests/fs/ioctl.rs +++ b/tests/fs/ioctl.rs @@ -1,4 +1,4 @@ -// Sparc lacks `FICLONE`. +// SPARC lacks `FICLONE`. #[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))] #[test] fn test_ioctl_ficlone() {