1 use crate::fd::OwnedFd;
2 use crate::net::{AddressFamily, Protocol, SocketFlags, SocketType};
3 use crate::{backend, io};
4
5 /// `socketpair(domain, type_ | accept_flags, protocol)`
6 ///
7 /// # References
8 /// - [POSIX]
9 /// - [Linux]
10 ///
11 /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html
12 /// [Linux]: https://man7.org/linux/man-pages/man2/socketpair.2.html
13 #[inline]
socketpair( domain: AddressFamily, type_: SocketType, flags: SocketFlags, protocol: Protocol, ) -> io::Result<(OwnedFd, OwnedFd)>14 pub fn socketpair(
15 domain: AddressFamily,
16 type_: SocketType,
17 flags: SocketFlags,
18 protocol: Protocol,
19 ) -> io::Result<(OwnedFd, OwnedFd)> {
20 backend::net::syscalls::socketpair(domain, type_, flags, protocol)
21 }
22