about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2022-08-31 18:11:48 +0200
committerMartin Nordholts <enselic@gmail.com>2022-08-31 18:20:49 +0200
commit3d1a4e4f2792948d78b3fed030e93c9c156fe35a (patch)
tree59fb38ed6f51fddbaae29f6208e783104b9608fe /library/std/src
parent236903f7e9045717d7795ab12bdf349ccf276c3b (diff)
downloadrust-3d1a4e4f2792948d78b3fed030e93c9c156fe35a.tar.gz
rust-3d1a4e4f2792948d78b3fed030e93c9c156fe35a.zip
unix_sigpipe: Add docs for `init()` `sigpipe` param
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/rt.rs2
-rw-r--r--library/std/src/sys/unix/mod.rs2
2 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/rt.rs b/library/std/src/rt.rs
index 7cf3d7d4163..b3f6f82952b 100644
--- a/library/std/src/rt.rs
+++ b/library/std/src/rt.rs
@@ -72,6 +72,8 @@ macro_rules! rtunwrap {
 // Runs before `main`.
 // SAFETY: must be called only once during runtime initialization.
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
+// The extra parameter `sigpipe` allows rustc to generate code that instructs std whether
+// or not to ignore `SIGPIPE`.
 #[cfg_attr(test, allow(dead_code))]
 unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
     unsafe {
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs
index d701f950e86..2856dfcb370 100644
--- a/library/std/src/sys/unix/mod.rs
+++ b/library/std/src/sys/unix/mod.rs
@@ -49,6 +49,8 @@ pub fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {}
 #[cfg(not(target_os = "espidf"))]
 // SAFETY: must be called only once during runtime initialization.
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
+// The extra parameter `sigpipe` allows rustc to generate code that instructs std whether
+// or not to ignore `SIGPIPE`.
 pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
     // The standard streams might be closed on application startup. To prevent
     // std::io::{stdin, stdout,stderr} objects from using other unrelated file