On Thu, Jul 20, 2017 at 8:03 PM, Nan Xiao <[email protected]> wrote:

> Hi all,
>
> My FreeBSD version is 11.0, and I write a simple DTrace script:
>
> #!/usr/sbin/dtrace -s -x dynvarsize=64m
>
> dtrace:::BEGIN
> {
>         printf("Hello FreeBSD!\n");
> }
>
> Running it will generate following error:
>
> dtrace: failed to open  -x dynvarsize=64m: No such file or directory
>
>
> So does DTrace only support using "#pragma D option dynvarsize=64m" format
> in script? I remembered Solaris can support both formats.
>

This doesn't work on Solaris, because (at least on Solaris/illumos) shebang
binaries only support one argument; further arguments are silently
ignored.  So your script does execute on Solaris, but the "-x
dynvarsize=64m" is ignored.

And as Mark said, the -s needs to be last.  But (on Solaris) then it'll be
ignored because it isn't the first argument.  You can combine multiple
no-argument flags in the shebang line, e.g.:

#!/usr/sbin/dtrace -vZs
...

--matt


>
> Thanks!
>
> Best Regards
> Nan Xiao
> _______________________________________________
> [email protected] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
> To unsubscribe, send any mail to "[email protected]"
>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
To unsubscribe, send any mail to "[email protected]"

Reply via email to