• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! NOTE: Keep these constants in sync with `library/std/src/sys/unix/mod.rs`!
2 
3 /// The default value if `#[unix_sigpipe]` is not specified. This resolves
4 /// to `SIG_IGN` in `library/std/src/sys/unix/mod.rs`.
5 ///
6 /// Note that `SIG_IGN` has been the Rust default since 2014. See
7 /// <https://github.com/rust-lang/rust/issues/62569>.
8 #[allow(dead_code)]
9 pub const DEFAULT: u8 = 0;
10 
11 /// Do not touch `SIGPIPE`. Use whatever the parent process uses.
12 #[allow(dead_code)]
13 pub const INHERIT: u8 = 1;
14 
15 /// Change `SIGPIPE` to `SIG_IGN` so that failed writes results in `EPIPE`
16 /// that are eventually converted to `ErrorKind::BrokenPipe`.
17 #[allow(dead_code)]
18 pub const SIG_IGN: u8 = 2;
19 
20 /// Change `SIGPIPE` to `SIG_DFL` so that the process is killed when trying
21 /// to write to a closed pipe. This is usually the desired behavior for CLI
22 /// apps that produce textual output that you want to pipe to other programs
23 /// such as `head -n 1`.
24 #[allow(dead_code)]
25 pub const SIG_DFL: u8 = 3;
26