Just to show where we'll hook pid based filters, and what we use to
obtain the current pid, using a BPF getpid() equivalent.
Now we need to remove that hardcoded PID with a BPF hash map, so that we
start by filtering 'perf trace's own PID, implement the --filter-pid
functionality, etc.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-oshrcgcekiyhd0whwisxfvtv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 
  */
 
 #include <stdio.h>
+#include <unistd.h>
 #include <linux/socket.h>
 
 /* bpf-output associated map */
        unsigned int len = sizeof(augmented_args);
        const void *filename_arg = NULL;
 
+       if (getpid() == 2971)
+               return 0;
+
        probe_read(&augmented_args.args, sizeof(augmented_args.args), args);
        /*
         * Yonghong and Edward Cree sayz:
 SEC("raw_syscalls:sys_exit")
 int sys_exit(struct syscall_exit_args *args)
 {
-       return 1; /* 0 as soon as we start copying data returned by the kernel, e.g. 'read' */
+       return getpid() != 2971;
 }
 
 license(GPL);