Skip to content

Commit 50982bd

Browse files
authored
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.
2 parents 985b2ce + a10b3cd commit 50982bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/std/src/os/unix/net/listener.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl UnixListener {
7373
unsafe {
7474
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
7575
let (addr, len) = sockaddr_un(path.as_ref())?;
76-
#[cfg(any(target_os = "windows", target_os = "redox"))]
76+
#[cfg(any(target_os = "windows", target_os = "redox", target_os = "espidf"))]
7777
const backlog: libc::c_int = 128;
7878
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
7979
const backlog: libc::c_int = -1;
@@ -82,7 +82,8 @@ impl UnixListener {
8282
target_os = "redox",
8383
target_os = "linux",
8484
target_os = "freebsd",
85-
target_os = "openbsd"
85+
target_os = "openbsd",
86+
target_os = "espidf"
8687
)))]
8788
const backlog: libc::c_int = libc::SOMAXCONN;
8889

0 commit comments

Comments
 (0)