Source-Changes-HG archive

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

[src/trunk]: src/sys Introduce new SIGTRAP code: TRAP_EXEC



details:   https://anonhg.NetBSD.org/src/rev/d57f1cf89aa1
branches:  trunk
changeset: 820308:d57f1cf89aa1
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jan 06 22:42:58 2017 +0000

description:
Introduce new SIGTRAP code: TRAP_EXEC

On exec() events under a debugger generate the SIGTRAP signal with
TRAP_EXEC property. This allows tracer to distinguish exec() events easily.

Sponsored by <The NetBSD Foundation>

diffstat:

 sys/kern/kern_exec.c |  5 +++--
 sys/sys/siginfo.h    |  3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 0353f6f70620 -r d57f1cf89aa1 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Fri Jan 06 22:40:06 2017 +0000
+++ b/sys/kern/kern_exec.c      Fri Jan 06 22:42:58 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.438 2016/11/03 22:08:30 kamil Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 kamil Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.438 2016/11/03 22:08:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1318,6 +1318,7 @@
 
                KSI_INIT_EMPTY(&ksi);
                ksi.ksi_signo = SIGTRAP;
+               ksi.ksi_code = TRAP_EXEC;
                ksi.ksi_lid = l->l_lid;
                kpsignal(p, &ksi, NULL);
        }
diff -r 0353f6f70620 -r d57f1cf89aa1 sys/sys/siginfo.h
--- a/sys/sys/siginfo.h Fri Jan 06 22:40:06 2017 +0000
+++ b/sys/sys/siginfo.h Fri Jan 06 22:42:58 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siginfo.h,v 1.26 2016/12/27 02:20:46 kamil Exp $        */
+/*     $NetBSD: siginfo.h,v 1.27 2017/01/06 22:42:58 kamil Exp $        */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -210,6 +210,7 @@
 /* SIGTRAP */
 #define        TRAP_BRKPT      1       /* Process breakpoint                   */
 #define        TRAP_TRACE      2       /* Process trace trap                   */
+#define        TRAP_EXEC       3       /* Process exec trap                    */
 
 /* SIGCHLD */
 #define        CLD_EXITED      1       /* Child has exited                     */



Home | Main Index | Thread Index | Old Index