public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Is it possible to create, using stap command, a kernel module which   accepts arguments
@ 2009-06-18 14:32 Dmitry Malichenko
  2009-06-18 15:47 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Malichenko @ 2009-06-18 14:32 UTC (permalink / raw)
  To: systemtap

Hello,

could you please help me with one question.
I saw some *.stp scripts which accept arguments, but these arguments
I should pass while running stap command.

Is it possible to write script in such a way, that argument should be
passed while running staprun command?
My goal is using *.ko module with command line argument instead of
recompiling *.stp script for each argument change.

I was looking for such information in manuals, but didn't find.

Thanks in advance,
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to create, using stap command, a kernel module which   accepts arguments
  2009-06-18 14:32 Is it possible to create, using stap command, a kernel module which accepts arguments Dmitry Malichenko
@ 2009-06-18 15:47 ` Frank Ch. Eigler
  2009-06-18 17:21   ` Dmitry Malichenko
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2009-06-18 15:47 UTC (permalink / raw)
  To: Dmitry Malichenko; +Cc: systemtap

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to create, using stap command, a kernel module   which accepts arguments
  2009-06-18 15:47 ` Frank Ch. Eigler
@ 2009-06-18 17:21   ` Dmitry Malichenko
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Malichenko @ 2009-06-18 17:21 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: systemtap

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-18 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-18 14:32 Is it possible to create, using stap command, a kernel module which accepts arguments Dmitry Malichenko
2009-06-18 15:47 ` Frank Ch. Eigler
2009-06-18 17:21   ` Dmitry Malichenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).