Eliminate PS_NOTIFYSTOP remnants from the kernel

This flag used to be useful in /proc (BSD4.4-style) debugging semantics.
Traced child events were notified without signaling the parent.

This property was removed in NetBSD-8.0 and had no users.

This change simplifies the signal code, removing dead branches.

NFCI
This commit is contained in:
kamil 2019-06-21 01:03:51 +00:00
parent 35a9731f3d
commit 21a72dea25
2 changed files with 15 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $ */
/* $NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $");
#include "opt_ptrace.h"
#include "opt_dtrace.h"
@ -1534,7 +1534,7 @@ proc_stop_lwps(struct proc *p)
/*
* Finish stopping of a process. Mark it stopped and notify the parent.
*
* Drop p_lock briefly if PS_NOTIFYSTOP is set and ppsig is true.
* Drop p_lock briefly if ppsig is true.
*/
static void
proc_stop_done(struct proc *p, int ppmask)
@ -1549,11 +1549,10 @@ proc_stop_done(struct proc *p, int ppmask)
p->p_stat = SSTOP;
p->p_waited = 0;
p->p_pptr->p_nstopchild++;
if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
/* child_psignal drops p_lock briefly. */
child_psignal(p, ppmask);
cv_broadcast(&p->p_pptr->p_waitcv);
}
/* child_psignal drops p_lock briefly. */
child_psignal(p, ppmask);
cv_broadcast(&p->p_pptr->p_waitcv);
}
/*
@ -2251,7 +2250,7 @@ proc_stop(struct proc *p, int signo)
* LWPs to a halt so they are included in p->p_nrlwps. We musn't
* unlock between here and the p->p_nrlwps check below.
*/
p->p_sflag |= PS_STOPPING | PS_NOTIFYSTOP;
p->p_sflag |= PS_STOPPING;
membar_producer();
proc_stop_lwps(p);
@ -2325,16 +2324,13 @@ proc_stop_callout(void *cookie)
* We brought the process to a halt.
* Mark it as stopped and notify the
* parent.
*
* Note that proc_stop_done() will
* drop p->p_lock briefly.
* Arrange to restart and check
* all processes again.
*/
if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
/*
* Note that proc_stop_done() will
* drop p->p_lock briefly.
* Arrange to restart and check
* all processes again.
*/
restart = true;
}
restart = true;
proc_stop_done(p, PS_NOCLDSTOP);
} else
more = true;

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.353 2019/06/11 23:18:55 kamil Exp $ */
/* $NetBSD: proc.h,v 1.354 2019/06/21 01:03:51 kamil Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -395,7 +395,6 @@ struct proc {
#define PS_STOPFORK 0x00800000 /* Child will be stopped on fork(2) */
#define PS_STOPEXEC 0x01000000 /* Will be stopped on exec(2) */
#define PS_STOPEXIT 0x02000000 /* Will be stopped at process exit */
#define PS_NOTIFYSTOP 0x10000000 /* Notify parent of successful STOP */
#define PS_COREDUMP 0x20000000 /* Process core-dumped */
#define PS_CONTINUED 0x40000000 /* Process is continued */
#define PS_STOPPING 0x80000000 /* Transitioning SACTIVE -> SSTOP */