We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 08472e5 + 918258f commit de33a44Copy full SHA for de33a44
library/std/src/os/unix/net/listener.rs
@@ -73,10 +73,11 @@ impl UnixListener {
73
unsafe {
74
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
75
let (addr, len) = sockaddr_un(path.as_ref())?;
76
- #[cfg(target_os = "linux")]
77
- const backlog: libc::c_int = -1;
78
- #[cfg(not(target_os = "linux"))]
79
- const backlog: libc::c_int = 128;
+ const backlog: libc::c_int = if cfg!(any(target_os = "linux", target_os = "freebsd")) {
+ -1
+ } else {
+ libc::SOMAXCONN
80
+ };
81
82
cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?;
83
cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?;
0 commit comments