Revision control

Copy as Markdown

Other Tools

use crate::fd::OwnedFd;
use crate::net::{AddressFamily, Protocol, SocketFlags, SocketType};
use crate::{backend, io};
/// `socketpair(domain, type_ | accept_flags, protocol)`—Create a pair of
/// sockets that are connected to each other.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
/// - [FreeBSD]
/// - [NetBSD]
/// - [OpenBSD]
/// - [DragonFly BSD]
/// - [illumos]
/// - [glibc]
///
#[inline]
pub fn socketpair(
domain: AddressFamily,
type_: SocketType,
flags: SocketFlags,
protocol: Option<Protocol>,
) -> io::Result<(OwnedFd, OwnedFd)> {
backend::net::syscalls::socketpair(domain, type_, flags, protocol)
}