Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2016 23:00:49 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Boris Astardzhiev <boris.astardzhiev@gmail.com>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, net@freebsd.org, threads@freebsd.org
Subject:   Re: Does FreeBSD have sendmmsg or recvmmsg system calls?
Message-ID:  <20160119220049.GA56408@stack.nl>
In-Reply-To: <CAP=KkTzLCOnJVqt5F3ZuuZUiwkmWcne2Ynpi6-daE2jTzSBtfw@mail.gmail.com>
References:  <CAP=KkTwG0SVUmrBuWm33EC-tG4tMTdF5rLZQ_u6G1=-ujnfjkA@mail.gmail.com> <20160113080349.GC72455@kib.kiev.ua> <CAP=KkTxVaqZvigg78Dg%2Bv8kuTCaZyky8x15NHqD9uabuRKRkMw@mail.gmail.com> <20160116195657.GJ3942@kib.kiev.ua> <20160116202534.GK3942@kib.kiev.ua> <20160117211853.GA37847@stack.nl> <20160118044826.GS3942@kib.kiev.ua> <CAP=KkTy3J=k7hokGhohcGXv%2BWLnaxJmiAPxqmX9FHt7k0=Dp7Q@mail.gmail.com> <20160118140811.GW3942@kib.kiev.ua> <CAP=KkTzLCOnJVqt5F3ZuuZUiwkmWcne2Ynpi6-daE2jTzSBtfw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160119220049.GA56408>