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
Thanks a lot!
On Thu, Jun 18, 2009 at 7:30 PM, Frank Ch. Eigler<fche@redhat.com> wrote:
> 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
>