about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-09 05:33:22 +0100
committerGitHub <noreply@github.com>2024-01-09 05:33:22 +0100
commit50982bd4abd8285e7c99658b6c90a1519f47a9ff (patch)
tree32e50faba1ace13d55cab5d8618f526444291e7d
parent985b2ce70dda2aa73a0efd15fd38d2f2eb50b3ff (diff)
parenta10b3cd60f426ac94164667ee10f6f3ea2fed27a (diff)
downloadrust-50982bd4abd8285e7c99658b6c90a1519f47a9ff.tar.gz
rust-50982bd4abd8285e7c99658b6c90a1519f47a9ff.zip
Rollup merge of #119632 - ivmarkov:master, r=Nilstrieb,dtolnay
Fix broken build for ESP IDF due to #119026

`target_os = "espidf"` in `libc` lacks the `SOMAXCONN` constant, but that's probably irrelevant in this context, as `UnixListener` is not supported on ESP IDF - it being a single process "OS" only.

The PR just re-uses the `128` constant so that the code builds. Trying to use the listener on ESP IDF will fail with `ENOSYS`, which is fine.

*UPDATE* Might not fail with `ENOSYS` - need to test what error code would be returned, but that doesn`t change anything.
-rw-r--r--library/std/src/os/unix/net/listener.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs
index 1b70b669c77..f6835472e2c 100644
--- a/library/std/src/os/unix/net/listener.rs
+++ b/library/std/src/os/unix/net/listener.rs
@@ -73,7 +73,7 @@ impl UnixListener {
         unsafe {
             let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
             let (addr, len) = sockaddr_un(path.as_ref())?;
-            #[cfg(any(target_os = "windows", target_os = "redox"))]
+            #[cfg(any(target_os = "windows", target_os = "redox", target_os = "espidf"))]
             const backlog: libc::c_int = 128;
             #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
             const backlog: libc::c_int = -1;
@@ -82,7 +82,8 @@ impl UnixListener {
                 target_os = "redox",
                 target_os = "linux",
                 target_os = "freebsd",
-                target_os = "openbsd"
+                target_os = "openbsd",
+                target_os = "espidf"
             )))]
             const backlog: libc::c_int = libc::SOMAXCONN;