On Thu, Mar 13, 2003 at 06:50:18PM +0200, Enache Adrian wrote: >I have no benchmarks, but judging after the way things are implemented >in the FreeBSD kernel, select() is definitely faster.
Can you explain what leads you to make this statement please. >Please someone explain me what is meant in select(2) by: > > If nfds is greater than the number of open files, select() is not guaran- > teed to examine the unused file descriptors. For historical reasons, > select() will always examine the first 256 descriptors. The second sentence appears to be an error. I can't find anything in the current code (or previous versions) that suggests select() would ever examine more than nfd FDs. The only reference to 256 is can find is that FD_SETSIZE used to be 256 and select() used to return EINVAL if nfd > FD_SETSIZE. As for the first sentence, select() should return EBADF if any of the fd_set arguments has a set bit that references an invalid (eg closed) FD. The actual implementation restricts nfd to the highest open FD plus one. To explain further, consider a with FDs 0-60 open. If you pass a fd_set with FDs 0-61 set and nfd = 62, it will scan FDs 0-60 and ignore the bit for FD 61 (ie it will still be set on return). Peter To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message