Skip to content

Commit 38c9798

Browse files
authored
Rollup merge of rust-lang#93410 - solid-rs:feat-kmc-solid-net-dup, r=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.
2 parents 8574cdd + da0d506 commit 38c9798

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

library/std/src/sys/solid/abi/sockets.rs

+3
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ extern "C" {
175175
#[link_name = "SOLID_NET_Close"]
176176
pub fn close(s: c_int) -> c_int;
177177

178+
#[link_name = "SOLID_NET_Dup"]
179+
pub fn dup(s: c_int) -> c_int;
180+
178181
#[link_name = "SOLID_NET_GetPeerName"]
179182
pub fn getpeername(s: c_int, name: *mut sockaddr, namelen: *mut socklen_t) -> c_int;
180183

library/std/src/sys/solid/net.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl FileDesc {
107107
}
108108

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

0 commit comments

Comments
 (0)