On 09/02/2015 08:45 PM, Namhyung Kim wrote:
On Sat, Aug 29, 2015 at 04:21:52AM +0000, Wang Nan wrote:
This patch adds BPF testcase for testing BPF event filtering.

By utilizing the result of 'perf test LLVM', this patch compiles the
eBPF sample program then test it ability. The BPF script in 'perf test
LLVM' collects half of execution of epoll_pwait(). This patch runs 111
times of it, so the resule should contains 56 samples.

Signed-off-by: Wang Nan <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Brendan Gregg <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: David Ahern <[email protected]>
Cc: He Kuang <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kaixu Xia <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Zefan Li <[email protected]>
Cc: [email protected]
Link: 
http://lkml.kernel.org/n/[email protected]
---

[SNIP]

+static int prepare_bpf(void *obj_buf, size_t obj_buf_sz)
+{
+       int err;
+       char errbuf[BUFSIZ];
+
+       err = bpf__prepare_load_buffer(obj_buf, obj_buf_sz, NULL);
+       if (err) {
+               bpf__strerror_prepare_load("[buffer]", false, err, errbuf,
+                                          sizeof(errbuf));
+               fprintf(stderr, " (%s)", errbuf);
+               return TEST_FAIL;
+       }
+
+       err = bpf__probe();
+       if (err) {
+               bpf__strerror_load(err, errbuf, sizeof(errbuf));
+               fprintf(stderr, " (%s)", errbuf);
+               if (getuid() != 0)

geteuid() ?

Thanks,
Namhyung


Already changed.

Thank you.


+                       fprintf(stderr, " (try run as root)");
+               return TEST_FAIL;
+       }
+
+       err = bpf__load();
+       if (err) {
+               bpf__strerror_load(err, errbuf, sizeof(errbuf));
+               fprintf(stderr, " (%s)", errbuf);
+               return TEST_FAIL;
+       }
+
+       return 0;
+}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to