about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-22 16:13:27 +0100
committerGitHub <noreply@github.com>2024-01-22 16:13:27 +0100
commit8c3c8bba0321553632d0c2ce456c00f4d5d6786d (patch)
treeba81d1c256e9671afec4e67610fa81afa15df6af
parente9c2e1bfbed1b7c1f48bcbd545620a54af2c40cf (diff)
parent89cf17777bd3e1ebb15cc6e85cbcbd955bf12252 (diff)
downloadrust-8c3c8bba0321553632d0c2ce456c00f4d5d6786d.tar.gz
rust-8c3c8bba0321553632d0c2ce456c00f4d5d6786d.zip
Rollup merge of #119943 - devnexen:listener_update3, r=thomcc
std::net: bind update for using backlog as `-1` too.

Albeit not documented, macOs also support negative value for the backlog argument.

ref: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/kern/uipc_socket.c#L1061
-rw-r--r--library/std/src/os/unix/net/listener.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs
index 8bf1e2dca6f..ecc0bbce543 100644
--- a/library/std/src/os/unix/net/listener.rs
+++ b/library/std/src/os/unix/net/listener.rs
@@ -80,7 +80,12 @@ impl UnixListener {
                 target_os = "horizon"
             ))]
             const backlog: libc::c_int = 128;
-            #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
+            #[cfg(any(
+                target_os = "linux",
+                target_os = "freebsd",
+                target_os = "openbsd",
+                target_os = "macos"
+            ))]
             const backlog: libc::c_int = -1;
             #[cfg(not(any(
                 target_os = "windows",
@@ -88,6 +93,7 @@ impl UnixListener {
                 target_os = "linux",
                 target_os = "freebsd",
                 target_os = "openbsd",
+                target_os = "macos",
                 target_os = "espidf",
                 target_os = "horizon"
             )))]