Rollup merge of #150410 - crescentrose:document-socket-cloexec, r=ChrisDenton

Document default SOCK_CLOEXEC flag on new UnixStream

Currently, the `std::os::unix::net::UnixStream` docs do not specify that the SOCK_CLOEXEC flag is set on new sockets. This commit adds a note clarifying that, in line with the note abuot the `MSG_NOSIGNAL` flag.
This commit is contained in:
Jonathan Brouwer 2025-12-27 15:46:56 +01:00 committed by GitHub
commit e2e271b7b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,6 +58,13 @@ use crate::time::Duration;
/// }
/// ```
///
/// # `SOCK_CLOEXEC`
///
/// On platforms that support it, we pass the close-on-exec flag to atomically create the socket and
/// set it as CLOEXEC. On Linux, this was added in 2.6.27. See [`socket(2)`] for more information.
///
/// [`socket(2)`]: https://www.man7.org/linux/man-pages/man2/socket.2.html#:~:text=SOCK_CLOEXEC
///
/// # `SIGPIPE`
///
/// Writes to the underlying socket in `SOCK_STREAM` mode are made with `MSG_NOSIGNAL` flag.