Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570122
| From | Joe Stringer <joe@ovn.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. |
| Date | 2017-01-30 22:20 +0100 |
| Message-ID | <t5rwJ-x1-9@gated-at.bofh.it> (permalink) |
| References | <t3ZMe-3YK-3@gated-at.bofh.it> <t3ZMf-3YK-31@gated-at.bofh.it> <t5qKm-8tx-7@gated-at.bofh.it> <t5qKm-8tx-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 30 January 2017 at 12:28, Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Em Mon, Jan 30, 2017 at 05:25:06PM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Thu, Jan 26, 2017 at 01:19:56PM -0800, Joe Stringer escreveu: >> > Add new APIs to pin a BPF program (or specific instances) to the filesystem. >> > The user can specify the path full path within a BPF filesystem to pin the >> > program. >> > >> > bpf_program__pin_instance(prog, path, n) will pin the nth instance of >> > 'prog' to the specified path. >> > bpf_program__pin(prog, path) will create the directory 'path' (if it >> > does not exist) and pin each instance within that directory. For >> > instance, path/0, path/1, path/2. >> > >> > Signed-off-by: Joe Stringer <joe@ovn.org> >> >> make: Entering directory '/home/acme/git/linux/tools/perf' >> BUILD: Doing 'make -j4' parallel build >> CC /tmp/build/perf/builtin-record.o >> CC /tmp/build/perf/libbpf.o >> CC /tmp/build/perf/util/parse-events.o >> INSTALL trace_plugins >> libbpf.c: In function ‘make_dir’: >> libbpf.c:1303:6: error: implicit declaration of function ‘mkdir’ [-Werror=implicit-function-declaration] >> if (mkdir(path, 0700) && errno != EEXIST) >> ^~~~~ >> libbpf.c:1303:2: error: nested extern declaration of ‘mkdir’ [-Werror=nested-externs] >> if (mkdir(path, 0700) && errno != EEXIST) >> ^~ >> cc1: all warnings being treated as errors >> mv: cannot stat '/tmp/build/perf/.libbpf.o.tmp': No such file or directory >> /home/acme/git/linux/tools/build/Makefile.build:101: recipe for target '/tmp/build/perf/libbpf.o' failed Not sure why but I didn't see this. Appreciate the fix. >> >> >> And strdup() is not checked for failure, I'm fixing those, >> >> +++ b/tools/lib/bpf/libbpf.c >> @@ -36,6 +36,8 @@ >> #include <linux/magic.h> >> #include <linux/list.h> >> #include <linux/limits.h> >> +#include <sys/stat.h> >> +#include <sys/types.h> >> #include <sys/vfs.h> > > This as well: > > @@ -1338,7 +1343,7 @@ int bpf_program__pin(struct bpf_program *prog, > const char *path) > len = snprintf(buf, PATH_MAX, "%s/%d", path, i); > if (len < 0) > return -EINVAL; > - else if (len > PATH_MAX) > + else if (len >= PATH_MAX) > return -ENAMETOOLONG; > > > See 'man snprintf', return value: > > --- > Thus, a return value of size or more means that the output was > truncated. > --- Good spotting, I looked over the committed versions and tested them, they seem good to me. Thanks!
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv3 perf/core 0/6] Libbpf object pinning Joe Stringer <joe@ovn.org> - 2017-01-26 22:30 +0100
[PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Joe Stringer <joe@ovn.org> - 2017-01-26 22:30 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-30 21:30 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Joe Stringer <joe@ovn.org> - 2017-01-30 22:20 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 02:10 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 17:10 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 17:20 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 17:50 +0100
Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-30 21:30 +0100
[tip:perf/core] tools lib bpf: Add BPF program pinning APIs tip-bot for Joe Stringer <tipbot@zytor.com> - 2017-02-01 15:50 +0100
Re: [PATCHv3 perf/core 0/6] Libbpf object pinning Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-30 21:40 +0100
csiph-web