This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Controlling a systemtap script from userspace
On Tue, 2007-01-09 at 17:12 -0500, David A Sperry wrote:
> I have a C++ program than knows when to do the
> logging, the question is how to get that user space C++ program to set a
> global in a systemTap script?
I recommend something like the following:
# This probe checks for some unusual filenames which are
# actually signals from userspace to toggle logging on and off.
probe syscall.open {
if (filename == "####ON####") {
isLogging = 1
printf("Logging ON\n")
} else if (filename == "####OFF####") {
isLogging = 0
printf("Logging OFF\n")
}
}
Then in C or C++, you simple toggle logging with calls to open and the
appropriate special filename.
Martin