the exiting thread instead of assuming that that's ps_mainproc.
Also, panic no matter which thread of init takes it down.
ok tedu@
-/* $OpenBSD: kern_event.c,v 1.56 2014/03/30 21:54:48 guenther Exp $ */
+/* $OpenBSD: kern_event.c,v 1.57 2014/05/15 04:43:25 guenther Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
* XXX this could be more efficient, doing a single pass down the klist
*/
void
-knote_processexit(struct process *pr)
+knote_processexit(struct proc *p)
{
+ struct process *pr = p->p_p;
+
KNOTE(&pr->ps_klist, NOTE_EXIT);
/* remove other knotes hanging off the process */
- knote_remove(pr->ps_mainproc, &pr->ps_klist);
+ knote_remove(p, &pr->ps_klist);
}
void
-/* $OpenBSD: kern_exit.c,v 1.141 2014/05/15 03:52:25 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.142 2014/05/15 04:43:25 guenther 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;
-
- if (p->p_pid == 1)
- panic("init died (signal %d, exit %d)",
- WTERMSIG(rv), WEXITSTATUS(rv));
atomic_setbits_int(&p->p_flag, P_WEXIT);
}
if (flags == EXIT_NORMAL) {
+ if (pr->ps_pid == 1)
+ panic("init died (signal %d, exit %d)",
+ WTERMSIG(rv), WEXITSTATUS(rv));
+
atomic_setbits_int(&pr->ps_flags, PS_EXITING);
pr->ps_mainproc->p_xstat = rv;
ruadd(rup, &pr->ps_cru);
/* notify interested parties of our demise and clean up */
- knote_processexit(pr);
+ knote_processexit(p);
/*
* Notify parent that we're gone. If we're not going to
-/* $OpenBSD: event.h,v 1.19 2013/08/13 05:52:26 guenther Exp $ */
+/* $OpenBSD: event.h,v 1.20 2014/05/15 04:43:25 guenther Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
extern void knote_activate(struct knote *);
extern void knote_remove(struct proc *p, struct klist *list);
extern void knote_fdclose(struct proc *p, int fd);
-extern void knote_processexit(struct process *);
+extern void knote_processexit(struct proc *);
extern int kqueue_register(struct kqueue *kq,
struct kevent *kev, struct proc *p);
extern int filt_seltrue(struct knote *kn, long hint);