* delete a process group */
| 772 | * delete a process group |
| 773 | */ |
| 774 | static void |
| 775 | pgdelete(struct pgrp *pgrp) |
| 776 | { |
| 777 | struct session *savesess; |
| 778 | struct tty *tp; |
| 779 | |
| 780 | sx_assert(&proctree_lock, SX_XLOCKED); |
| 781 | PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); |
| 782 | SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); |
| 783 | |
| 784 | /* |
| 785 | * Reset any sigio structures pointing to us as a result of |
| 786 | * F_SETOWN with our pgid. The proctree lock ensures that |
| 787 | * new sigio structures will not be added after this point. |
| 788 | */ |
| 789 | funsetownlst(&pgrp->pg_sigiolst); |
| 790 | |
| 791 | PGRP_LOCK(pgrp); |
| 792 | tp = pgrp->pg_session->s_ttyp; |
| 793 | LIST_REMOVE(pgrp, pg_hash); |
| 794 | savesess = pgrp->pg_session; |
| 795 | PGRP_UNLOCK(pgrp); |
| 796 | |
| 797 | /* Remove the reference to the pgrp before deallocating it. */ |
| 798 | if (tp != NULL) { |
| 799 | tty_lock(tp); |
| 800 | tty_rel_pgrp(tp, pgrp); |
| 801 | } |
| 802 | |
| 803 | proc_id_clear(PROC_ID_GROUP, pgrp->pg_id); |
| 804 | uma_zfree(pgrp_zone, pgrp); |
| 805 | sess_release(savesess); |
| 806 | } |
| 807 | |
| 808 | |
| 809 | static void |
no test coverage detected