Fix leakage of p_pgrp lock.

This commit is contained in:
Seigo Tanimura 2002-04-02 17:12:06 +00:00
parent bc3c153560
commit 2a60b9b951
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93679
2 changed files with 5 additions and 1 deletions

View File

@ -538,6 +538,8 @@ fork1(td, flags, procp)
FILEDESC_UNLOCK(p1->p_fd);
} else
fd = fdshare(p1);
PGRPSESS_XLOCK();
PGRP_LOCK(p1->p_pgrp);
PROC_LOCK(p2);
p2->p_fd = fd;
@ -570,6 +572,8 @@ fork1(td, flags, procp)
LIST_INSERT_AFTER(p1, p2, p_pglist);
PROC_UNLOCK(p1);
PROC_UNLOCK(p2);
PGRP_UNLOCK(p1->p_pgrp);
PGRPSESS_XUNLOCK();
/*
* Attach the new process to its parent.

View File

@ -2419,13 +2419,13 @@ ttyinfo(tp)
PGRP_UNLOCK(tp->t_pgrp);
ttyprintf(tp, "empty foreground process group\n");
} else {
PGRP_UNLOCK(tp->t_pgrp);
mtx_lock_spin(&sched_lock);
/* Pick interesting process. */
for (pick = NULL; p != 0; p = LIST_NEXT(p, p_pglist))
if (proc_compare(pick, p))
pick = p;
PGRP_UNLOCK(tp->t_pgrp);
td = FIRST_THREAD_IN_PROC(pick);
stmp = pick->p_stat == SRUN ? "running" : /* XXXKSE */