[DTrace-devel] printf() with no "action" is not printed

Eugene Loh eugene.loh at oracle.com
Thu Jun 18 16:51:06 PDT 2020


Consider

         # dtrace -n 'BEGIN
         {
             printf("Hello world.\n");
             printf("Hello world. %d\n", 0);
             exit(0);
         }'

The first printf() is not printed.  The second one is.

I think the problem is that user space prints output based on "records" 
that are formed during BPF code generation, but the first printf() 
doesn't need any BPF code and therefore has no "record."  (The second 
printf -- suboptimally but fortuitously -- currently needs BPF generated 
so that the kernel will write a 0 back to user space.)

I'll look at a fix tomorrow, but if someone can guide me to the fix 
that'd be helpful.  I'm not familiar with this part of the code.  I'm 
okay poking around -- should be a good learning experience -- but it 
might be a lot faster if I had hints.




More information about the DTrace-devel mailing list