(
family: AddressFamily,
type_: SocketType,
flags: SocketFlags,
protocol: Option<Protocol>,
)
| 63 | |
| 64 | #[inline] |
| 65 | pub(crate) fn socket_with( |
| 66 | family: AddressFamily, |
| 67 | type_: SocketType, |
| 68 | flags: SocketFlags, |
| 69 | protocol: Option<Protocol>, |
| 70 | ) -> io::Result<OwnedFd> { |
| 71 | #[cfg(not(target_arch = "x86"))] |
| 72 | unsafe { |
| 73 | ret_owned_fd(syscall_readonly!( |
| 74 | __NR_socket, |
| 75 | family, |
| 76 | (type_, flags), |
| 77 | protocol |
| 78 | )) |
| 79 | } |
| 80 | #[cfg(target_arch = "x86")] |
| 81 | unsafe { |
| 82 | ret_owned_fd(syscall_readonly!( |
| 83 | __NR_socketcall, |
| 84 | x86_sys(SYS_SOCKET), |
| 85 | slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[ |
| 86 | family.into(), |
| 87 | (type_, flags).into(), |
| 88 | protocol.into(), |
| 89 | ]) |
| 90 | )) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | #[inline] |
| 95 | pub(crate) fn socketpair( |
nothing calls this directly
no test coverage detected