On 2015-10-12 01:33, Paul Goyette wrote:
The attached patch should handle this. It takes out the proc_lock and
then updates the process's p_stat, p_waited, and parent's p_nstopchild
with the lock held. It then releases the lock.
In the normal exit case, it reacquires the lock and restores p_stat to
its previous value (which almost certainly is SACTIVE, since that's
the value that do_posix_spawn() set, before dispatching the new lwd
for scheduling).
In the several error cases, we go to a new error-exit code where we
again reacquire proc_lock and restore p_stat and p_nstopchild before
continuing with the rest of the error path.
Note that this change has the effect of restoring p_stat in the error
branch. This should not be an issue, since the error code will very
soon call exit1() where the process will be properly disposed.
Note that I have not tested this patch yet, not even compile-test. I
would appreciate additional eyes to review this.
:)
Updated patch attached. This one compiles, and I added a KASSERT on
the value of ostat (original p_stat) before updating it.
I have recorded this in PR kern/50330 for this. I will request
pull-ups to -6 and -7. The posix_spawn code doesn't exist in -5 so
no need to pullup there.
Sorry for hijacking this thread, but this reminded me of something else.
I cannot build NetBSD-6 or NetBSD-7 cleanly under NetBSD-5, since the
building of xinstall assumes I have posix_spawn, which cause the whole
build to fail.
(Why do xinstall blindly assume that I have posix_spawn?)
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: b...@softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol