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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_program.c
          +++ new/usr/src/lib/libdtrace/common/dt_program.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2011 by Delphix. All rights reserved.
       25 + * Copyright (c) 2011, Joyent, Inc. All rights reserved.
  25   26   */
  26   27  
  27   28  #include <unistd.h>
  28   29  #include <strings.h>
  29   30  #include <stdlib.h>
  30   31  #include <errno.h>
  31   32  #include <assert.h>
  32   33  #include <ctype.h>
  33   34  #include <alloca.h>
  34   35  
↓ open down ↓ 112 lines elided ↑ open up ↑
 147  148          }
 148  149  }
 149  150  
 150  151  int
 151  152  dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
 152  153      dtrace_proginfo_t *pip)
 153  154  {
 154  155          void *dof;
 155  156          int n, err;
 156  157  
      158 +        if (!dtp->dt_optset) {
      159 +                /*
      160 +                 * If we have not yet ioctl'd down our options DOF, we'll
      161 +                 * do that before enabling any probes (some options will
      162 +                 * affect which probes we match).
      163 +                 */
      164 +                if ((dof = dtrace_getopt_dof(dtp)) == NULL)
      165 +                        return (-1); /* dt_errno has been set for us */
      166 +
      167 +                err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
      168 +                dtrace_dof_destroy(dtp, dof);
      169 +
      170 +                if (err == -1)
      171 +                        return (-1);
      172 +
      173 +                dtp->dt_optset = B_TRUE;
      174 +        }
      175 +
 157  176          dtrace_program_info(dtp, pgp, pip);
 158  177  
 159  178          if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL)
 160  179                  return (-1);
 161  180  
 162  181          n = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
 163  182          dtrace_dof_destroy(dtp, dof);
 164  183  
 165  184          if (n == -1) {
 166  185                  switch (errno) {
↓ open down ↓ 451 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX