Skip to content

Commit 0e792b3

Browse files
committed
unix_sigpipe: Add docs for init() sigpipe param
1 parent 1dec40f commit 0e792b3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

std/src/rt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ macro_rules! rtunwrap {
7272
// Runs before `main`.
7373
// SAFETY: must be called only once during runtime initialization.
7474
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
75+
// The extra parameter `sigpipe` allows rustc to generate code that instructs std whether
76+
// or not to ignore `SIGPIPE`.
7577
#[cfg_attr(test, allow(dead_code))]
7678
unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
7779
unsafe {

std/src/sys/unix/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {}
4949
#[cfg(not(target_os = "espidf"))]
5050
// SAFETY: must be called only once during runtime initialization.
5151
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
52+
// The extra parameter `sigpipe` allows rustc to generate code that instructs std whether
53+
// or not to ignore `SIGPIPE`.
5254
pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
5355
// The standard streams might be closed on application startup. To prevent
5456
// std::io::{stdin, stdout,stderr} objects from using other unrelated file

0 commit comments

Comments
 (0)