On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov <a...@plumgrid.com> wrote:
[...]
> +static int load_and_attach(const char *event, struct bpf_insn *prog, int 
> size)
> +{
> +       int fd, event_fd, err;
> +       char fmt[32];
> +       char path[256] = DEBUGFS;
> +
> +       fd = bpf_prog_load(BPF_PROG_TYPE_TRACING_FILTER, prog, size, license);
> +
> +       if (fd < 0) {
> +               printf("err %d errno %d\n", fd, errno);
> +               return fd;
> +       }

Minor suggestion: since this is sample code, I'd always print the bpf
log after this this printf() error message:

printf("%s", bpf_log_buf);

Which has helped me debug my eBPF programs, as will be the case for
anyone hacking on the examples. Or have a function for logdie(), if
the log buffer may be populated with useful messages from other error
paths as well.

Brendan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
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