Roman Rakus wrote:
To see if we created a process in execute_simple_command that we need
to wait for. The presence of non-Unix systems that tend to recycle
pids quickly (or allocate at random from a small pool) makes the check
unreliable, so we call wait_for every time.
Yes, but don't we see it if already_making_children is set to 1?
That's not what that variable means.
Yes, kernel will give you that pid, if pid numbers are out of 32768 (or
number set in /proc/sys/kernel/pidmax).
I think, if we define RECYCLE_PIDS we will solve this problem and don't
introduce any other.
If Linux behaves that way, then defining RECYCLES_PIDS is appropriate --
that's why it was introduced. Unix systems don't work that way, which
is why it's not enabled by default.
This makes it difficult to meet the Posix requirement that the shell keep
the last CHILD_MAX exit statuses, but there is language that allows
overwriting in the face of this kind of pid reuse.
Chet