Hi,

[...]
> So to do this I can obviously initialise an array at BEGIN. However if
> I want to share this very long initialisation statement in  many
> scripts is there a simple way of doing that.

Yes, dtrace can use C preprocessor.

============================== dtrace(1M) ==============================
     -C

         Run the C preprocessor cpp(1)  over  D  programs  before
         compiling them. You can pass options to the C preproces-
         sor using the -D, -U, -I, and -H options. You can select
         the  degree  of C standard conformance if you use the -X
         option. For a description of the set of  tokens  defined
         by  the D compiler when invoking the C preprocessor, see
         -X.
========================================================================

==================================== test.d ====================================
#include "init.d"
================================================================================

==================================== init.d ====================================
BEGIN {
        printf ("Doing init\n");
}
================================================================================


$ dtrace -C -I. -s test.d
dtrace: script 'test.d' matched 1 probe
CPU     ID                    FUNCTION:NAME
  0      1                           :BEGIN Doing init


I also thought that you could have the parameters in the first line of the 
script, such as

#!/usr/sbin/dtrace -C -I. -s
...

But it does not work for me. And there is also no pragma for that. So
the only choice would be to wrap the D script into shell script, I'm
afraid.


> Also can one have several probes on the same entry?

Yes

HTH
-- 
        Vlad

Attachment: pgp435aG0e02c.pgp
Description: PGP signature

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to