support for siginfo_t in ktrace

This commit is contained in:
christos 2003-09-19 22:50:02 +00:00
parent 309234359e
commit 070899d51e
2 changed files with 26 additions and 14 deletions

View File

@ -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 @@ ktrgenio(p, fd, rw, iov, len, error)
}
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;
}

View File

@ -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 @@ struct ktr_psig {
sig_t action;
sigset_t mask;
int code;
/*
* followed by optional siginfo_t
*/
};
/*
@ -214,7 +217,7 @@ void ktrcsw(struct proc *, int, int);
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 *);