From 54b6b8d82db02f26b3bc3bd104546de050d184a6 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 14 Aug 2024 14:18:02 +0200 Subject: [PATCH] Revert "Implement fallback for `sendmmsg` and `recvmmsg`" This reverts commit e6f184489e703bcf70850f99373c88746c250662. e6f18448 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 https://github.com/quinn-rs/quinn/issues/1503#issuecomment-2285962727 the decision was made to no longer support these old Android systems (API level 16). This commit reverts e6f18448. Given that `sendmmsg` support was previously dropped in ee088265, only the `recvmmsg` calls are reverted. --- quinn-udp/src/unix.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs index 34def460e..a2e68623c 100644 --- a/quinn-udp/src/unix.rs +++ b/quinn-udp/src/unix.rs @@ -442,25 +442,9 @@ unsafe fn recvmmsg_with_fallback( let flags = 0; let timeout = ptr::null_mut::(); - #[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();