我可以在RHEL6下的SystemTap中获取当前工作目录吗

时间:2019-01-01 12:36:38

标签: rhel6 systemtap working-directory

我有以下SystemTap程序:

#!/usr/bin/stap
function proc:string() {
    return sprintf("[%s] %s(%s)::%s() (pid %d, uid %d, cwd %s)",
        execname(), cmdline_arg(0), cmdline_args(1,-1,", "), caller(), pid(), uid(),
        fullpath_struct_path(task_cwd_path(task_current()))
    );
}

probe syscall.open.return, syscall.stat.return,
    syscall.open64.return ?, syscall.stat64.return ? {
    filename = user_string($filename);
    if ($return < 0) {
        eno = -$return;
        printf("%s => %s '%s' by %s\n", pn(), errno_str(eno), filename, proc());
    }
}

运行时出现以下错误:

  

语义错误:未解决的函数(类似:d_path,inode_path,task_cpu,task_current,task_dentry_path):标识符'task_cwd_path'在/ tmp / stap-test:5:30

我相信是因为Red Hat直到RHEL7才添加task_cwd_path()函数。有没有其他方法可以返回将与RHEL6一起使用的当前目录?

0 个答案:

没有答案