Skip to content

Commit

Permalink
Rollup merge of rust-lang#119632 - ivmarkov:master, r=Nilstrieb,dtolnay
Browse files Browse the repository at this point in the history
Fix broken build for ESP IDF due to rust-lang#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.
  • Loading branch information
matthiaskrgr committed Jan 8, 2024
2 parents d39a8b0 + a10b3cd commit 9204358
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/std/src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 9204358

Please sign in to comment.