Print this page
2916 DTrace in a zone should be able to access fds[]

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/io.d.in
          +++ new/usr/src/lib/libdtrace/common/io.d.in
↓ open down ↓ 15 lines elided ↑ open up ↑
  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   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       26 +/*
       27 + * Copyright (c) 2012, Joyent, Inc. All rights reserved.
       28 + */
  27   29  
  28   30  #pragma D depends_on module unix
  29   31  #pragma D depends_on provider io
  30   32  
  31   33  inline int B_BUSY = @B_BUSY@;
  32   34  #pragma D binding "1.0" B_BUSY
  33   35  inline int B_DONE = @B_DONE@;
  34   36  #pragma D binding "1.0" B_DONE
  35   37  inline int B_ERROR = @B_ERROR@;
  36   38  #pragma D binding "1.0" B_ERROR
↓ open down ↓ 153 lines elided ↑ open up ↑
 190  192              cleanpath(F->f_vnode->v_path);
 191  193          fi_offset = F == NULL ? 0 : F->f_offset;
 192  194          fi_fs = F == NULL ? "<none>" : stringof(F->f_vnode->v_op->vnop_name);
 193  195          fi_mount = F == NULL ? "<none>" :
 194  196              F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 195  197              F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 196  198              cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
 197  199          fi_oflags = F == NULL ? 0 : F->f_flag + (int)@FOPEN@;
 198  200  };
 199  201  
 200      -inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (
 201      -    fd >= 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ?
 202      -    curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL);
      202 +inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (getf(fd));
 203  203  
 204  204  #pragma D attributes Stable/Stable/Common fds
 205  205  #pragma D binding "1.1" fds
 206  206  
 207  207  #pragma D binding "1.2" translator
 208  208  translator fileinfo_t < struct vnode *V > {
 209  209          fi_name = V->v_path == NULL ? "<unknown>" :
 210  210              basename(cleanpath(V->v_path));
 211  211          fi_dirname = V->v_path == NULL ? "<unknown>" :
 212  212              dirname(cleanpath(V->v_path));
 213  213          fi_pathname = V->v_path == NULL ? "<unknown>" : cleanpath(V->v_path);
 214  214          fi_fs = stringof(V->v_op->vnop_name);
 215  215          fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 216  216              V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 217  217              cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
 218  218  };
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX