Skip to content

Commit

Permalink
Rollup merge of rust-lang#93410 - solid-rs:feat-kmc-solid-net-dup, r=…
Browse files Browse the repository at this point in the history
…dtolnay

kmc-solid: Implement `net::FileDesc::duplicate`

This PR implements `std::sys::solid::net::FileDesc::duplicate`, which was accidentally left out when this target was added by rust-lang#86191.
  • Loading branch information
matthiaskrgr committed Jan 29, 2022
2 parents f5f2d44 + da0d506 commit 2836dcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions library/std/src/sys/solid/abi/sockets.rs
Expand Up @@ -175,6 +175,9 @@ extern "C" {
#[link_name = "SOLID_NET_Close"]
pub fn close(s: c_int) -> c_int;

#[link_name = "SOLID_NET_Dup"]
pub fn dup(s: c_int) -> c_int;

#[link_name = "SOLID_NET_GetPeerName"]
pub fn getpeername(s: c_int, name: *mut sockaddr, namelen: *mut socklen_t) -> c_int;

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/solid/net.rs
Expand Up @@ -107,7 +107,7 @@ impl FileDesc {
}

fn duplicate(&self) -> io::Result<FileDesc> {
super::unsupported()
cvt(unsafe { netc::dup(self.fd) }).map(Self::new)
}
}

Expand Down

0 comments on commit 2836dcd

Please sign in to comment.