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_work.c
          +++ new/usr/src/lib/libdtrace/common/dt_work.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  
  23   23  /*
  24   24   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  25   25   * Use is subject to license terms.
  26   26   */
  27   27  
  28      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       28 +/*
       29 + * Copyright (c) 2011, Joyent, Inc. All rights reserved.
       30 + */
  29   31  
  30   32  #include <dt_impl.h>
  31   33  #include <stddef.h>
  32   34  #include <errno.h>
  33   35  #include <assert.h>
  34   36  #include <time.h>
  35   37  
  36   38  static const struct {
  37   39          int dtslt_option;
  38   40          size_t dtslt_offs;
↓ open down ↓ 118 lines elided ↑ open up ↑
 157  159                  if (dtrace_stop(dtp) == -1)
 158  160                          return (-1);
 159  161          }
 160  162  
 161  163          return (DTRACE_STATUS_FILLED);
 162  164  }
 163  165  
 164  166  int
 165  167  dtrace_go(dtrace_hdl_t *dtp)
 166  168  {
 167      -        void *dof;
 168      -        int err;
 169      -
 170  169          if (dtp->dt_active)
 171  170                  return (dt_set_errno(dtp, EINVAL));
 172  171  
 173  172          /*
 174  173           * If a dtrace:::ERROR program and callback are registered, enable the
 175  174           * program before we start tracing.  If this fails for a vector open
 176  175           * with ENOTTY, we permit dtrace_go() to succeed so that vector clients
 177  176           * such as mdb's dtrace module can execute the rest of dtrace_go() even
 178  177           * though they do not provide support for the DTRACEIOC_ENABLE ioctl.
 179  178           */
 180  179          if (dtp->dt_errprog != NULL &&
 181  180              dtrace_program_exec(dtp, dtp->dt_errprog, NULL) == -1 && (
 182  181              dtp->dt_errno != ENOTTY || dtp->dt_vector == NULL))
 183  182                  return (-1); /* dt_errno has been set for us */
 184  183  
 185      -        if ((dof = dtrace_getopt_dof(dtp)) == NULL)
 186      -                return (-1); /* dt_errno has been set for us */
 187      -
 188      -        err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
 189      -        dtrace_dof_destroy(dtp, dof);
 190      -
 191      -        if (err == -1 && (errno != ENOTTY || dtp->dt_vector == NULL))
 192      -                return (dt_set_errno(dtp, errno));
 193      -
 194  184          if (dt_ioctl(dtp, DTRACEIOC_GO, &dtp->dt_beganon) == -1) {
 195  185                  if (errno == EACCES)
 196  186                          return (dt_set_errno(dtp, EDT_DESTRUCTIVE));
 197  187  
 198  188                  if (errno == EALREADY)
 199  189                          return (dt_set_errno(dtp, EDT_ISANON));
 200  190  
 201  191                  if (errno == ENOENT)
 202  192                          return (dt_set_errno(dtp, EDT_NOANON));
 203  193  
↓ open down ↓ 95 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX