From owner-p4-projects@FreeBSD.ORG Mon May 1 09:00:05 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0FC7D16A412; Mon, 1 May 2006 09:00:05 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CABD516A401 for ; Mon, 1 May 2006 09:00:04 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C956A43D5F for ; Mon, 1 May 2006 09:00:01 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k41901UK008529 for ; Mon, 1 May 2006 09:00:01 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k41901d4008500 for perforce@freebsd.org; Mon, 1 May 2006 09:00:01 GMT (envelope-from jb@freebsd.org) Date: Mon, 1 May 2006 09:00:01 GMT Message-Id: <200605010900.k41901d4008500@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 96477 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2006 09:00:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=96477 Change 96477 by jb@jb_freebsd2 on 2006/05/01 08:59:28 Implement the DTrace syscall provider callbacks. Affected files ... .. //depot/projects/dtrace/src/sys/i386/i386/trap.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/i386/i386/trap.c#3 (text+ko) ==== @@ -115,6 +115,13 @@ * 'no-fault' DTrace probe. */ dtrace_instr_size_func_t dtrace_instr_size_func; + +/* + * This is a hook which is initialised by the systrace module + * when it is loaded. This keeps the DTrace syscall provider + * implementation opaque. + */ +systrace_probe_func_t systrace_probe_func; #endif extern void trap(struct trapframe frame); @@ -1086,6 +1093,17 @@ td->td_retval[0] = 0; td->td_retval[1] = frame.tf_edx; +#ifdef KDTRACE + /* + * If the systrace module has registered it's probe + * callback and if there is a probe active for the + * syscall 'entry', process the probe. + */ + if (systrace_probe_func != NULL && callp->sy_entry != 0) + (*systrace_probe_func)(callp->sy_entry, code, callp, + args); +#endif + STOPEVENT(p, S_SCE, narg); PTRACESTOP_SC(p, td, S_PT_SCE); @@ -1093,6 +1111,20 @@ AUDIT_SYSCALL_ENTER(code, td); error = (*callp->sy_call)(td, args); AUDIT_SYSCALL_EXIT(error, td); + +#ifdef KDTRACE + args[0] = error; + args[1] = error; + + /* + * If the systrace module has registered it's probe + * callback and if there is a probe active for the + * syscall 'return', process the probe. + */ + if (systrace_probe_func != NULL && callp->sy_return != 0) + (*systrace_probe_func)(callp->sy_return, code, NULL, + args); +#endif } switch (error) {