svn commit: r187677 - head/sys/kern
Jeff Roberson
jroberson at jroberson.net
Sun Jan 25 12:03:52 PST 2009
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
>
More information about the svn-src-head
mailing list