Does DTrace script only support "#pragma D option ..", not "-x option"?
Nan Xiao
xiaonan830818 at gmail.com
Fri Jul 21 04:56:30 UTC 2017
Hi Matt & Mark,
Firstly, thanks very much for your responses!
I change my script as this:
#!/usr/sbin/dtrace -x dynvarsize=64m -s
dtrace:::BEGIN
{
printf("Hello FreeBSD!\n");
}
It still generates errors:
dtrace: failed to set -x dynvarsize: Invalid option name
But dynvarsize should be a valid option name.
Thanks!
Best Regards
Nan Xiao
On Fri, Jul 21, 2017 at 12:27 PM, Matthew Ahrens <mahrens at delphix.com>
wrote:
>
>
> On Thu, Jul 20, 2017 at 8:03 PM, Nan Xiao <xiaonan830818 at gmail.com> 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
>> _______________________________________________
>> freebsd-dtrace at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
>> To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe at freebsd.org"
>>
>
>
More information about the freebsd-dtrace
mailing list