Skip to content

Commit

Permalink
Revert "Implement fallback for sendmmsg and recvmmsg"
Browse files Browse the repository at this point in the history
This reverts commit e6f1844.

e6f1844 called `sendmmsg` and `recvmmsg` through `libc::syscall` instead of
`libc::sendmmsg` and `libc::recvmmsg`, thus preventing linking issues on old
Android systems where `libc::sendmmsg` and `libc::recvmmsg` isn't available.

In #1503 (comment) the
decision was made to no longer support these old Android systems (API level 16).

This commit reverts e6f1844. Given that `sendmmsg` support was previously
dropped in ee08826, only the `recvmmsg` calls are reverted.
  • Loading branch information
mxinden committed Aug 19, 2024
1 parent 1e00247 commit 54b6b8d
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions quinn-udp/src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,25 +442,9 @@ unsafe fn recvmmsg_with_fallback(
let flags = 0;
let timeout = ptr::null_mut::<libc::timespec>();

#[cfg(not(any(target_os = "freebsd", target_os = "netbsd")))]
{
let ret =
libc::syscall(libc::SYS_recvmmsg, sockfd, msgvec, vlen, flags, timeout) as libc::c_int;
if ret != -1 {
return ret;
}
}

// libc on FreeBSD and NetBSD implement `recvmmsg` as a high-level abstraction over
// `recvmsg`, thus `SYS_recvmmsg` constant and direct system call do not exist
#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
{
#[cfg(target_os = "freebsd")]
let vlen = vlen as usize;
let ret = libc::recvmmsg(sockfd, msgvec, vlen, flags, timeout) as libc::c_int;
if ret != -1 {
return ret;
}
let ret = libc::recvmmsg(sockfd, msgvec, vlen as _, flags, timeout) as libc::c_int;
if ret != -1 {
return ret;
}

let e = io::Error::last_os_error();
Expand Down

0 comments on commit 54b6b8d

Please sign in to comment.