From 192d50307485a820f604e19ec1e9a9899faf6e6e Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 17 Jul 2023 17:14:30 -0600 Subject: [PATCH] Remove sigevent support on Fuchsia It triggers UB, which the compiler warns about beginning with 1.41.0. Remove it, due to lack of a Fuchsia maintainer and lack of feedback from the original Fuchsia porter. Fixes #1441 --- CHANGELOG.md | 2 ++ src/sys/signal.rs | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56b9b7d9f9..9c7f09dd2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - `nix::sys::signalfd::signalfd` is deprecated. Use `nix::sys::signalfd::SignalFd` instead. ([#1938](https://github.com/nix-rust/nix/pull/1938)) +- Removed `SigEvent` support on Fuchsia, where it was unsound. + ([#2079](https://github.com/nix-rust/nix/pull/2079)) ## [0.26.2] - 2023-01-18 diff --git a/src/sys/signal.rs b/src/sys/signal.rs index efa35ebfd2..d334ed3851 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -13,7 +13,7 @@ use std::os::unix::io::RawFd; use std::ptr; use std::str::FromStr; -#[cfg(not(any(target_os = "openbsd", target_os = "redox")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "openbsd", target_os = "redox")))] #[cfg(any(feature = "aio", feature = "signal"))] pub use self::sigevent::*; @@ -1018,7 +1018,7 @@ pub enum SigevNotify { } } -#[cfg(not(any(target_os = "openbsd", target_os = "redox")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "openbsd", target_os = "redox")))] #[cfg_attr(docsrs, doc(cfg(all())))] mod sigevent { feature! { @@ -1052,9 +1052,6 @@ mod sigevent { /// Linux, Solaris, and portable programs should prefer `SIGEV_THREAD_ID` or /// `SIGEV_SIGNAL`. That field is part of a union that shares space with the /// more genuinely useful `sigev_notify_thread_id` - // Allow invalid_value warning on Fuchsia only. - // See https://github.com/nix-rust/nix/issues/1441 - #[cfg_attr(target_os = "fuchsia", allow(invalid_value))] pub fn new(sigev_notify: SigevNotify) -> SigEvent { let mut sev = unsafe { mem::MaybeUninit::::zeroed().assume_init() }; sev.sigev_notify = match sigev_notify {