DTrace Issues

Shawn Webb
Thu, 27 Oct 2011 15:01:33 -0000

Hey FreeBSD Stable,

I'm having issues printing out the curpsinfo->pr_psargs. Has anyone
had any success printing out the arguments passed to a program? Below
is the log of what happens when I run my script the source for my
script.

[root@fbsd-sec ~/dtrace/security]# ./log_exec.d 80
dtrace: buffer size lowered to 2m
1319724849:80:sh:sh
1319724849:80:ls:ls
^C

[root@fbsd-sec ~/dtrace/security]# cat log_exec.d
#!/usr/sbin/dtrace -s

#pragma D option quiet

proc:::exec-success
/uid == $1/
{
    printf("%d:%d:%s:", walltimestamp, uid, execname);
    trace(curpsinfo->pr_psargs);
    printf("\n");
}

Thanks,

Shawn