Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/dtrace/dtrace.c
          +++ new/usr/src/uts/common/dtrace/dtrace.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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      - * Copyright (c) 2017, Joyent, Inc.
       24 + * Copyright (c) 2018, Joyent, Inc.
  25   25   * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  26   26   */
  27   27  
  28   28  /*
  29   29   * DTrace - Dynamic Tracing for Solaris
  30   30   *
  31   31   * This is the implementation of the Solaris Dynamic Tracing framework
  32   32   * (DTrace).  The user-visible interface to DTrace is described at length in
  33   33   * the "Solaris Dynamic Tracing Guide".  The interfaces between the libdtrace
  34   34   * library, the in-kernel DTrace framework, and the DTrace providers are
↓ open down ↓ 3497 lines elided ↑ open up ↑
3532 3532                   * It is always safe to dereference one's own t_lwp pointer in
3533 3533                   * the event that this pointer is non-NULL.  (This is true
3534 3534                   * because threads and lwps don't clean up their own state --
3535 3535                   * they leave that task to whomever reaps them.)
3536 3536                   */
3537 3537                  if ((lwp = curthread->t_lwp) == NULL)
3538 3538                          return (0);
3539 3539  
3540 3540                  return ((uint64_t)lwp->lwp_errno);
3541 3541          }
     3542 +
     3543 +        case DIF_VAR_THREADNAME:
     3544 +                /*
     3545 +                 * See comment in DIF_VAR_PID.
     3546 +                 */
     3547 +                if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
     3548 +                        return (0);
     3549 +
     3550 +                if (curthread->t_name == NULL)
     3551 +                        return (0);
     3552 +
     3553 +                /*
     3554 +                 * Once set, ->t_name itself is never changed: any updates are
     3555 +                 * made to the same buffer that we are pointing out.  So we are
     3556 +                 * safe to dereference it here.
     3557 +                 */
     3558 +                return (dtrace_dif_varstr((uintptr_t)curthread->t_name,
     3559 +                    state, mstate));
     3560 +
3542 3561          default:
3543 3562                  DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
3544 3563                  return (0);
3545 3564          }
3546 3565  }
3547 3566  
3548 3567  static void
3549 3568  dtrace_dif_variable_write(dtrace_mstate_t *mstate, dtrace_state_t *state,
3550 3569      uint64_t v, uint64_t ndx, uint64_t data)
3551 3570  {
↓ open down ↓ 2004 lines elided ↑ open up ↑
5556 5575                  } else if (af == AF_INET6) {
5557 5576                          struct in6_addr ip6;
5558 5577                          int firstzero, tryzero, numzero, v6end;
5559 5578                          uint16_t val;
5560 5579                          const char digits[] = "0123456789abcdef";
5561 5580  
5562 5581                          /*
5563 5582                           * Stringify using RFC 1884 convention 2 - 16 bit
5564 5583                           * hexadecimal values with a zero-run compression.
5565 5584                           * Lower case hexadecimal digits are used.
5566      -                         *      eg, fe80::214:4fff:fe0b:76c8.
     5585 +                         *      eg, fe80::214:4fff:fe0b:76c8.
5567 5586                           * The IPv4 embedded form is returned for inet_ntop,
5568 5587                           * just the IPv4 string is returned for inet_ntoa6.
5569 5588                           */
5570 5589  
5571 5590                          if (!dtrace_canload(tupregs[argi].dttk_value,
5572 5591                              sizeof (struct in6_addr), mstate, vstate)) {
5573 5592                                  regs[rd] = NULL;
5574 5593                                  break;
5575 5594                          }
5576 5595  
↓ open down ↓ 163 lines elided ↑ open up ↑
5740 5759          uint8_t ttop = 0;
5741 5760          dif_instr_t instr;
5742 5761          uint_t r1, r2, rd;
5743 5762  
5744 5763          /*
5745 5764           * We stash the current DIF object into the machine state: we need it
5746 5765           * for subsequent access checking.
5747 5766           */
5748 5767          mstate->dtms_difo = difo;
5749 5768  
5750      -        regs[DIF_REG_R0] = 0;           /* %r0 is fixed at zero */
     5769 +        regs[DIF_REG_R0] = 0;           /* %r0 is fixed at zero */
5751 5770  
5752 5771          while (pc < textlen && !(*flags & CPU_DTRACE_FAULT)) {
5753 5772                  opc = pc;
5754 5773  
5755 5774                  instr = text[pc++];
5756 5775                  r1 = DIF_INSTR_R1(instr);
5757 5776                  r2 = DIF_INSTR_R2(instr);
5758 5777                  rd = DIF_INSTR_RD(instr);
5759 5778  
5760 5779                  switch (DIF_INSTR_OP(instr)) {
↓ open down ↓ 11518 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX