Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Dec 1996 18:05:53 -0500
From:      Bakul Shah <bakul@plexuscom.com>
To:        John Birrell <jb@cimlogic.com.au>
Cc:        hackers@freebsd.org
Subject:   Re: poll(2) 
Message-ID:  <199612092305.SAA01955@chai.plexuscom.com>
In-Reply-To: Your message of "Tue, 10 Dec 1996 08:18:03 %2B1100." <199612092118.IAA10527@freebsd1.cimlogic.com.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> There are a few things that NetBSD has added recently that belong (IMHO)
> in FreeBSD too. One of them is poll(2), which gives an alternative to
> select(2) that does not suffer from the FD_SETSIZE "feature".

Note that the 2.2 kernel does not have this limitation
(kern/sys_generic.c:select() allocates space as necessary for the
three bitstrings).  You can compile user programs with FD_SETSIZE
different from the default of 256.  You can even use different size
bitstrings in the same program in different select() calls but you
have to cast fd_mask* to fd_set*

There are other reasons why poll() can be preferable to select():
- it does not overwrite the input arguments
- it is more efficient when the fd set being tested is a small
  subset of the total fds in use.
- fds are not serviced from the lowest numbered fd to the highest.
  (servicing by the increasing fd number implicitly favors the lower
  numbered fds.)
- more conditions per fd can be tested.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612092305.SAA01955>