Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Correct distinguishing fork/vfork tracing event in ...



details:   https://anonhg.NetBSD.org/src/rev/e6d65adf9e8b
branches:  trunk
changeset: 998036:e6d65adf9e8b
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Apr 05 21:41:18 2019 +0000

description:
Correct distinguishing fork/vfork tracing event in fork1(9)

flags can contain a different value than FORK_PPWAIT and bit comparing
with '&&' was a typo.

Detected with __clone(2) usage scenarios.

diffstat:

 sys/kern/kern_fork.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r a39fbe275e2c -r e6d65adf9e8b sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c      Fri Apr 05 21:31:44 2019 +0000
+++ b/sys/kern/kern_fork.c      Fri Apr 05 21:41:18 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_fork.c,v 1.206 2019/04/03 08:08:00 kamil Exp $    */
+/*     $NetBSD: kern_fork.c,v 1.207 2019/04/05 21:41:18 kamil Exp $    */
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.206 2019/04/03 08:08:00 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.207 2019/04/05 21:41:18 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -477,11 +477,11 @@
         * Trace fork(2) and vfork(2)-like events on demand in a debugger.
         */
        tracefork = (p1->p_slflag & (PSL_TRACEFORK|PSL_TRACED)) ==
-           (PSL_TRACEFORK|PSL_TRACED) && (flags && FORK_PPWAIT) == 0;
+           (PSL_TRACEFORK|PSL_TRACED) && (flags & FORK_PPWAIT) == 0;
        tracevfork = (p1->p_slflag & (PSL_TRACEVFORK|PSL_TRACED)) ==
-           (PSL_TRACEVFORK|PSL_TRACED) && (flags && FORK_PPWAIT) != 0;
+           (PSL_TRACEVFORK|PSL_TRACED) && (flags & FORK_PPWAIT) != 0;
        tracevforkdone = (p1->p_slflag & (PSL_TRACEVFORK_DONE|PSL_TRACED)) ==
-           (PSL_TRACEVFORK_DONE|PSL_TRACED) && (flags && FORK_PPWAIT);
+           (PSL_TRACEVFORK_DONE|PSL_TRACED) && (flags & FORK_PPWAIT);
        if (tracefork || tracevfork)
                proc_changeparent(p2, p1->p_pptr);
        if (tracefork) {



Home | Main Index | Thread Index | Old Index