On Thu, 2012-10-18 at 14:40 +0200, Samuel Thibault wrote: > Svante Signell, le Thu 18 Oct 2012 14:33:53 +0200, a écrit : > > with errors specified by: > > > > ERRORS > > POSIX does not document all errors that may happen, it's completely > valid to fail for other errors.
Yes, of course. > > POLLNVAL > > The specified fd value is invalid. This flag is only valid in > > the revents member; it shall ignored in the events member. > > > > Specifically, my interpretation of POLLNVAL is that it should be > > reported for each invalid fd given as input. > > Ah. You should have pointed to that from the start :) The changes I made was 15 months ago, and I did not remember by heart when sending my code, sorry. Refreshing memory and reading POSIX specs and manpages and digesting takes some time. > > And my interpretation of POLLERR is that it should be reported to > > _every_ fd (device or stream) given as input. > > > > And for these cases the return code should be the number of good fds as > > well as bad fds, since the revents member is nonzero. (I did not come > > that far in my changes by then, but it could easily be done with today's > > knowledge! There are also other case to take care of like: POLLWRBAND > > etc) > > Indeed. That's also what was completely missing in your previous > description. It's indeed a bug. And it has to be fixed in poll only, not > in select. I can try to make an update to that code if you are interested ;)