summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-02-10 10:32:51 +0000
committermpi <mpi@openbsd.org>2018-02-10 10:32:51 +0000
commitc33efb0726281535972115f69ef65cd8bc3854d2 (patch)
tree4065c76fbb335197291107bf99547d4bae6e4634 /sys/kern/kern_exit.c
parentRevert previous & incorrect NULL dereference fix. (diff)
downloadwireguard-openbsd-c33efb0726281535972115f69ef65cd8bc3854d2.tar.xz
wireguard-openbsd-c33efb0726281535972115f69ef65cd8bc3854d2.zip
Move cleanup job control bits to their own function.
Part of the larger 'proctreelk' diff from guenther@ No functional change, ok benno@, tedu@
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c44
1 files changed, 3 insertions, 41 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index a104c292386..dfd4e38078f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.163 2017/12/30 20:47:00 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.164 2018/02/10 10:32:51 mpi Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -117,8 +117,7 @@ exit1(struct proc *p, int rv, int flags)
{
struct process *pr, *qr, *nqr;
struct rusage *rup;
- struct vnode *ovp;
-
+
atomic_setbits_int(&p->p_flag, P_WEXIT);
pr = p->p_p;
@@ -184,44 +183,7 @@ exit1(struct proc *p, int rv, int flags)
#ifdef SYSVSEM
semexit(pr);
#endif
- if (SESS_LEADER(pr)) {
- struct session *sp = pr->ps_session;
-
- if (sp->s_ttyvp) {
- /*
- * Controlling process.
- * Signal foreground pgrp,
- * drain controlling terminal
- * and revoke access to controlling terminal.
- */
- if (sp->s_ttyp->t_session == sp) {
- if (sp->s_ttyp->t_pgrp)
- pgsignal(sp->s_ttyp->t_pgrp,
- SIGHUP, 1);
- ttywait(sp->s_ttyp);
- /*
- * The tty could have been revoked
- * if we blocked.
- */
- if (sp->s_ttyvp)
- VOP_REVOKE(sp->s_ttyvp,
- REVOKEALL);
- }
- ovp = sp->s_ttyvp;
- sp->s_ttyvp = NULL;
- if (ovp)
- vrele(ovp);
- /*
- * s_ttyp is not zero'd; we use this to
- * indicate that the session once had a
- * controlling terminal. (for logging and
- * informational purposes)
- */
- }
- sp->s_leader = NULL;
- }
- fixjobc(pr, pr->ps_pgrp, 0);
-
+ killjobc(pr);
#ifdef ACCOUNTING
acct_process(p);
#endif