From owner-freebsd-net@freebsd.org Mon Jan 4 19:40:51 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 8369EA619D9 for ; Mon, 4 Jan 2016 19:40:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01C941C1C for ; Mon, 4 Jan 2016 19:40:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u04JejpY078017 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 4 Jan 2016 21:40:45 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u04JejpY078017 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u04JeiU3077986; Mon, 4 Jan 2016 21:40:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Jan 2016 21:40:44 +0200 From: Konstantin Belousov To: Mark Delany Cc: freebsd-net@freebsd.org Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? Message-ID: <20160104194044.GD3625@kib.kiev.ua> References: <1451841004.10139.34.camel@me.com> <20160103214720.72014.qmail@f5-external.bushwire.net> <20160104085415.GS3625@kib.kiev.ua> <20160104091108.50654.qmail@f5-external.bushwire.net> <20160104093859.GV3625@kib.kiev.ua> <20160104101747.58347.qmail@f5-external.bushwire.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160104101747.58347.qmail@f5-external.bushwire.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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 19:40:51 -0000 On Mon, Jan 04, 2016 at 10:17:47AM +0000, Mark Delany wrote: > > Why is a signal lost in the scenario you described ? > > Because the return can only indicate a signal/error *or* a batch of > messages but not both and the semantics of recvmsg() means that both > could occur. > > Don't just consider signals, consider any -1/errno return from > recvmsg() such as -1/EAGAIN or -1/ENOBUFS or -1/EFAULT. > > If one emulates recvmmsg() via multiple calls to recvmsg() and the > emulation receives 'n' messages via recvmsg() then gets a -1/EFAULT > return on message 'n'+1 then what does it return to the caller? > > If it returns 'n' messages then the EFAULT is lost. > > If it returns -1/EFAULT then the 'n' messages are lost. You just repeat arguments for the text in my messages, which you removed on reply. Of course, it is unacceptable to loose the received data. Of course, the EFAULT or other similar error would be encountered on the next call. If it is not encountered because user passed other buffer, it is even better. If the issue is with the socket state itself, then the error will be reported on next call, as it is done for all other socket functions. This is how the system works already.