Skip to content

Commit

Permalink
Add support for QNX Neutrino
Browse files Browse the repository at this point in the history
  • Loading branch information
flba-eb authored and Detegr committed Jun 14, 2023
1 parent 2d0ab31 commit 560d58c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/platform/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ extern "C" fn os_handler(_: nix::libc::c_int) {
target_os = "ios",
target_os = "macos",
target_os = "haiku",
target_os = "aix"
target_os = "aix",
target_os = "nto",
))]
fn pipe2(flags: nix::fcntl::OFlag) -> nix::Result<(RawFd, RawFd)> {
use nix::fcntl::{fcntl, FcntlArg, FdFlag, OFlag};
Expand Down Expand Up @@ -68,7 +69,8 @@ fn pipe2(flags: nix::fcntl::OFlag) -> nix::Result<(RawFd, RawFd)> {
target_os = "ios",
target_os = "macos",
target_os = "haiku",
target_os = "aix"
target_os = "aix",
target_os = "nto",
)))]
fn pipe2(flags: nix::fcntl::OFlag) -> nix::Result<(RawFd, RawFd)> {
unistd::pipe2(flags)
Expand Down Expand Up @@ -103,11 +105,16 @@ pub unsafe fn init_os_handler(overwrite: bool) -> Result<(), Error> {
}

let handler = signal::SigHandler::Handler(os_handler);
#[cfg(not(target_os = "nto"))]
let new_action = signal::SigAction::new(
handler,
signal::SaFlags::SA_RESTART,
signal::SigSet::empty(),
);
// SA_RESTART is not supported on QNX Neutrino 7.1 and before
#[cfg(target_os = "nto")]
let new_action =
signal::SigAction::new(handler, signal::SaFlags::empty(), signal::SigSet::empty());

let sigint_old = match signal::sigaction(signal::Signal::SIGINT, &new_action) {
Ok(old) => old,
Expand Down

0 comments on commit 560d58c

Please sign in to comment.