Commit Graph

7 Commits

Author SHA1 Message Date
Darren Tucker
b6255593ed Increment nfds when coming from startup_pipe.
If we have to increase nfds because startup_pipe[0] is above any of the
descriptors passed in the fd_sets, we also need to add 1 to nfds since
select takes highest FD number plus one.  bz#3345 from yaroslav.kuzmin
at vmssoftware.com.
2021-09-08 18:39:44 +10:00
Darren Tucker
9a2ed62173 Also check pid in pselect_notify_setup.
Spotted by djm@.
2021-08-20 10:48:13 +10:00
Darren Tucker
deaadcb93c Prefix pselect functions to clarify debug messages 2021-08-20 08:39:33 +10:00
Darren Tucker
10e45654cf Fix race in pselect replacement code.
On the second and subsequent calls to pselect the notify_pipe was not
added to the select readset, opening up a race that om G. Christensen
discovered on multiprocessor Solaris <=9 systems.

Also reinitialize notify_pipe if the pid changes.  This will prevent a
parent and child from using the same FD, although this is not an issue
in the current structure it might be in future.
2021-08-20 08:30:42 +10:00
Darren Tucker
aa99b2d9a3 Clear notify_pipe from readset if present.
Prevents leaking an implementation detail to the caller.
2021-06-04 23:41:29 +10:00
Darren Tucker
6de8dadf6b space->tabs. 2021-06-04 23:24:25 +10:00
Darren Tucker
c867706507 Add pselect implementation for platforms without.
This is basically the existing notify_pipe kludge from serverloop.c
moved behind a pselect interface.  It works by installing a signal
handler that writes to a pipe that the select is watching, then calls
the original handler.

The select call in serverloop will become pselect soon, at which point the
kludge will be removed from thereand will only exist in the compat layer.
Original code by markus, help from djm.
2021-06-04 18:39:48 +10:00