[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

select()



hi.
can anyone tell me what's the significance of the first param of select() - nfds.
when we're passing the fds to be watched anyway thru FD_SET(). looking at the
kernel source (2.4.0-test2), in do_select(), there is a loop from 0 to nfds, 
checking _every_ fd. Is this necessary, even when the fds to be watched are 
explicitly provided by FD_SET()?

set_current_state(TASK_INTERRUPTIBLE);

at /usr/src/linux/fs/select.c:193 do_select() 

this saves a little loss of face, but i still dont get the point behind looping
thru all the fds. If i wanted to watch 2 fds with comparitively high margin between
them, select() would loop unnecessarily thru the intermediary fds, which seems
like a waste of time to me. plz. tell me if i'm wrong somewhere...

Nikhil.