Controlling a systemtap script from userspace

Martin Hunt hunt@redhat.com
Wed Jan 10 14:58:00 GMT 2007


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




More information about the Systemtap mailing list