aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
diff options
context:
space:
mode:
authorJustin T. Gibbs <gibbs@FreeBSD.org>2013-02-20 17:46:38 +0000
committerJustin T. Gibbs <gibbs@FreeBSD.org>2013-02-20 17:46:38 +0000
commitcf4e0cc15ed384be7564c81ee181d66e46093e91 (patch)
tree57f62a7984f0f82815cd9a38c20475e65dc58ebd /cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
parent31a53cd03625e31cbbf63b78cf3c9b711301869a (diff)
downloadsrc-cf4e0cc15ed384be7564c81ee181d66e46093e91.tar.gz
src-cf4e0cc15ed384be7564c81ee181d66e46093e91.zip
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
Notes
Notes: svn path=/head/; revision=247048
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/dtrace/dtrace.c')
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/dtrace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
index a2766593607b..cc7959f99cd1 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);
}