[PATCH] pselect: Use linux pselect syscall when available

Rich Felker dalias at libc.org
Fri Dec 18 18:37:35 UTC 2015


On Thu, Dec 17, 2015 at 09:05:48PM +0100, Waldemar Brodkorb wrote:
> Hi Nicolas,
> Nicolas S. Dade wrote,
> 
> > Linux has a pselect syscall since 2.6.something. Using it
> > rather than emulating it with sigprocmask+select+sigprocmask
> > is smaller code, and works properly. (The emulation has
> > race conditions when unblocked signals arrive before or
> > after the select)
> 
> Did you see the race condition in real code or do you have 
> a testcase for it?

The race conditions should be easy to reproduce since you have a
relatively huge syscall-latency-length (several us) window to race
with. Fake pselect implementations are historically known to be
harmful; the whole reason pselect was invented was to fix these races
in old code that used sigprocmask followed by select.

Rich


More information about the uClibc mailing list