From owner-cvs-src@FreeBSD.ORG Tue Oct 7 22:40:19 2008 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A687106569A; Tue, 7 Oct 2008 22:40:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0B71D8FC26; Tue, 7 Oct 2008 22:40:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m97Me1Zt046445; Tue, 7 Oct 2008 18:40:13 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Robert Watson Date: Tue, 7 Oct 2008 17:36:50 -0400 User-Agent: KMail/1.9.7 References: <200810072058.m97Kw3q0073534@repoman.freebsd.org> In-Reply-To: <200810072058.m97Kw3q0073534@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200810071736.50999.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 07 Oct 2008 18:40:13 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8387/Tue Oct 7 11:37:07 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern uipc_socket.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2008 22:40:19 -0000 On Tuesday 07 October 2008 04:57:55 pm Robert Watson wrote: > rwatson 2008-10-07 20:57:55 UTC >=20 > FreeBSD src repository >=20 > Modified files: > sys/kern uipc_socket.c=20 > Log: > SVN rev 183675 on 2008-10-07 20:57:55Z by rwatson > =20 > In soreceive_dgram, when a 0-length buffer is passed into recv(2) and > no data is ready, return 0 rather than blocking or returning EAGAIN. > This is consistent with the behavior of soreceive_generic (soreceive) > in earlier versions of FreeBSD, and restores this behavior for UDP. > =20 > Discussed with: jhb, sam > MFC after: 3 days I do find this behavior odd though. I would expect recv(fd, NULL, 0) to discard the next packet from the socket if one is available rather than= =20 returning success and not doing anything (and it seems that this is what it= =20 does both before and now). Similarly, I would expect recv(fd, NULL, 0) to= =20 block on a blocking socket if there isn't a packet available. It would be= =20 orthogonal then to return EAGAIN in this case (no packet available,=20 zero-length user buffer) on a non-blocking socket. It seems that Solaris dropped this behavior (return 0) from their recv()=20 system call sometime after SunOS 4.0 from comments in the OpenSolaris sourc= e. =20 =46rom reading __skb_recv_datagram(), it seems that Linux 2.6 returns EAGAI= N. =20 NetBSD and OS X both have the odd behavior. OpenBSD has the odd behavior,= =20 but with a caveat of sorts having to do with control messages. OpenBSD=20 cvsweb annotate is down though, so I haven't found the reason for their=20 change. =2D-=20 John Baldwin