Module Name: src Committed By: matt Date: Tue Jun 25 17:38:07 UTC 2013
Modified Files: src/sys/sys: syscallvar.h Log Message: Add a sy_invoke inline to do trace_enter/trace_exit dance. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/sys/syscallvar.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/sys/syscallvar.h diff -u src/sys/sys/syscallvar.h:1.5 src/sys/sys/syscallvar.h:1.6 --- src/sys/sys/syscallvar.h:1.5 Tue Jun 2 23:21:38 2009 +++ src/sys/sys/syscallvar.h Tue Jun 25 17:38:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: syscallvar.h,v 1.5 2009/06/02 23:21:38 pooka Exp $ */ +/* $NetBSD: syscallvar.h,v 1.6 2013/06/25 17:38:06 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -64,6 +64,27 @@ sy_call(const struct sysent *sy, struct return error; } +static inline int +sy_invoke(const struct sysent *sy, struct lwp *l, const void *uap, + register_t *rval, int code) +{ + int error; + + if (!__predict_false(l->l_proc->p_trace_enabled) + || __predict_false(sy->sy_flags & SYCALL_INDIRECT) + || (error = trace_enter(code, uap, sy->sy_narg)) == 0) { + rval[0] = 0; + rval[1] = 0; + error = sy_call(sy, l, uap, rval); + } + + if (__predict_false(l->l_proc->p_trace_enabled) + && !__predict_false(sy->sy_flags & SYCALL_INDIRECT)) { + trace_exit(code, rval, error); + } + return error; +} + /* inclusion in the kernel currently depends on SYSCALL_DEBUG */ extern const char * const syscallnames[];