Hi, is it possible in dtrace to use regexp or wildcards? I would like to trace fop_ probes if the vnode v_path contains matches some regexp.. E.g. I would like to see fop operations on files which have foo in their v_path: ::fop_*:entry /probefunc != "fop_open" && ((vnode_t *)arg0)->v_path == "*foo*"/ { ... } Thanks, Pavel
Hi Pavel, DTrace has a few string manipulation subroutines and strstr() will probably do what you want here. It''s not too pretty but I think this does it: fbt::fop_*:entry /probefunc != "fop_open" && ((vnode_t *)arg0)->v_path != 0 && strstr(stringof(((vnode_t *)arg0)->v_path), "foo") != NULL/ { printf("%s\n", stringof(((vnode_t *)arg0)->v_path)); } Let me know if it isn''t what you had in mind. Jon.> is it possible in dtrace to use regexp or wildcards? > I would like to trace fop_ probes if the vnode v_path > contains matches some regexp.. > > E.g. I would like to see fop operations on files which have foo in > their v_path: > > ::fop_*:entry > /probefunc != "fop_open" && ((vnode_t *)arg0)->v_path == "*foo*"/ > { > ... > } > > > Thanks, > Pavel > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Thanks Jon. This meets my needs. --Pavel Jon Haslam wrote:> Hi Pavel, > > DTrace has a few string manipulation subroutines and strstr() > will probably do what you want here. It''s not too pretty > but I think this does it: > > fbt::fop_*:entry > /probefunc != "fop_open" && ((vnode_t *)arg0)->v_path != 0 && > strstr(stringof(((vnode_t *)arg0)->v_path), "foo") != NULL/ > { > printf("%s\n", stringof(((vnode_t *)arg0)->v_path)); > } > > Let me know if it isn''t what you had in mind. > > Jon. > > >> is it possible in dtrace to use regexp or wildcards? >> I would like to trace fop_ probes if the vnode v_path >> contains matches some regexp.. >> >> E.g. I would like to see fop operations on files which have foo in >> their v_path: >> >> ::fop_*:entry >> /probefunc != "fop_open" && ((vnode_t *)arg0)->v_path == "*foo*"/ >> { >> ... >> } >> >> >> Thanks, >> Pavel >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris.org > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org