Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
select: align poll emulation to return all relevant events #5883
The poll emulation via select already consumes POLLRDNORM,
Also fix indentation in input event handling block.
Assisted-by: Daniel Stenberg
jay left a comment
I don't know if this is right. For example you are always setting POLLRDNORM on POLLIN afterwards but afaics that flag was not necessarily set beforehand. My understanding of poll is it is only supposed to write bits that were passed in, with the exceptions noted below. I think I agree with @bagder maybe it's best to take a if it ain't broke don't fix it approach here.
from posix poll:
I don't think this is something that I am changing with this PR. The current code also sets POLLIN if that itself was not set, but instead POLLRDNORM was set. So I am basically extending it to be also the case the other way around. Of course, I can extend this PR to make sure to check for both flags being requested before setting them. Please see how the code already handles both types of flags on the pre-poll code path which I just want to reflect in the post-poll code path as well:
I somewhat agree on this, but I think the current code is partially broken, because it is not following the spec you referenced either. I will update this PR to reflect the spec even better.
The poll emulation via select already consumes POLLRDNORM, POLLWRNORM and POLLRDBAND as input events. Therefore it should also return them as output events if signaled. Also fix indentation in input event handling block. Assisted-by: Daniel Stenberg Assisted-by: Jay Satiro Replaces #5852 Closes #5883