hook recvmmsg up to SO_TIMESTAMP[NS] fallback for pre-time64 kernels
commit114178dc8df79a5b1690ee1c7d6d90c79c76b6b7
authorRich Felker <dalias@aerifal.cx>
Wed, 18 Dec 2019 04:00:24 +0000 (17 23:00 -0500)
committerRich Felker <dalias@aerifal.cx>
Wed, 18 Dec 2019 04:00:24 +0000 (17 23:00 -0500)
tree79252dafb1daa2d69d8727a8ed97fe80fd7f985c
parentae388becb529428ac926da102f1d025b3c3968da
hook recvmmsg up to SO_TIMESTAMP[NS] fallback for pre-time64 kernels

always try the time64 syscall first since we can use its success to
conclude that no conversion is needed (any setsockopt for the
timestamp options would have succeeded without need for fallbacks).
otherwise, we have to remember the original controllen for each
msghdr, requiring O(vlen) space, so vlen must be bounded. linux clamps
it to IOV_MAX for sendmmsg only (not recvmmsg), but doing the same for
recvmmsg is not unreasonable, especially since the limitation will
only apply to old kernels.

we could optimize to avoid trying SYS_recvmmsg_time64 first if all
msghdrs have controllen zero, or support unlimited vlen by looping and
emulating the timeout logic, but I'm not inclined to do complex and
error-prone optimizations on a function that has so many underlying
problems it should really never be used.
src/network/recvmmsg.c
src/network/recvmsg.c