Skip to content

Commit 4ea98d7

Browse files
authored
Rollup merge of rust-lang#128259 - sunshowers:msg-nosignal, r=Mark-Simulacrum
[illumos/solaris] set MSG_NOSIGNAL while writing to sockets Both these platforms have MSG_NOSIGNAL available, and we should set it for socket writes in the event that the SIGPIPE handler has been reset to SIG_DFL (i.e. terminate the process). I've verified via a quick program at https://github.com/sunshowers/msg-nosignal-test/ that even when the SIGPIPE handler is reset to SIG_DFL, writes to closed TCP sockets now error out with EPIPE. (Under ordinary circumstances UDP writes won't cause MSG_NOSIGNAL.) However, I couldn't find any existing tests which verified the MSG_NOSIGNAL behavior.
2 parents d6f970a + 2986bfe commit 4ea98d7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

std/src/os/unix/net/datagram.rs

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use crate::{fmt, io};
2020
target_os = "freebsd",
2121
target_os = "openbsd",
2222
target_os = "netbsd",
23+
target_os = "solaris",
24+
target_os = "illumos",
2325
target_os = "haiku",
2426
target_os = "nto",
2527
))]
@@ -31,6 +33,8 @@ use libc::MSG_NOSIGNAL;
3133
target_os = "freebsd",
3234
target_os = "openbsd",
3335
target_os = "netbsd",
36+
target_os = "solaris",
37+
target_os = "illumos",
3438
target_os = "haiku",
3539
target_os = "nto",
3640
)))]

std/src/sys_common/net.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ cfg_if::cfg_if! {
4242
target_os = "hurd",
4343
target_os = "dragonfly", target_os = "freebsd",
4444
target_os = "openbsd", target_os = "netbsd",
45+
target_os = "solaris", target_os = "illumos",
4546
target_os = "haiku", target_os = "nto"))] {
4647
use libc::MSG_NOSIGNAL;
4748
} else {

0 commit comments

Comments
 (0)