print
Action
The print
action takes a single argument. In addition to printing the input argument, it also prints the type of the input argument. The print
action exploits the fact that, for kernel code, DTrace already has type information. The print
action uses the type information and its own set of rules to print its argument using an appropriate format. For example, given the function:
int fop_open( struct vnode **vpp, int mode, cred_t *cr, caller_context_t *ct) {
DTrace knows that the first argument is a pointer to a struct vnode
and it also knows what a struct vnode
contains.
# dtrace -q -n 'fop_close:entry {print(*args[0]);exit(0)}'
vnode_t {
v_lock = {
_opaque = [ NULL ]
}
v_flag = 0x36
v_count = 0x1
v_data = 0x10001f047450
v_vfsp = 0x1000102eddf0
v_stream = NULL
v_type = VPROC
v_rdev = 0xffffffffffffffff
v_vfsmountedhere = NULL
v_op = 0x10001009c040
v_pages = NULL
v_filocks = NULL
v_shrlocks = NULL
v_nbllock = {
_opaque = [ NULL ]
}
v_cv = {
_opaque = 0x0
}
v_pad = 0xcafe
v_count_dnlc = 0x0
v_locality = NULL
v_femhead = NULL
v_path = "/proc/343325/psinfo"
v_rdcnt = 0x0
v_wrcnt = 0x0
v_mmap_read = 0x0
v_mmap_write = 0x0
v_mpssdata = NULL
v_fopdata = NULL
v_vsd_lock = {
_opaque = [ NULL ]
}
v_vsd = NULL
v_xattrdir = NULL
v_fw = 0xbaddcafebaddcafe
}