From 106e88e0baaa87dfd56c533ca795f484e849e501 Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 26 Dec 2025 23:25:32 +0100 Subject: [PATCH 1/2] 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. --- library/std/src/os/unix/net/stream.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index 1fed1229d5ae..ed5c434543d9 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -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. From ee9db304214c6705b7ba2106e50b3eada99ee24c Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 27 Dec 2025 10:59:21 +0100 Subject: [PATCH 2/2] fix late night markdown --- library/std/src/os/unix/net/stream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index ed5c434543d9..c0a8045884a5 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -63,7 +63,7 @@ use crate::time::Duration; /// 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) +/// [`socket(2)`]: https://www.man7.org/linux/man-pages/man2/socket.2.html#:~:text=SOCK_CLOEXEC /// /// # `SIGPIPE` ///