Linux 如何编写stap(systemtap)脚本以查看某个进程是否调用了特定的内核函数?

Linux 如何编写stap(systemtap)脚本以查看某个进程是否调用了特定的内核函数?,linux,process,kernel,system,tap,Linux,Process,Kernel,System,Tap,使用stap,我可以将*.stp文件写入 跟踪流程的操作,如: probe process("mytest").begin { printf("Caught mytest process") } 或者跟踪任何进程是否调用了内核函数: probe kernel.function("do_exit").call #all processes { printf("called kernel/exit.c: do_exit\n") } 但我的要求是:从特定进程名跟踪内核函数调用,比如

使用stap,我可以将*.stp文件写入

跟踪流程的操作,如:

probe process("mytest").begin
{
    printf("Caught mytest process")
}
或者跟踪任何进程是否调用了内核函数:

probe kernel.function("do_exit").call #all processes
{
    printf("called kernel/exit.c: do_exit\n")
}
但我的要求是:从特定进程名跟踪内核函数调用,比如跟踪“mytest”进程调用的“sys_open”

如何编写这个.stp语句/函数?
谢谢

我找到了一种方法:使用一个表示程序名的变量

global prog_name = "mytest";
probe kernel.function("do_exit").call
{
   if(execname() == progname){
        printf("called kernel/exit.c: do_exit\n");     
   }

}