Module Name: src Committed By: kamil Date: Tue Jan 10 00:48:37 UTC 2017
Modified Files: src/sys/kern: kern_fork.c src/sys/sys: siginfo.h Log Message: Introduce new si_code for SIGTRAP: TRAP_CHLD - process child trap The SIGTRAP signal is thrown from the kernel if EVENT_MASK (ptrace_event) enables PTRACE_FORK. This new si_code helps debuggers to distinguish the exact source of signal delivered for a debugger. Another purpose of TRAP_CHLD is to retain the same behavior inside the NetBSD kernel for process child traps and have an interface to monitor it. Retrieving exact event and extended properties of process child trap is available with PT_GET_PROCESS_STATE. There is no behavior change for existing software. This si_code value is NetBSD extension. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.197 -r1.198 src/sys/kern/kern_fork.c cvs rdiff -u -r1.27 -r1.28 src/sys/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_fork.c diff -u src/sys/kern/kern_fork.c:1.197 src/sys/kern/kern_fork.c:1.198 --- src/sys/kern/kern_fork.c:1.197 Mon Jan 9 00:31:30 2017 +++ src/sys/kern/kern_fork.c Tue Jan 10 00:48:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.197 2017/01/09 00:31:30 kamil Exp $ */ +/* $NetBSD: kern_fork.c,v 1.198 2017/01/10 00:48:37 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.197 2017/01/09 00:31:30 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.198 2017/01/10 00:48:37 kamil Exp $"); #include "opt_ktrace.h" #include "opt_dtrace.h" @@ -581,6 +581,7 @@ fork1(struct lwp *l1, int flags, int exi KSI_INIT_EMPTY(&ksi); ksi.ksi_signo = SIGTRAP; + ksi.ksi_code = TRAP_CHLD; ksi.ksi_lid = l1->l_lid; kpsignal(p1, &ksi, NULL); } Index: src/sys/sys/siginfo.h diff -u src/sys/sys/siginfo.h:1.27 src/sys/sys/siginfo.h:1.28 --- src/sys/sys/siginfo.h:1.27 Fri Jan 6 22:42:58 2017 +++ src/sys/sys/siginfo.h Tue Jan 10 00:48:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.27 2017/01/06 22:42:58 kamil Exp $ */ +/* $NetBSD: siginfo.h,v 1.28 2017/01/10 00:48:37 kamil Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -211,6 +211,7 @@ typedef union siginfo { #define TRAP_BRKPT 1 /* Process breakpoint */ #define TRAP_TRACE 2 /* Process trace trap */ #define TRAP_EXEC 3 /* Process exec trap */ +#define TRAP_CHLD 4 /* Process child trap */ /* SIGCHLD */ #define CLD_EXITED 1 /* Child has exited */