how to trace linux_open, linux_stat

Anatoly anatoly at kazanfieldhockey.ru
Wed Aug 16 22:05:50 UTC 2017


On Tue, 15 Aug 2017 10:40:45 -0700
Mark Johnston <markj at FreeBSD.org> wrote:

> On Tue, Aug 15, 2017 at 08:17:03PM +0300, Anatoly wrote:
> > Hello, I'm new to dtrace. I'm trying to run propiertary linux
> > application "1C thin client" (i386) using emulators/linux-c6 under
> > FreeBSD 11.1 amd64. Application starts, then stops shortly with
> > error message box and same error in log file:
> > 9db1fa37-b455-4f3f-b8dd-7de0ea7d6da3: File shared access error
> > 'v8stg://c:/1/FileStorage': ./src/storage.cpp(5013)
> > Thats why I put my hands on dtrace and trying to find out what this
> > app want to do. I'm not experienced in such a things, so I just
> > take a look at output of dtrace -l, and noted that there is
> > linux_open and linux_stat. Then I tried:
> > dtrace -n '::linux_open:entry { printf("%s %s", execname,
> > copyinstr(arg0)); }'
> > Thig gives output like:
> > dtrace: error on enabled probe ID 1 (ID 51007:
> > fbt:linux:linux_open:entry): invalid address (0xfffff80061022940) in
> > action #2 at DIF offset 12
> > How can I print out arg0 here? With just (non-linux) open:entry it
> > works.  
> 
> The issue is that fbt::linux_open:entry is tracing an internal kernel
> function, while ::open:entry is tracing a syscall
> (syscall::open:entry).
> 
> Looking at the output of "dtrace -lv -n ::linux_open:entry", I suspect
> you can get the info you want with:
> 
> # dtrace -n '::linux_open:entry {printf("%s",
> copyinstr(args[1]->path);}'
> 
> I'm not sure how syscall tracing for the Linux binary compat layer
> works. There is a linuxulator32 provider, but it doesn't seem to
> provide a probe for open(2).

Thank you, args[1]->path works.


More information about the freebsd-dtrace mailing list