]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Don't clobber td->td_retval[0] in proc_reap().
authorEd Schouten <ed@FreeBSD.org>
Thu, 9 Jul 2015 12:04:45 +0000 (12:04 +0000)
committerEd Schouten <ed@FreeBSD.org>
Thu, 9 Jul 2015 12:04:45 +0000 (12:04 +0000)
commit3a41ec6af7038d2766472fefccb07b74d1136f1c
tree2b08d2e351864d68154542afbe2045a9ad438a47
parent6c03ba71f8eb3b7b9fe56d325a6a66123549aba5
Don't clobber td->td_retval[0] in proc_reap().

While writing tests for CloudABI, I noticed that close() on process
descriptors returns the process ID of the child process. This is
interesting, as close() is only allowed to return 0 or -1. It turns out
that we clobber td->td_retval[0] in proc_reap(), so that wait*()
properly returns the process ID.

Change proc_reap() to leave td->td_retval[0] alone. Set the return value
in kern_wait6() instead, by keeping track of the PID before we
(potentially) reap the process.

Differential Revision: https://reviews.freebsd.org/D3032
Reviewed by: kib
sys/kern/kern_exit.c