-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signal: add SignalKind::info on illumos
illumos has supported SIGINFO for a long time; see illumos/illumos-gate@19d32b9.
- Loading branch information
1 parent
c07257f
commit c69052a
Showing
2 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#![warn(rust_2018_idioms)] | ||
#![cfg(feature = "full")] | ||
#![cfg(any( | ||
target_os = "dragonfly", | ||
target_os = "freebsd", | ||
target_os = "macos", | ||
target_os = "netbsd", | ||
target_os = "openbsd", | ||
target_os = "illumos" | ||
))] | ||
#![cfg(not(miri))] // No `sigaction` on Miri | ||
|
||
mod support { | ||
pub mod signal; | ||
} | ||
use support::signal::send_signal; | ||
|
||
use tokio::signal; | ||
use tokio::signal::unix::SignalKind; | ||
use tokio::sync::oneshot; | ||
|
||
#[tokio::test] | ||
async fn siginfo() { | ||
let mut sig = signal::unix::signal(SignalKind::info()).expect("installed signal handler"); | ||
|
||
let (fire, wait) = oneshot::channel(); | ||
|
||
// NB: simulate a signal coming in by exercising our signal handler | ||
// to avoid complications with sending SIGINFO to the test process | ||
tokio::spawn(async { | ||
wait.await.expect("wait failed"); | ||
send_signal(libc::SIGINFO); | ||
}); | ||
|
||
let _ = fire.send(()); | ||
|
||
sig.recv().await.expect("received SIGINFO signal"); | ||
} |