From owner-svn-src-all@FreeBSD.ORG Mon Nov 2 15:00:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 266A6106568D; Mon, 2 Nov 2009 15:00:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F296E8FC1B; Mon, 2 Nov 2009 15:00:39 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 8E32546B46; Mon, 2 Nov 2009 10:00:39 -0500 (EST) Date: Mon, 2 Nov 2009 15:00:39 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Colin Percival In-Reply-To: <200911020721.nA27LDq1048764@svn.freebsd.org> Message-ID: References: <200911020721.nA27LDq1048764@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-1518405475-1257174039=:37561" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198781 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 15:00:40 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-1518405475-1257174039=:37561 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 2 Nov 2009, Colin Percival wrote: > Attempt to reduce accidental foot-shooting by pointing out that > accept(2)ed sockets do not necessarily inherit O_NONBLOCK from > listening sockets on non-FreeBSD platforms. I wonder how much trouble we should go to to document bugs in other systems as non-portabilities for features that work in our system. This bug in Linux was brought to my attention recently: SO_RCVLOWAT and SO_SNDLOWAT Specify the minimum number of bytes in the buffer until the socket layer will pass the data to the protocol (SO_SNDLOWAT) or the user on receiving (SO_RCVLOWAT). These two values are ini‐ tialized to 1. SO_SNDLOWAT is not changeable on Linux (setsock‐ opt(2) fails with the error ENOPROTOOPT). SO_RCVLOWAT is changeable only since Linux 2.4. The select(2) and poll(2) sys‐ tem calls currently do not respect the SO_RCVLOWAT setting on Linux, and mark a socket readable when even a single byte of data is available. A subsequent read from the socket will block until SO_RCVLOWAT bytes are available. I think a more general caution for accept(2) might instead be: BUGS The inheritence of socket options from a listen socket to a newly accepted socket is inconsistent across protocols, and non-portable. Robert > > Feet shot: cperciva > MFC after: 1 month > > Modified: > head/lib/libc/sys/accept.2 > > Modified: head/lib/libc/sys/accept.2 > ============================================================================== > --- head/lib/libc/sys/accept.2 Mon Nov 2 06:36:54 2009 (r198780) > +++ head/lib/libc/sys/accept.2 Mon Nov 2 07:21:13 2009 (r198781) > @@ -126,6 +126,10 @@ new socket. > For some applications, performance may be enhanced by using an > .Xr accept_filter 9 > to pre-process incoming connections. > +.Pp > +Portable programs should not rely on the > +.Dv O_NONBLOCK > +property being inherited. > .Sh RETURN VALUES > The call returns \-1 on error. > If it succeeds, it returns a non-negative > --621616949-1518405475-1257174039=:37561--