我想要的是:
要将网络名称空间选项添加到execsnoop bcc工具,以仅跟踪具有指定网络名称空间的日志,就像我们在许多其他bcc工具中使用filter PID选项一样。例如:execsnoop -N“ ns_id”
我在做什么:
int syscall__execve(struct pt_regs *ctx,
const char __user *filename,
const char __user *const __user *__argv,
const char __user *const __user *__envp)
{
// create data here and pass to submit_arg to save stack space (#555)
//int ret = PT_REGS_RC(ctx);
struct data_t data = {};
struct task_struct *task;
struct nsproxy *nsproxy;
struct net *net;
//struct mnt_namespace *mnt_ns;
data.pid = bpf_get_current_pid_tgid() >> 32;
u32 net_ns_inum = 0;
//net = (struct net *)get_net_ns_by_pid(data.pid); //
//net_ns_inum = (uintptr_t)net;
task = (struct task_struct *)bpf_get_current_task();
// Some kernels, like Ubuntu 4.13.0-generic, return 0
// as the real_parent->tgid.
// We use the get_ppid function as a fallback in those cases. (#1883)
data.ppid = task->real_parent->tgid;
net = task->nsproxy->net_ns;
FILTER_NETNS
data.netns = (uintptr_t)net; //here have to perform casting
I have added #include </usr/include/stdin.h>
but getting the warning though include <bits/libc-header-start.h>
is present in stdint.h
file:
In file included from /virtual/main.c:8:
/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
如果我解决这一问题,它会继续生成其他丢失的头文件错误。