Print this page
INTRO-118 enabling USDT probes in zones should be more scalable

@@ -20,10 +20,11 @@
  */
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
  */
 
 #include <unistd.h>
 #include <strings.h>
 #include <stdlib.h>

@@ -152,10 +153,28 @@
     dtrace_proginfo_t *pip)
 {
         void *dof;
         int n, err;
 
+        if (!dtp->dt_optset) {
+                /*
+                 * If we have not yet ioctl'd down our options DOF, we'll
+                 * do that before enabling any probes (some options will
+                 * affect which probes we match).
+                 */
+                if ((dof = dtrace_getopt_dof(dtp)) == NULL)
+                        return (-1); /* dt_errno has been set for us */
+
+                err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
+                dtrace_dof_destroy(dtp, dof);
+
+                if (err == -1)
+                        return (-1);
+
+                dtp->dt_optset = B_TRUE;
+        }
+
         dtrace_program_info(dtp, pgp, pip);
 
         if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL)
                 return (-1);