This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Access of global variables in the script
- From: Arkady <arkady dot miasnikov at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Thu, 22 Jun 2017 12:56:47 +0300
- Subject: Access of global variables in the script
- Authentication-results: sourceware.org; auth=none
Hi,
My goal is to find out the absolute path of the just opened file in
the context of probe syscall.open.return
I checked the function fullpath_struct_file in the dentry.stp. Can I
code a better (faster) implementation than task_dentry_path() with
inline C?
A side note - task_dentry_path does not lock when traversing the
dentry->parent... tree. Is it safe?
I am trying to implement (essentially copy&paste) a function
dentry_path_raw() from the kernel 2.6.38 in the script targeting
kernel Linux centos6 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I think that I need to check if the rename_lock is available similarly
two what dentry_path_raw() does (see
http://elixir.free-electrons.com/linux/v2.6.38/source/fs/dcache.c#L2738).
Am I right?
I am doing something like this:
$ sudo stap -e 'probe begin {printf ("addr %d\n",
@var("rename_lock@fs/dcache.c")); exit(); }'
semantic error: while processing probe begin
semantic error: unable to find global 'rename_lock' in kernel, in
fs/dcache.c: operator '@var' at <input>:1:36
In the code include/linux/dcache.h I see the external (not exported)
variable rename_lock
http://elixir.free-electrons.com/linux/v2.6.32/source/include/linux/dcache.h#L190
Why does the build fail?
Thanks