diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
commit | 1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch) | |
tree | 7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/rustix/src/net/socketpair.rs | |
parent | 5ecd8cf2cba827454317368b68571df0d13d7842 (diff) | |
download | fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip |
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/rustix/src/net/socketpair.rs')
-rw-r--r-- | vendor/rustix/src/net/socketpair.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/rustix/src/net/socketpair.rs b/vendor/rustix/src/net/socketpair.rs new file mode 100644 index 0000000..7228e71 --- /dev/null +++ b/vendor/rustix/src/net/socketpair.rs @@ -0,0 +1,36 @@ +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] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html +/// [Linux]: https://man7.org/linux/man-pages/man2/socketpair.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socketpair.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socketpair&sektion=2 +/// [NetBSD]: https://man.netbsd.org/socketpair.2 +/// [OpenBSD]: https://man.openbsd.org/socketpair.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socketpair§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/socketpair +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Socket-Pairs.html +#[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) +} |