Source-Changes-HG archive

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

[src/trunk]: src/sys support for siginfo_t in ktrace



details:   https://anonhg.NetBSD.org/src/rev/03a1d0e9b63e
branches:  trunk
changeset: 552143:03a1d0e9b63e
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 19 22:50:02 2003 +0000

description:
support for siginfo_t in ktrace

diffstat:

 sys/kern/kern_ktrace.c |  33 +++++++++++++++++++++------------
 sys/sys/ktrace.h       |   7 +++++--
 2 files changed, 26 insertions(+), 14 deletions(-)

diffs (91 lines):

diff -r 22a7bdce4fac -r 03a1d0e9b63e sys/kern/kern_ktrace.c
--- a/sys/kern/kern_ktrace.c    Fri Sep 19 22:49:29 2003 +0000
+++ b/sys/kern/kern_ktrace.c    Fri Sep 19 22:50:02 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ktrace.c,v 1.77 2003/08/07 16:31:45 agc Exp $     */
+/*     $NetBSD: kern_ktrace.c,v 1.78 2003/09/19 22:51:05 christos Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.77 2003/08/07 16:31:45 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.78 2003/09/19 22:51:05 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_mach.h"
@@ -297,25 +297,34 @@
 }
 
 void
-ktrpsig(p, sig, action, mask, code)
+ktrpsig(p, sig, action, mask, ksi)
        struct proc *p;
        int sig;
        sig_t action;
        sigset_t *mask;
-       int code;
+       ksiginfo_t *ksi;
 {
        struct ktr_header kth;
-       struct ktr_psig kp;
+       struct {
+               struct ktr_psig kp;
+               siginfo_t       si;
+       } kbuf;
 
        p->p_traceflag |= KTRFAC_ACTIVE;
        ktrinitheader(&kth, p, KTR_PSIG);
-       kp.signo = (char)sig;
-       kp.action = action;
-       kp.mask = *mask;
-       kp.code = code;
-       kth.ktr_buf = (caddr_t)&kp;
-       kth.ktr_len = sizeof(struct ktr_psig);
-
+       kbuf.kp.signo = (char)sig;
+       kbuf.kp.action = action;
+       kbuf.kp.mask = *mask;
+       kth.ktr_buf = (caddr_t)&kbuf;
+       if (ksi) {
+               kbuf.kp.code = ksi->ksi_code > 0 ? ksi->ksi_trap : 0;
+               (void)memset(&kbuf.si, 0, sizeof(kbuf.si));
+               kbuf.si._info = *ksi;
+               kth.ktr_len = sizeof(kbuf);
+       } else {
+               kbuf.kp.code = 0;
+               kth.ktr_len = sizeof(struct ktr_psig);
+       }
        (void) ktrwrite(p, &kth);
        p->p_traceflag &= ~KTRFAC_ACTIVE;
 }
diff -r 22a7bdce4fac -r 03a1d0e9b63e sys/sys/ktrace.h
--- a/sys/sys/ktrace.h  Fri Sep 19 22:49:29 2003 +0000
+++ b/sys/sys/ktrace.h  Fri Sep 19 22:50:02 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ktrace.h,v 1.32 2003/08/07 16:34:06 agc Exp $  */
+/*     $NetBSD: ktrace.h,v 1.33 2003/09/19 22:50:02 christos Exp $     */
 
 /*
  * Copyright (c) 1988, 1993
@@ -120,6 +120,9 @@
        sig_t   action;
        sigset_t mask;
        int     code;
+       /*
+        * followed by optional siginfo_t
+        */
 };
 
 /*
@@ -214,7 +217,7 @@
 void ktremul(struct proc *);
 void ktrgenio(struct proc *, int, enum uio_rw, struct iovec *, int, int);
 void ktrnamei(struct proc *, char *);
-void ktrpsig(struct proc *, int, sig_t, sigset_t *, int);
+void ktrpsig(struct proc *, int, sig_t, sigset_t *, ksiginfo_t *);
 void ktrsyscall(struct proc *, register_t, register_t, 
     const struct sysent *, register_t []);
 void ktrsysret(struct proc *, register_t, int, register_t *);



Home | Main Index | Thread Index | Old Index