add dtrace hooks
This commit is contained in:
parent
aadbd1256a
commit
73994f9f9a
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: linux32_syscall.c,v 1.31 2014/11/25 19:54:08 christos Exp $ */
|
||||
/* $NetBSD: linux32_syscall.c,v 1.32 2015/03/07 18:41:40 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.31 2014/11/25 19:54:08 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.32 2015/03/07 18:41:40 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -63,14 +63,14 @@ linux32_syscall(struct trapframe *frame)
|
||||
args[4] = frame->tf_rdi & 0xffffffff;
|
||||
args[5] = frame->tf_rbp & 0xffffffff;
|
||||
|
||||
if (__predict_false(p->p_trace_enabled)) {
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_return))) {
|
||||
narg = callp->sy_narg;
|
||||
if (__predict_false(narg > __arraycount(args)))
|
||||
panic("impossible syscall narg, code %d, narg %zu",
|
||||
code, narg);
|
||||
for (i = 0; i < narg; i++)
|
||||
args64[i] = args[i] & 0xffffffff;
|
||||
if ((error = trace_enter(code, args64, narg)) != 0)
|
||||
if ((error = trace_enter(code, callp, args64)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -102,7 +102,11 @@ out:
|
||||
break;
|
||||
}
|
||||
|
||||
if (__predict_false(p->p_trace_enabled))
|
||||
trace_exit(code, rval, error);
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_return))) {
|
||||
narg = callp->sy_narg;
|
||||
for (i = 0; i < narg; i++)
|
||||
args64[i] = args[i] & 0xffffffff;
|
||||
trace_exit(code, callp, args64, rval, error);
|
||||
}
|
||||
userret(l);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_syscall.c,v 1.31 2010/12/20 00:25:24 matt Exp $ */
|
||||
/* $NetBSD: linux_syscall.c,v 1.32 2015/03/07 18:41:40 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.31 2010/12/20 00:25:24 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.32 2015/03/07 18:41:40 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_linux.h"
|
||||
@ -97,8 +97,8 @@ linux_syscall(struct trapframe *frame)
|
||||
* already adjacent in the syscall trapframe.
|
||||
*/
|
||||
|
||||
if (__predict_false(p->p_trace_enabled)
|
||||
&& (error = trace_enter(code, args, callp->sy_narg)) != 0)
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_entry))
|
||||
&& (error = trace_enter(code, callp, args)) != 0)
|
||||
goto out;
|
||||
|
||||
rval[0] = 0;
|
||||
@ -126,8 +126,8 @@ out:
|
||||
break;
|
||||
}
|
||||
|
||||
if (__predict_false(p->p_trace_enabled))
|
||||
trace_exit(code, rval, error);
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_return)))
|
||||
trace_exit(code, callp, args, rval, error);
|
||||
|
||||
userret(l);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_syscall.c,v 1.32 2014/05/16 12:55:43 njoly Exp $ */
|
||||
/* $NetBSD: netbsd32_syscall.c,v 1.33 2015/03/07 18:41:40 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -29,8 +29,12 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL) && defined(_KERNEL_OPT)
|
||||
#include "opt_dtrace.h"
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.32 2014/05/16 12:55:43 njoly Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.33 2015/03/07 18:41:40 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -88,12 +92,12 @@ netbsd32_syscall(struct trapframe *frame)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (__predict_false(p->p_trace_enabled)
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_entry))
|
||||
&& !__predict_false(callp->sy_flags & SYCALL_INDIRECT)) {
|
||||
int narg = callp->sy_argsize >> 2;
|
||||
for (i = 0; i < narg; i++)
|
||||
args64[i] = args[i];
|
||||
error = trace_enter(code, args64, narg);
|
||||
error = trace_enter(code, callp, args64);
|
||||
if (__predict_false(error != 0))
|
||||
goto out;
|
||||
}
|
||||
@ -103,9 +107,12 @@ netbsd32_syscall(struct trapframe *frame)
|
||||
error = sy_call(callp, l, args, rval);
|
||||
|
||||
out:
|
||||
if (__predict_false(p->p_trace_enabled)
|
||||
if (__predict_false(p->p_trace_enabled || KDTRACE_ENTRY(callp->sy_return))
|
||||
&& !__predict_false(callp->sy_flags & SYCALL_INDIRECT)) {
|
||||
trace_exit(code, rval, error);
|
||||
int narg = callp->sy_argsize >> 2;
|
||||
for (i = 0; i < narg; i++)
|
||||
args64[i] = args[i];
|
||||
trace_exit(code, callp, args64, rval, error);
|
||||
}
|
||||
|
||||
if (__predict_true(error == 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user