Is it possible to create, using stap command, a kernel module which accepts arguments

Frank Ch. Eigler fche@redhat.com
Thu Jun 18 15:47:00 GMT 2009


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



More information about the Systemtap mailing list