Date: Sun, 20 Jan 2008 08:24:40 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 133719 for review Message-ID: <200801200824.m0K8Oe9W080480@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133719 Change 133719 by jb@jb_freebsd1 on 2008/01/20 08:24:18 Add a SDT (static) probe for process creation (named: proc:kernel::create) to match the Solaris functionality and modify the test to account for the difference between FreeBSD's struct proc and Solaris. Note: This is an example of a static probe providing typed arguments. The argument type allows the first argument to be dereferenced in a D script as args[0]->p_pptr->p_pid. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.create.ksh#5 edit .. //depot/projects/dtrace/src/sys/kern/kern_fork.c#25 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.create.ksh#5 (text+ko) ==== @@ -36,7 +36,7 @@ { $dtrace -s /dev/stdin <<EOF proc:::create - /args[0]->pr_ppid == $child && pid == $child/ + /args[0]->p_pptr->p_pid == $child && pid == $child/ { exit(0); } @@ -46,7 +46,7 @@ sleeper() { while true; do - /usr/bin/sleep 1 + /bin/sleep 1 done } ==== //depot/projects/dtrace/src/sys/kern/kern_fork.c#25 (text+ko) ==== @@ -37,6 +37,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.289 2007/11/15 02:13:44 julian Exp $"); +#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_mac.h" @@ -63,6 +64,7 @@ #include <sys/ktr.h> #include <sys/ktrace.h> #include <sys/unistd.h> +#include <sys/sdt.h> #include <sys/sx.h> #include <sys/signalvar.h> @@ -75,6 +77,7 @@ #include <vm/vm_extern.h> #include <vm/uma.h> +SDT_PROVIDER_DECLARE(proc); #ifndef _SYS_SYSPROTO_H_ struct fork_args { @@ -716,6 +719,11 @@ PROC_UNLOCK(p1); + SDT_PROBE(proc, kernel, , create, p2, p1, flags, 0, 0); + SDT_PROBE_ARGTYPE(proc, kernel, , create, 0, "struct proc *"); + SDT_PROBE_ARGTYPE(proc, kernel, , create, 1, "struct proc *"); + SDT_PROBE_ARGTYPE(proc, kernel, , create, 2, "int"); + /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801200824.m0K8Oe9W080480>