proc: make clear_orphan an public API

This will be useful for other patches with process descriptors.
Change its name as well.

Reviewed by:	markj, kib
This commit is contained in:
Mariusz Zaborski 2019-07-29 21:42:57 +00:00
parent 8cf7941693
commit 9db97ca0bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350429
2 changed files with 7 additions and 6 deletions

View File

@ -167,8 +167,8 @@ reaper_clear(struct proc *p)
proc_id_clear(PROC_ID_REAP, p->p_reapsubtree);
}
static void
clear_orphan(struct proc *p)
void
proc_clear_orphan(struct proc *p)
{
struct proc *p1;
@ -522,7 +522,7 @@ exit1(struct thread *td, int rval, int signo)
* list due to present P_TRACED flag. Clear
* orphan link for q now while q is locked.
*/
clear_orphan(q);
proc_clear_orphan(q);
q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE);
q->p_flag2 &= ~P2_PTRACE_FSTP;
q->p_ptevents = 0;
@ -556,7 +556,7 @@ exit1(struct thread *td, int rval, int signo)
kern_psignal(q, q->p_pdeathsig);
CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid,
q->p_pid);
clear_orphan(q);
proc_clear_orphan(q);
PROC_UNLOCK(q);
}
@ -912,7 +912,7 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options)
reaper_clear(p);
proc_id_clear(PROC_ID_PID, p->p_pid);
PROC_LOCK(p);
clear_orphan(p);
proc_clear_orphan(p);
PROC_UNLOCK(p);
leavepgrp(p);
if (p->p_procdesc != NULL)
@ -1372,7 +1372,7 @@ proc_reparent(struct proc *child, struct proc *parent, bool set_oppid)
LIST_REMOVE(child, p_sibling);
LIST_INSERT_HEAD(&parent->p_children, child, p_sibling);
clear_orphan(child);
proc_clear_orphan(child);
if (child->p_flag & P_TRACED) {
if (LIST_EMPTY(&child->p_pptr->p_orphans)) {
child->p_treeflag |= P_TREE_FIRST_ORPHAN;

View File

@ -1074,6 +1074,7 @@ void proc_wkilled(struct proc *p);
struct pstats *pstats_alloc(void);
void pstats_fork(struct pstats *src, struct pstats *dst);
void pstats_free(struct pstats *ps);
void proc_clear_orphan(struct proc *p);
void reaper_abandon_children(struct proc *p, bool exiting);
int securelevel_ge(struct ucred *cr, int level);
int securelevel_gt(struct ucred *cr, int level);