This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]