From owner-freebsd-net@freebsd.org Tue Jan 19 22:00:53 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83416A895B8 for ; Tue, 19 Jan 2016 22:00:53 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 6FCFD1F91 for ; Tue, 19 Jan 2016 22:00:53 +0000 (UTC) (envelope-from jilles@stack.nl) Received: by mailman.ysv.freebsd.org (Postfix) id 6B7D3A895B7; Tue, 19 Jan 2016 22:00:53 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AE6EA895B5; Tue, 19 Jan 2016 22:00:53 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 364741F8E; Tue, 19 Jan 2016 22:00:53 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 9B1AFB8059; Tue, 19 Jan 2016 23:00:49 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 86B1828494; Tue, 19 Jan 2016 23:00:49 +0100 (CET) Date: Tue, 19 Jan 2016 23:00:49 +0100 From: Jilles Tjoelker To: Boris Astardzhiev Cc: Konstantin Belousov , net@freebsd.org, threads@freebsd.org Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? Message-ID: <20160119220049.GA56408@stack.nl> References: <20160113080349.GC72455@kib.kiev.ua> <20160116195657.GJ3942@kib.kiev.ua> <20160116202534.GK3942@kib.kiev.ua> <20160117211853.GA37847@stack.nl> <20160118044826.GS3942@kib.kiev.ua> <20160118140811.GW3942@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 22:00:53 -0000 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