Does FreeBSD have sendmmsg or recvmmsg system calls?
Jilles Tjoelker
jilles at stack.nl
Tue Jan 19 22:00:53 UTC 2016
On Tue, Jan 19, 2016 at 01:58:27PM +0200, Boris Astardzhiev wrote:
> I removed the pthread_testcancel() calls and cut the interposing
> stuff from my patch as suggested. I extended the send/recv(2) manpages
> regarding
> the mm calls. Comments and suggestions?
> [snip]
> diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
> index 7b3257c..724e1b4 100644
> --- a/lib/libc/sys/Symbol.map
> +++ b/lib/libc/sys/Symbol.map
> @@ -399,6 +399,8 @@ FBSD_1.4 {
> utimensat;
> numa_setaffinity;
> numa_getaffinity;
> + sendmmsg;
> + recvmmsg;
> };
OK.
>
> FBSDprivate_1.0 {
> @@ -1051,4 +1053,6 @@ FBSDprivate_1.0 {
> gssd_syscall;
> __libc_interposing_slot;
> __libc_sigwait;
> + _sendmmsg;
> + _recvmmsg;
> };
The _ versions need not be exported. Not exporting reduces code size and
improves performance.
> diff --git a/lib/libc/sys/recv.2 b/lib/libc/sys/recv.2
> index 326e7ff..81a0201 100644
> --- a/lib/libc/sys/recv.2
> +++ b/lib/libc/sys/recv.2
> [snip]
I think the recv.2 and send.2 man pages are long enough as they are, and
separate recvmmsg.3 and sendmmsg.3 pages will be clearer. This is also
because recvmmsg/sendmmsg can be ignored when performance is good enough
without them. This differs from what Konstantin thinks.
> diff --git a/lib/libc/sys/recvmmsg.c b/lib/libc/sys/recvmmsg.c
> new file mode 100644
> index 0000000..6b5158a
> --- /dev/null
> +++ b/lib/libc/sys/recvmmsg.c
> @@ -0,0 +1,72 @@
> [snip]
> +int
> +recvmmsg(int s, struct mmsghdr *msgvec, unsigned int vlen, int flags)
> +{
The Linux version has an additional parameter struct timespec *timeout
(but only for recvmmsg, not for sendmmsg). Note that implementing this
in a Linux-compatible manner has low overhead, since Linux only checks
it between packets and never interrupts a wait because of this timeout
(source: http://man7.org/linux/man-pages/man2/recvmmsg.2.html ).
> [snip]
--
Jilles Tjoelker
More information about the freebsd-net
mailing list