Hemachandran
2008-Feb-07 04:11 UTC
[dtrace-discuss] vattr_t output is incorrect when invoked via system (mdb -k) action from dtrace
Hi, I am trying to print the vnode_t and vattr_t structure via system() action. The idea is to use "mdb" to print vnode_t and vattr_t structures instead of using printf/printa formatters. I have written a script to trace ufs_setattr call. I have pasted the script below. <---ufs_attr.d---> #!/usr/sbin/dtrace -ws fbt:ufs:ufs_setattr:entry { vp = (struct vnode *)arg0; vap = (struct vattr *)arg1; system("echo %-#p::print -t \"vnode_t\"|mdb -k",arg0); system("echo %-#p::print -t \"vattr_t\"|mdb -k",arg1); printf("vap->va_mask is %-#x", vap->va_mask); } <---ufs_attr.d---> ./ufs_attr.d -c "/usr/bin/touch /test" The print -t "vattr_t" output is { uint_t va_mask = 0xd77aae70 vtype_t va_type = 0 (VNON) ... ... } Whereas the printf "vap->va_mask is %-#x" output is vap->va_mask is 0x300 Why is the mdb -k output for "vattr_t" incorrect, whereas for vnode_t it is correct. Any idea or suggestions. -TIA Hemachandran
Adam Leventhal
2008-Feb-07 05:15 UTC
[dtrace-discuss] vattr_t output is incorrect when invoked via system (mdb -k) action from dtrace
Hi Hemachandran, While this is a clever idea, unfortunately it''s not going to work because system() actions are processed asynchronously so the data that you''re trying to print out will no longer be valid. There''s an old RFE to implement an action like ::print for DTrace: 4968681 would like ::printf-like functionality in DTrace Adam On Thu, Feb 07, 2008 at 09:41:48AM +0530, Hemachandran wrote:> Hi, > > I am trying to print the vnode_t and vattr_t structure via system() > action. The idea is to use "mdb" to print vnode_t and vattr_t structures > instead of using printf/printa formatters. I have written a script to > trace ufs_setattr call. I have pasted the script below. > > <---ufs_attr.d---> > #!/usr/sbin/dtrace -ws > fbt:ufs:ufs_setattr:entry > { > vp = (struct vnode *)arg0; > vap = (struct vattr *)arg1; > system("echo %-#p::print -t \"vnode_t\"|mdb -k",arg0); > system("echo %-#p::print -t \"vattr_t\"|mdb -k",arg1); > printf("vap->va_mask is %-#x", vap->va_mask); > } > <---ufs_attr.d---> > > ./ufs_attr.d -c "/usr/bin/touch /test" > > The print -t "vattr_t" output is > { > uint_t va_mask = 0xd77aae70 > vtype_t va_type = 0 (VNON) > ... > ... > } > Whereas the printf "vap->va_mask is %-#x" output is > vap->va_mask is 0x300 > > Why is the mdb -k output for "vattr_t" incorrect, whereas for vnode_t it > is correct. Any idea or suggestions. > > -TIA > Hemachandran > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl