Rollup merge of #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.
This commit is contained in:
Trevor Gross 2024-07-27 13:32:57 -04:00 committed by GitHub
commit 2b58d8c08c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,8 @@
target_os = "freebsd", target_os = "freebsd",
target_os = "openbsd", target_os = "openbsd",
target_os = "netbsd", target_os = "netbsd",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku", target_os = "haiku",
target_os = "nto", target_os = "nto",
))] ))]
@ -31,6 +33,8 @@
target_os = "freebsd", target_os = "freebsd",
target_os = "openbsd", target_os = "openbsd",
target_os = "netbsd", target_os = "netbsd",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku", target_os = "haiku",
target_os = "nto", target_os = "nto",
)))] )))]

View File

@ -42,6 +42,7 @@
target_os = "hurd", target_os = "hurd",
target_os = "dragonfly", target_os = "freebsd", target_os = "dragonfly", target_os = "freebsd",
target_os = "openbsd", target_os = "netbsd", target_os = "openbsd", target_os = "netbsd",
target_os = "solaris", target_os = "illumos",
target_os = "haiku", target_os = "nto"))] { target_os = "haiku", target_os = "nto"))] {
use libc::MSG_NOSIGNAL; use libc::MSG_NOSIGNAL;
} else { } else {