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


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"


  27 
  28 #pragma D depends_on module unix
  29 #pragma D depends_on provider io
  30 
  31 inline int B_BUSY = @B_BUSY@;
  32 #pragma D binding "1.0" B_BUSY
  33 inline int B_DONE = @B_DONE@;
  34 #pragma D binding "1.0" B_DONE
  35 inline int B_ERROR = @B_ERROR@;
  36 #pragma D binding "1.0" B_ERROR
  37 inline int B_PAGEIO = @B_PAGEIO@;
  38 #pragma D binding "1.0" B_PAGEIO
  39 inline int B_PHYS = @B_PHYS@;
  40 #pragma D binding "1.0" B_PHYS
  41 inline int B_READ = @B_READ@;
  42 #pragma D binding "1.0" B_READ
  43 inline int B_WRITE = @B_WRITE@;
  44 #pragma D binding "1.0" B_WRITE
  45 inline int B_ASYNC = @B_ASYNC@;
  46 #pragma D binding "1.0" B_ASYNC


 180 #pragma D binding "1.1" translator
 181 translator fileinfo_t < struct file *F > {
 182         fi_name = F == NULL ? "<none>" :
 183             F->f_vnode->v_path == NULL ? "<unknown>" :
 184             basename(cleanpath(F->f_vnode->v_path));
 185         fi_dirname = F == NULL ? "<none>" :
 186             F->f_vnode->v_path == NULL ? "<unknown>" :
 187             dirname(cleanpath(F->f_vnode->v_path));
 188         fi_pathname = F == NULL ? "<none>" :
 189             F->f_vnode->v_path == NULL ? "<unknown>" :
 190             cleanpath(F->f_vnode->v_path);
 191         fi_offset = F == NULL ? 0 : F->f_offset;
 192         fi_fs = F == NULL ? "<none>" : stringof(F->f_vnode->v_op->vnop_name);
 193         fi_mount = F == NULL ? "<none>" :
 194             F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 195             F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 196             cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
 197         fi_oflags = F == NULL ? 0 : F->f_flag + (int)@FOPEN@;
 198 };
 199 
 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);
 203 
 204 #pragma D attributes Stable/Stable/Common fds
 205 #pragma D binding "1.1" fds
 206 
 207 #pragma D binding "1.2" translator
 208 translator fileinfo_t < struct vnode *V > {
 209         fi_name = V->v_path == NULL ? "<unknown>" :
 210             basename(cleanpath(V->v_path));
 211         fi_dirname = V->v_path == NULL ? "<unknown>" :
 212             dirname(cleanpath(V->v_path));
 213         fi_pathname = V->v_path == NULL ? "<unknown>" : cleanpath(V->v_path);
 214         fi_fs = stringof(V->v_op->vnop_name);
 215         fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 216             V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 217             cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
 218 };


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  28  */
  29 
  30 #pragma D depends_on module unix
  31 #pragma D depends_on provider io
  32 
  33 inline int B_BUSY = @B_BUSY@;
  34 #pragma D binding "1.0" B_BUSY
  35 inline int B_DONE = @B_DONE@;
  36 #pragma D binding "1.0" B_DONE
  37 inline int B_ERROR = @B_ERROR@;
  38 #pragma D binding "1.0" B_ERROR
  39 inline int B_PAGEIO = @B_PAGEIO@;
  40 #pragma D binding "1.0" B_PAGEIO
  41 inline int B_PHYS = @B_PHYS@;
  42 #pragma D binding "1.0" B_PHYS
  43 inline int B_READ = @B_READ@;
  44 #pragma D binding "1.0" B_READ
  45 inline int B_WRITE = @B_WRITE@;
  46 #pragma D binding "1.0" B_WRITE
  47 inline int B_ASYNC = @B_ASYNC@;
  48 #pragma D binding "1.0" B_ASYNC


 182 #pragma D binding "1.1" translator
 183 translator fileinfo_t < struct file *F > {
 184         fi_name = F == NULL ? "<none>" :
 185             F->f_vnode->v_path == NULL ? "<unknown>" :
 186             basename(cleanpath(F->f_vnode->v_path));
 187         fi_dirname = F == NULL ? "<none>" :
 188             F->f_vnode->v_path == NULL ? "<unknown>" :
 189             dirname(cleanpath(F->f_vnode->v_path));
 190         fi_pathname = F == NULL ? "<none>" :
 191             F->f_vnode->v_path == NULL ? "<unknown>" :
 192             cleanpath(F->f_vnode->v_path);
 193         fi_offset = F == NULL ? 0 : F->f_offset;
 194         fi_fs = F == NULL ? "<none>" : stringof(F->f_vnode->v_op->vnop_name);
 195         fi_mount = F == NULL ? "<none>" :
 196             F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 197             F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 198             cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
 199         fi_oflags = F == NULL ? 0 : F->f_flag + (int)@FOPEN@;
 200 };
 201 
 202 inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (getf(fd));


 203 
 204 #pragma D attributes Stable/Stable/Common fds
 205 #pragma D binding "1.1" fds
 206 
 207 #pragma D binding "1.2" translator
 208 translator fileinfo_t < struct vnode *V > {
 209         fi_name = V->v_path == NULL ? "<unknown>" :
 210             basename(cleanpath(V->v_path));
 211         fi_dirname = V->v_path == NULL ? "<unknown>" :
 212             dirname(cleanpath(V->v_path));
 213         fi_pathname = V->v_path == NULL ? "<unknown>" : cleanpath(V->v_path);
 214         fi_fs = stringof(V->v_op->vnop_name);
 215         fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" :
 216             V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
 217             cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
 218 };