From owner-freebsd-net@freebsd.org Mon Jan 4 09:11:09 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 08335A610D7 for ; Mon, 4 Jan 2016 09:11:09 +0000 (UTC) (envelope-from c2h@romeo.emu.st) Received: from f5.bushwire.net (f5.bushwire.net [IPv6:2607:fc50:1000:5b00::2]) by mx1.freebsd.org (Postfix) with ESMTP id E3C741C19 for ; Mon, 4 Jan 2016 09:11:08 +0000 (UTC) (envelope-from c2h@romeo.emu.st) Received: by f5.bushwire.net (Postfix, from userid 1001) id 3B13FAC908; Mon, 4 Jan 2016 01:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=emu.st; s=2015; t=1451898668; bh=xK/JFgpB6GjEP0bfLOfA82gd7Cc=; h=Comments:Received:Date:Message-ID:From:To:Subject:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=setqhAqjkvtn9f67jXnTlJrp/4/25/0R66rwpqM9meLUuTlV4fj7NxL+KgU19gOeE N7Oe88zuWght9Daka8W6gsvjdMiA4B3b37yIu96XR6yBBC+sv1WIfa428d9GquAcD5 xedeSX8sLfgrTVuF5dkKcIZk1OPyC+skN2XqPjDk=qPjDk= Comments: QMDA 0.3 Received: (qmail 50655 invoked by uid 1001); 4 Jan 2016 09:11:08 -0000 Date: 4 Jan 2016 09:11:08 +0000 Message-ID: <20160104091108.50654.qmail@f5-external.bushwire.net> From: "Mark Delany" To: freebsd-net@freebsd.org Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? References: <1451841004.10139.34.camel@me.com> <20160103214720.72014.qmail@f5-external.bushwire.net> <20160104085415.GS3625@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160104085415.GS3625@kib.kiev.ua> 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: Mon, 04 Jan 2016 09:11:09 -0000 On 04Jan16, Konstantin Belousov allegedly wrote: > On Sun, Jan 03, 2016 at 09:47:20PM +0000, Mark Delany wrote: > > Eg, if a signal arrives after > > more than zero packets have been processed by recvmmsg() what is the > > correct return value? -1 or the count of messages returned? > > This is really not a question to consider different answers. Unix > already made a (right, IMO) decision there, e.g. for read(2) syscall. > If any data was actually read, the length of the consumed data must be > returned, and not the error. So the error is lost? In that case, recvmmsg() is not the same as an iteration over recvmsg(). Besides, a signal isn't necessarily an error. Think SIGALRM. The point is that recvmmsg() may have populated the struct mmsghdr* with a number of inbound messages then it is interrupted by a signal. It then has a choice of telling user space that it has 'n' messages to be processed or -1/EINTR that a signal occurred. If the choice is the former, then the signal is lost. If the choice is the latter then 'n' messages are lost. There is no return possible which indicates that there are messages *and* a signal. Thinking out loud here: are there any other "batch" system calls like recvmmsg() that can offer guidance? Mark.