-/* $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 $ */
/*
{
struct process *pr, *qr, *nqr;
struct rusage *rup;
- struct vnode *ovp;
-
+
atomic_setbits_int(&p->p_flag, P_WEXIT);
pr = p->p_p;
#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
-/* $OpenBSD: kern_proc.c,v 1.79 2017/12/30 20:47:00 guenther Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.80 2018/02/10 10:32:51 mpi Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
#include <sys/tty.h>
#include <sys/signalvar.h>
#include <sys/pool.h>
+#include <sys/vnode.h>
#define UIHASH(uid) (&uihashtbl[(uid) & uihash])
LIST_HEAD(uihashhead, uidinfo) *uihashtbl;
}
}
+void
+killjobc(struct process *pr)
+{
+ if (SESS_LEADER(pr)) {
+ struct session *sp = pr->ps_session;
+
+ if (sp->s_ttyvp) {
+ struct vnode *ovp;
+
+ /*
+ * 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);
+}
+
/*
* A process group has become orphaned;
* if there are any stopped processes in the group,
-/* $OpenBSD: proc.h,v 1.244 2017/12/19 10:04:59 stefan Exp $ */
+/* $OpenBSD: proc.h,v 1.245 2018/02/10 10:32:51 mpi Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
void fixjobc(struct process *, struct pgrp *, int);
int inferior(struct process *, struct process *);
void leavepgrp(struct process *);
+void killjobc(struct process *);
void preempt(void);
void pgdelete(struct pgrp *);
void procinit(void);