Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Add a sy_invoke inline to do trace_enter/trace_exit ...



details:   https://anonhg.NetBSD.org/src/rev/b2f3bb61d2ff
branches:  trunk
changeset: 787598:b2f3bb61d2ff
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jun 25 17:38:06 2013 +0000

description:
Add a sy_invoke inline to do trace_enter/trace_exit dance.

diffstat:

 sys/sys/syscallvar.h |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 2352c8fd8ec8 -r b2f3bb61d2ff sys/sys/syscallvar.h
--- a/sys/sys/syscallvar.h      Tue Jun 25 16:51:14 2013 +0000
+++ b/sys/sys/syscallvar.h      Tue Jun 25 17:38:06 2013 +0000
@@ -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 @@
        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[];
 



Home | Main Index | Thread Index | Old Index