Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2017 10:40:45 -0700
From:      Mark Johnston <markj@FreeBSD.org>
To:        Anatoly <anatoly@kazanfieldhockey.ru>
Cc:        freebsd-dtrace@freebsd.org
Subject:   Re: how to trace linux_open, linux_stat
Message-ID:  <20170815174045.GB44729@wkstn-mjohnston.west.isilon.com>
In-Reply-To: <20170815201703.6e3052e5@asd2>
References:  <20170815201703.6e3052e5@asd2>

next in thread | previous in thread | raw e-mail | index | archive | help
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).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170815174045.GB44729>