From 25887f42a7f1a07a4d9ecf17f7886847b5d7b97c Mon Sep 17 00:00:00 2001 From: gibbs Date: Wed, 20 Feb 2013 17:46:38 +0000 Subject: 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 --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cddl/contrib/opensolaris/cmd/dtrace/dtrace.c') diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index a276659..cc7959f 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); } -- cgit v1.1