I've removed the KDTRACE_HOOKS ifdefs from the kernel code and added
them to sys/dtrace_bsd.h, made the functions inline and empty bodies
when KDTRACE_HOOKS is not defined.
Regards,
Darran.
On 24/02/2010, at 12:37 AM, Andrew Doran wrote:
On Mon, Feb 22, 2010 at 11:31:31AM -0600, David Young wrote:
On Sun, Feb 21, 2010 at 02:11:40AM +0000, Darran Hunt wrote:
Module Name: src
Committed By: darran
Date: Sun Feb 21 02:11:40 UTC 2010
Modified Files:
src/sys/arch/i386/i386: trap.c vector.S
src/sys/kern: kern_lwp.c kern_proc.c kern_synch.c
src/sys/sys: lwp.h proc.h
Added Files:
src/sys/sys: dtrace_bsd.h
Log Message:
Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses
to
manage its state. These are opaque from the kernel perspective to
keep
the kernel free of CDDL code. The state arenas are kmem_alloced
and freed
as proccesses and threads are created and destoyed.
Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so
it
can clean up after them and resume normal operation.
Ok with c...@.
Wow, dtrace in the kernel! This is exciting, thanks!
#ifdef makes kernel code hard to read. Will you help arrest the
accretion of conditional compilation in kern_synch.c by consolidating
the conditional compilation in a static subroutine, for example:
static void
dtrace_vtime_switch(lwp_t *newl)
{
#ifdef KDTRACE_HOOKS
/*
* If DTrace has set the active vtime enum to anything
* other than INACTIVE (0), then it should have set the
* function to call.
*/
if (dtrace_vtime_active) {
(*dtrace_vtime_switch_func)(newl);
}
#endif
How much code do the hooks add? If it is not very much, then just
drop
the ifdefs completely..