int select(int nfds,
fd_set *readfds,
fd_set *writefds,
fd_set *exceptfds,
struct timeval *timeout);
The first parameter of select
, nfds
, is supposed to be the maximum file descriptor plus 1, which should be at least 1.
But I have seen some codes set nfds to be 0, is this usage legal?
Plus, the return value of select
is set to EINVAL
when nfds
is negative or timeout
contains invalid value. Again, it does not specify what happened when nfds
is 0.