Fix minor TTY API inconsistency.

Unlike tty_rel_gone() and tty_rel_sess(), the tty_rel_pgrp() routine
does not unlock the TTY. I once had the idea to make the code call
tty_rel_pgrp() and tty_rel_sess(), picking up the TTY lock once. This
turned out a little harder than I expected, so this is how it works now.

It's a lot easier if we just let tty_rel_pgrp() unlock the TTY, because
the other routines do this anyway.
This commit is contained in:
Ed Schouten 2008-09-16 14:57:23 +00:00
parent 6aa5a19391
commit 42ff2756c7
2 changed files with 3 additions and 1 deletions

View File

@ -506,7 +506,6 @@ pgdelete(pgrp)
if (tp != NULL) {
tty_lock(tp);
tty_rel_pgrp(tp, pgrp);
tty_unlock(tp);
}
mtx_destroy(&pgrp->pg_mtx);

View File

@ -940,10 +940,13 @@ tty_rel_free(struct tty *tp)
void
tty_rel_pgrp(struct tty *tp, struct pgrp *pg)
{
MPASS(tp->t_sessioncnt > 0);
tty_lock_assert(tp, MA_OWNED);
if (tp->t_pgrp == pg)
tp->t_pgrp = NULL;
tty_unlock(tp);
}
void