Index: sys/kern/subr_syscall.c =================================================================== --- sys/kern/subr_syscall.c +++ sys/kern/subr_syscall.c @@ -49,8 +49,15 @@ #include #include #endif +#ifdef KDTRACE_HOOKS +#include +#endif #include +#define IS_FORK(code) \ + ((code == AUE_FORK) || (code == AUE_VFORK) || \ + (code == AUE_RFORK) || (code == AUE_PDFORK)) + static inline int syscallenter(struct thread *td, struct syscall_args *sa) { @@ -141,9 +148,12 @@ #ifdef KDTRACE_HOOKS /* Give the syscall:::return DTrace probe a chance to fire. */ - if (systrace_probe_func != NULL && sa->callp->sy_return != 0) + if (systrace_probe_func != NULL && sa->callp->sy_return != 0) { (*systrace_probe_func)(sa, SYSTRACE_RETURN, error ? -1 : td->td_retval[0]); + if (IS_FORK(sa->code)) + (*systrace_probe_func)(sa, SYSTRACE_RETURN, 0); + } #endif syscall_thread_exit(td, sa->callp); }