Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Eliminate PS_NOTIFYSTOP remnants from the kernel



details:   https://anonhg.NetBSD.org/src/rev/f1e996b773bc
branches:  trunk
changeset: 452184:f1e996b773bc
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jun 21 01:03:51 2019 +0000

description:
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

diffstat:

 sys/kern/kern_sig.c |  32 ++++++++++++++------------------
 sys/sys/proc.h      |   3 +--
 2 files changed, 15 insertions(+), 20 deletions(-)

diffs (92 lines):

diff -r 41cd24ed1f95 -r f1e996b773bc sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Thu Jun 20 19:26:41 2019 +0000
+++ b/sys/kern/kern_sig.c       Fri Jun 21 01:03:51 2019 +0000
@@ -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 @@
 /*
  * 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 @@
        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 @@
         * 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 @@
                                 * 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;
diff -r 41cd24ed1f95 -r f1e996b773bc sys/sys/proc.h
--- a/sys/sys/proc.h    Thu Jun 20 19:26:41 2019 +0000
+++ b/sys/sys/proc.h    Fri Jun 21 01:03:51 2019 +0000
@@ -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 @@
 #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 */



Home | Main Index | Thread Index | Old Index