svn commit: r247048 - head/cddl/contrib/opensolaris/cmd/dtrace

Justin T. Gibbs gibbs at FreeBSD.org
Wed Feb 20 17:46:39 UTC 2013


Author: gibbs
Date: Wed Feb 20 17:46:38 2013
New Revision: 247048
URL: http://svnweb.freebsd.org/changeset/base/247048

Log:
  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

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c	Wed Feb 20 17:39:52 2013	(r247047)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c	Wed Feb 20 17:46:38 2013	(r247048)
@@ -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);
 }
 


More information about the svn-src-all mailing list