From f0d70fbec69bb86adc2252b8675022b093cab111 Mon Sep 17 00:00:00 2001 From: gibbs Date: Wed, 13 Mar 2013 17:37:13 +0000 Subject: [PATCH] MFC r247048. Orphaned processes that are being traced are killed by the kernel. Properly restore, continue, and detach from processes being DTraced when DTrace exits with an error so the program being inspected is not terminated. cddl/contrib/opensolaris/cmd/dtrace/dtrace.c: In fatal(), the generic error handler, close the DTrace handle as is done in the "probe/script" error handler dfatal(). fatal() can be invoked after DTrace attaches to processes (e.g. a script specified by command line argument can't be found) and closing the handle will release them. Submitted by: Spectra Logic Corporation Reviewed by: rpaulo, gnn git-svn-id: svn://svn.freebsd.org/base/stable/9@248249 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index a27665936..cc7959f99 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -195,6 +195,13 @@ fatal(const char *fmt, ...) verror(fmt, ap); va_end(ap); + /* + * Close the DTrace handle to ensure that any controlled processes are + * correctly restored and continued. + */ + if (g_dtp) + dtrace_close(g_dtp); + exit(E_ERROR); } -- 2.45.0