From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 18 19:40:39 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EFF7216A4D1; Tue, 18 Jan 2005 19:40:38 +0000 (GMT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71E8443D48; Tue, 18 Jan 2005 19:40:38 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.1/8.13.1) with ESMTP id j0IJeSul043765; Tue, 18 Jan 2005 11:40:32 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200501181940.j0IJeSul043765@gw.catspoiler.org> Date: Tue, 18 Jan 2005 11:40:28 -0800 (PST) From: Don Lewis To: dwmalone@maths.tcd.ie In-Reply-To: <20050118191349.GA43822@walton.maths.tcd.ie> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: freebsd-hackers@FreeBSD.org cc: freebsd-emulation@FreeBSD.org cc: killing@multiplay.co.uk Subject: Re: Patch for linux ABI for MSG_NOSIGNAL and out of order tcp packet issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2005 19:40:39 -0000 On 18 Jan, David Malone wrote: > On Tue, Jan 18, 2005 at 03:18:42PM -0000, Steven Hartland wrote: >> The attached patch checks for >> MSG_NOSIGNAL and if set enables SO_NOSIGPIPE >> for the duration of send call. > > I just had a quick look at the patch. The patch should probably > use kern_setsockopt, which will simplify it considerably. > (kern_setsockopt was introduced to FreeBSD 5 this summer to make > it easier to do this sort of thing). It would probably also be > better to do a kern_getsockopt first to find out if SO_NOPIPE is > set and only turn it off afterwards if it wasn't already on. > >> Im not 100% sure this is the >> way to do it but have confirmed that the patch works on >> 5.2.1 so if someone could check and commit it that would >> be great. > > I guess that it would be even better if we could just pass > SO_NOPIPE to send, or even implement MSG_NOSIGNAL on FreeBSD, > but your patch is probably a reasonably start. That's probably the best solution. We did the same thing to properly implement non-blocking I/O on fifos. Setting and clearing the socket option for each syscall adds a lot of overhead, and there is also danger that some other thread could be modifying the option at the same time.