On Wed, Jun 04, 2008 at 05:31:11AM -0700, ?? wrote:
> i am a newbie to solaris...
> 
> can i use if/else/for/while in dtrace script?

for/while ---> Definitely not.

As for if/else, D scripts have a boolean you can you per-probe:

        ip_drop_packet:entry
        /arg1 == 1/
        {
                printf("IPsec dropped an inbound packet.");
        }

        ip_drop_packet:entry
        /arg1 == 0/
        {
                printf("IPsec dropped an outbound packet.");
        }

Or you can use C's bool ? true-expr : false-expr syntax:

        ip_drop_packet:entry
        {
                printf("IPsec dropped an %s packet.",
                    arg1 ? "inbound" : "outbound");
        }

I picked a dinky example, but you can use these more powerfully.

Dan
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to