rust-lang / libs-team

The home of the library team
Apache License 2.0
110 stars 18 forks source link

Implementing UnixSocketExt traits for solaris/illumos ; starting with the unix_socket_exclbind feature #366

Open devnexen opened 3 months ago

devnexen commented 3 months ago

Proposal

Problem statement

Goal is to add the possibility, for the aforementioned systems, to be able to control how the incoming connections can bind to a given socket, discarding the SO_REUSEADDR setting.

Motivating examples or use cases

#![feature(unix_socket_exclbind)]
   use std::os::solaris::net::UnixSocketExt;
    use std::os::unix::net::UnixDatagram;

    fn main() -> std::io::Result<()> {
        let sock = UnixDatagram::unbound()?;
        sock.set_exclbind(true).unwrap();
        Ok(())
    }

Links and related work

https://github.com/rust-lang/rust/pull/123476