(
domain: AddressFamily,
type_: SocketType,
flags: SocketFlags,
protocol: Option<Protocol>,
)
| 410 | |
| 411 | #[cfg(not(windows))] |
| 412 | pub(crate) fn socketpair( |
| 413 | domain: AddressFamily, |
| 414 | type_: SocketType, |
| 415 | flags: SocketFlags, |
| 416 | protocol: Option<Protocol>, |
| 417 | ) -> io::Result<(OwnedFd, OwnedFd)> { |
| 418 | let raw_protocol = match protocol { |
| 419 | Some(p) => p.0.get(), |
| 420 | None => 0, |
| 421 | }; |
| 422 | unsafe { |
| 423 | let mut fds = MaybeUninit::<[OwnedFd; 2]>::uninit(); |
| 424 | ret(c::socketpair( |
| 425 | c::c_int::from(domain.0), |
| 426 | (type_.0 | flags.bits()) as c::c_int, |
| 427 | raw_protocol as c::c_int, |
| 428 | fds.as_mut_ptr().cast::<c::c_int>(), |
| 429 | ))?; |
| 430 | |
| 431 | let [fd0, fd1] = fds.assume_init(); |
| 432 | Ok((fd0, fd1)) |
| 433 | } |
| 434 | } |
nothing calls this directly
no test coverage detected