Convert several callers to use fget_procdesc(). Eliminate procdesc_find() and directly use fget_procdesc() in sys_pdkill(). Previous code structure required to fdrop() procdesc while the process is locked.
Details
- Reviewers
markj kevans - Commits
- rG97de8330e168: kern: add fget_procdesc()
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
| sys/kern/sys_procdesc.c | ||
|---|---|---|
| 118–119 | Can we also use the new helper here? | |
| sys/kern/sys_procdesc.c | ||
|---|---|---|
| 118–119 | The current structure makes the fdrop() call under the process lock. I eliminated procdesc_find() altogether. | |
Fix all places that called fdrop() under proctree_lock.
Add herald comment for fget_procdesc().
Hold target around pddupfd() core.
Simplify the function.
Update assert about proctree_lock in fget_procdesc().
| sys/kern/sys_procdesc.c | ||
|---|---|---|
| 716 | So the caller may need to fdrop() even if fget_procdesc() returns an error. Why not just make fget_procdesc() call fdrop() directly in this error case? That makes callers a bit simpler. For instance there is a bug in sys_pdkill(): if the fget_procdesc()->fget() call fails, sys_pdkill() calls fdrop(NULL). | |
| sys/sys/procdesc.h | ||
| 115–117 | The indentation here looks inconsistent. | |
Better conversion for kern_pdwait(), drop the req to lock proctree_lock when the process is not requested.
| sys/kern/sys_procdesc.c | ||
|---|---|---|
| 766 | It was intended. The multi-line comment describes the execve_block+p_candebug() guarantees. After the block for which the comment is applicable, there should be a blank line. | |