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

Function accept

src/backend/linux_raw/net/syscalls.rs:133–153  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>)

Source from the content-addressed store, hash-verified

131
132#[inline]
133pub(crate) fn accept(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
134 #[cfg(not(any(target_arch = "x86", target_arch = "s390x")))]
135 unsafe {
136 let fd = ret_owned_fd(syscall_readonly!(__NR_accept, fd, zero(), zero()))?;
137 Ok(fd)
138 }
139 #[cfg(target_arch = "x86")]
140 unsafe {
141 let fd = ret_owned_fd(syscall_readonly!(
142 __NR_socketcall,
143 x86_sys(SYS_ACCEPT),
144 slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[fd.into(), zero(), zero()])
145 ))?;
146 Ok(fd)
147 }
148 #[cfg(target_arch = "s390x")]
149 {
150 // accept is not available on s390x
151 accept_with(fd, SocketFlags::empty())
152 }
153}
154
155#[inline]
156pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> {

Callers

nothing calls this directly

Calls 2

accept_withFunction · 0.70
ret_owned_fdFunction · 0.50

Tested by

no test coverage detected