From owner-svn-src-all@FreeBSD.ORG Mon Nov 2 15:09:04 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 5229310656C5; Mon, 2 Nov 2009 15:09:04 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 1067B8FC27; Mon, 2 Nov 2009 15:09:03 +0000 (UTC) Received: from [192.168.1.4] (adsl-150-102-19.bna.bellsouth.net [72.150.102.19]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id nA2F8wRT020125 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 2 Nov 2009 10:09:01 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Robert Watson In-Reply-To: References: <200911020721.nA27LDq1048764@svn.freebsd.org> Content-Type: text/plain; charset="iso-2022-jp" Organization: FreeBSD Date: Mon, 02 Nov 2009 09:08:53 -0600 Message-Id: <1257174533.73292.10.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival 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:09:04 -0000 On Mon, 2009-11-02 at 15:00 +0000, Robert Watson wrote: > 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. I don't think we have any business documenting what linux does or does not do. As much as I would hate to see someone wasting time finding this linux bug, we should only document our own behavior. Hopefully we at least have a hope of keeping that information accurate. robert. > 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 > > -- Robert Noland FreeBSD