This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Is it possible to create, using stap command, a kernel module which accepts arguments
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Dmitry Malichenko <dmitryml at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 18 Jun 2009 11:30:59 -0400
- Subject: Re: Is it possible to create, using stap command, a kernel module which accepts arguments
- References: <7e975d0b0906180732pf15e630y6af76a903828994a@mail.gmail.com>
Dmitry Malichenko <dmitryml@gmail.com> writes:
> [...] I saw some *.stp scripts which accept arguments, but these
> arguments I should pass while running stap command. [...] My goal
> is using *.ko module with command line argument instead of
> recompiling *.stp script for each argument change.
There are two current solutions for this:
One, use of procfs-based probes to receive parameters at run time from
a probe-specific /proc file:
probe procfs("file").write { use($value) }
Two, use of module parameters to initialize scalar global variables
with staprun:
% stap -p4 -e 'global foo,bar probe begin {printf("%s %d\n",foo, bar)}
stap_xyz.ko
% sudo staprun stap_xyz.ko foo=hello bar=4
- FChE