PERFORCE change 96477 for review

John Birrell jb at FreeBSD.org
Mon May 1 09:00:05 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96477

Change 96477 by jb at 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) {


More information about the p4-projects mailing list