From owner-svn-src-head@FreeBSD.ORG Sun Jan 25 20:03:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EC64106566B; Sun, 25 Jan 2009 20:03:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id 65BBA8FC13; Sun, 25 Jan 2009 20:03:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rv-out-0506.google.com with SMTP id g9so388438rvb.3 for ; Sun, 25 Jan 2009 12:03:50 -0800 (PST) Received: by 10.141.153.16 with SMTP id f16mr730414rvo.283.1232913830488; Sun, 25 Jan 2009 12:03:50 -0800 (PST) Received: from ?10.0.1.199? (udp005586uds.hawaiiantel.net [72.234.105.237]) by mx.google.com with ESMTPS id b39sm3734004rvf.0.2009.01.25.12.03.47 (version=SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 12:03:49 -0800 (PST) Date: Sun, 25 Jan 2009 10:01:15 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Sam Leffler In-Reply-To: <497CC432.5010303@freebsd.org> Message-ID: <20090125095804.F983@desktop> References: <200901250724.n0P7OYd9009645@svn.freebsd.org> <497CC432.5010303@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187677 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 20:03:52 -0000 On Sun, 25 Jan 2009, Sam Leffler wrote: > Jeff Roberson wrote: >> Author: jeff >> Date: Sun Jan 25 07:24:34 2009 >> New Revision: 187677 >> URL: http://svn.freebsd.org/changeset/base/187677 >> >> Log: >> Fix errors introduced when I rewrote select. >> - Restructure selscan() and selrescan() to avoid producing extra selfps >> when we have a fd in multiple sets. As described below multiple >> selfps >> may still exist for other reasons. >> - Make selrescan() tolerate multiple selfds for a given descriptor >> set since sockets use two selinfos per fd. If an event on each >> selinfo >> fires selrescan() will see the descriptor twice. This could result in >> select() returning 2x the number of fds actually existing in fd sets. >> > > Can you clarify what the erroneous behaviour is? It appears the caller will > receive nfds set to 2x the actual number of descriptors marked in the bit > vectors? Was this identified because an application failed/misbehaved? If > so, and the application is public please identify it. Yes it was found via the ncftp3 port. They explicitly checked the select result against 1 since they knew they were selecting on one socket pending connect(). However the socket was both in the writable and except sets. The result wasn't always 2x the number of descriptors. Each descriptor that triggered an event was counted once for each set it was in. There shouldn't be any odd behavior except in those applications that specifically rely on return values other than -1 and > 1. Thanks, Jeff > > Sam >