Skip to content

Commit

Permalink
Disable AF_NCA, VSTATUS, VERASE2, and fcntl_lock on Solaris. (#…
Browse files Browse the repository at this point in the history
…1211)

Recent versions of libc 0.2.x have removed these declarations on Solaris,
so remove the code that uses them from rustix.
  • Loading branch information
sunfishcode committed Nov 10, 2024
1 parent ffa1b71 commit 4a7310a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/backend/libc/fs/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ use crate::fs::AtFlags;
target_os = "vita",
)))]
use crate::fs::FallocateFlags;
#[cfg(not(any(target_os = "espidf", target_os = "vita", target_os = "wasi")))]
#[cfg(not(any(
target_os = "espidf",
target_os = "solaris",
target_os = "vita",
target_os = "wasi"
)))]
use crate::fs::FlockOperation;
#[cfg(any(linux_kernel, target_os = "freebsd"))]
use crate::fs::MemfdFlags;
Expand Down Expand Up @@ -1252,6 +1257,7 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul
target_os = "espidf",
target_os = "fuchsia",
target_os = "redox",
target_os = "solaris",
target_os = "vita",
target_os = "wasi"
)))]
Expand Down
7 changes: 6 additions & 1 deletion src/backend/libc/fs/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,12 @@ bitflags! {
///
/// [`flock`]: crate::fs::flock
/// [`fcntl_lock`]: crate::fs::fcntl_lock
#[cfg(not(any(target_os = "espidf", target_os = "vita", target_os = "wasi")))]
#[cfg(not(any(
target_os = "espidf",
target_os = "solaris",
target_os = "vita",
target_os = "wasi"
)))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum FlockOperation {
Expand Down
2 changes: 2 additions & 0 deletions src/fs/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
target_os = "espidf",
target_os = "fuchsia",
target_os = "redox",
target_os = "solaris",
target_os = "vita",
target_os = "wasi"
)))]
Expand Down Expand Up @@ -101,6 +102,7 @@ pub fn fcntl_add_seals<Fd: AsFd>(fd: Fd, seals: SealFlags) -> io::Result<()> {
target_os = "espidf",
target_os = "fuchsia",
target_os = "redox",
target_os = "solaris",
target_os = "vita",
target_os = "wasi"
)))]
Expand Down
2 changes: 1 addition & 1 deletion src/net/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl AddressFamily {
#[cfg(solarish)]
pub const NBS: Self = Self(c::AF_NBS as _);
/// `AF_NCA`
#[cfg(solarish)]
#[cfg(target_os = "illumos")]
pub const NCA: Self = Self(c::AF_NCA as _);
/// `AF_NDD`
#[cfg(target_os = "aix")]
Expand Down
8 changes: 4 additions & 4 deletions src/termios/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,11 +1192,11 @@ impl SpecialCodeIndex {
pub const VDSUSP: Self = Self(c::VDSUSP as usize);

/// `VSTATUS`
#[cfg(any(bsd, solarish, target_os = "hurd"))]
#[cfg(any(bsd, target_os = "hurd", target_os = "illumos"))]
pub const VSTATUS: Self = Self(c::VSTATUS as usize);

/// `VERASE2`
#[cfg(any(freebsdlike, solarish))]
#[cfg(any(freebsdlike, target_os = "illumos"))]
pub const VERASE2: Self = Self(c::VERASE2 as usize);
}

Expand Down Expand Up @@ -1272,9 +1272,9 @@ impl core::fmt::Debug for SpecialCodeIndex {
target_os = "nto"
))]
Self::VDSUSP => write!(f, "VDSUSP"),
#[cfg(any(bsd, solarish, target_os = "hurd"))]
#[cfg(any(bsd, target_os = "hurd", target_os = "illumos"))]
Self::VSTATUS => write!(f, "VSTATUS"),
#[cfg(any(freebsdlike, solarish))]
#[cfg(any(freebsdlike, target_os = "illumos"))]
Self::VERASE2 => write!(f, "VERASE2"),

_ => write!(f, "unknown"),
Expand Down

0 comments on commit 4a7310a

Please sign in to comment.