Print this page
2915 DTrace in a zone should see "cpu", "curpsinfo", et al
2916 DTrace in a zone should be able to access fds[]
2917 DTrace in a zone should have limited provider access
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Reviewed by: Adam Leventhal <ahl@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/fio.c
          +++ new/usr/src/uts/common/os/fio.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) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2012, Joyent Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   28  /*      All Rights Reserved */
  28   29  
  29   30  #include <sys/types.h>
  30   31  #include <sys/sysmacros.h>
  31   32  #include <sys/param.h>
  32   33  #include <sys/systm.h>
  33   34  #include <sys/errno.h>
↓ open down ↓ 13 lines elided ↑ open up ↑
  47   48  #include <sys/priocntl.h>
  48   49  #include <sys/procset.h>
  49   50  #include <sys/prsystm.h>
  50   51  #include <sys/debug.h>
  51   52  #include <sys/kmem.h>
  52   53  #include <sys/atomic.h>
  53   54  #include <sys/fcntl.h>
  54   55  #include <sys/poll.h>
  55   56  #include <sys/rctl.h>
  56   57  #include <sys/port_impl.h>
       58 +#include <sys/dtrace.h>
  57   59  
  58   60  #include <c2/audit.h>
  59   61  #include <sys/nbmlock.h>
  60   62  
  61   63  #ifdef DEBUG
  62   64  
  63   65  static uint32_t afd_maxfd;      /* # of entries in maximum allocated array */
  64   66  static uint32_t afd_alloc;      /* count of kmem_alloc()s */
  65   67  static uint32_t afd_free;       /* count of kmem_free()s */
  66   68  static uint32_t afd_wait;       /* count of waits on non-zero ref count */
↓ open down ↓ 878 lines elided ↑ open up ↑
 945  947  
 946  948          error = VOP_CLOSE(vp, flag, count, offset, fp->f_cred, NULL);
 947  949  
 948  950          if (count > 1) {
 949  951                  mutex_exit(&fp->f_tlock);
 950  952                  return (error);
 951  953          }
 952  954          ASSERT(fp->f_count == 0);
 953  955          mutex_exit(&fp->f_tlock);
 954  956  
      957 +        /*
      958 +         * If DTrace has getf() subroutines active, it will set dtrace_closef
      959 +         * to point to code that implements a barrier with respect to probe
      960 +         * context.  This must be called before the file_t is freed (and the
      961 +         * vnode that it refers to is released) -- but it must be after the
      962 +         * file_t has been removed from the uf_entry_t.  That is, there must
      963 +         * be no way for a racing getf() in probe context to yield the fp that
      964 +         * we're operating upon.
      965 +         */
      966 +        if (dtrace_closef != NULL)
      967 +                (*dtrace_closef)();
      968 +
 955  969          VN_RELE(vp);
 956  970          /*
 957  971           * deallocate resources to audit_data
 958  972           */
 959  973          if (audit_active)
 960  974                  audit_unfalloc(fp);
 961  975          crfree(fp->f_cred);
 962  976          kmem_cache_free(file_cache, fp);
 963  977          return (error);
 964  978  }
↓ open down ↓ 846 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX