1 You have a file descriptor (probably from a syscall), and you want the
2 corresponding pathname.
4 If you are on newer versions of DTrace, there is the fds[] array,
6 # dtrace -n 'syscall::read:entry { @[fds[arg0].fi_pathname] = count(); }'
7 dtrace: description 'syscall::read:entry ' matched 1 probe
15 /devices/pseudo/clone@0:ptm 6
18 /devices/pseudo/consms@0:mouse 31
19 /devices/pseudo/conskbd@0:kbd 47
24 but if you are on an older version of DTrace, try this to convert from
25 this->fd to self->vpath,
28 curthread->t_procp->p_user.u_finfo.fi_list[this->fd].uf_file;
29 this->vnodep = this->filep != 0 ? this->filep->f_vnode : 0;
30 self->vpath = this->vnodep ? (this->vnodep->v_path != 0 ?
31 cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";