Hi,
Is there way to regex based comparision in Predicates.
For example, if I want to look for only those processes which
open the file "myapp*.conf.*", how would this be done in
predicate?
syscall::open:entry
/(arg0 != NULL)&& (copyinstr(arg0) == "myapp*.conf.*"/
{
printf("File %s, opened by process %s[%d]\n",copyinstr(arg0),
execname, pid);
}
I guess the above code will not work? What is the correct way to do this.
I would like to avoid using system() to run another shell script or d-script.
Thanks
Vasanth
Angelo Rajadurai
2011-Feb-16 14:44 UTC
[dtrace-discuss] Using regex matching in predicates
Second try. My last email bounced.
Hey Vasanth:
You can try
syscall::open:entry
/strstr(copyinstr(arg0),"myapp")!=0/
{
printf("File %s, opened by process %s[%d]\n",copyinstr(arg0),
execname, pid);
}
-Angelo
On Feb 16, 2011, at 9:17 AM, Vasanth Bhat wrote:
> Hi,
>
> Is there way to regex based comparision in Predicates.
>
> For example, if I want to look for only those processes which open
the file "myapp*.conf.*", how would this be done in predicate?
>
> syscall::open:entry
> /(arg0 != NULL)&& (copyinstr(arg0) == "myapp*.conf.*"/
> {
> printf("File %s, opened by process %s[%d]\n",copyinstr(arg0),
execname, pid);
> }
>
> I guess the above code will not work? What is the correct way to do this.
>
> I would like to avoid using system() to run another shell script or
d-script.
>
> Thanks
> Vasanth
>
>
>
>
>
>
>
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org