MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / socket_with

Function socket_with

src/backend/linux_raw/net/syscalls.rs:65–92  ·  view source on GitHub ↗
(
    family: AddressFamily,
    type_: SocketType,
    flags: SocketFlags,
    protocol: Option<Protocol>,
)

Source from the content-addressed store, hash-verified

63
64#[inline]
65pub(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]
95pub(crate) fn socketpair(

Callers

nothing calls this directly

Calls 1

ret_owned_fdFunction · 0.50

Tested by

no test coverage detected