netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] tools/bpf: add missing strings.h include
@ 2019-02-07 17:50 Andrii Nakryiko
  2019-02-07 19:02 ` Andrii Nakryiko
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-02-07 17:50 UTC (permalink / raw)
  To: yhs, songliubraving, ast, kafai, netdev, kernel-team; +Cc: Andrii Nakryiko

Few files in libbpf are using bzero() function (defined in strings.h header), but
don't include corresponding header. When libbpf is added as a dependency to pahole,
this undeterministically causes warnings on some machines:

bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
  bzero(&attr, sizeof(attr));
    ^~~~~
---
 tools/lib/bpf/bpf.c    | 1 +
 tools/lib/bpf/btf.c    | 1 +
 tools/lib/bpf/libbpf.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 3defad77dc7a..92fd27fe0599 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -22,6 +22,7 @@
  */
 
 #include <stdlib.h>
+#include <strings.h>
 #include <memory.h>
 #include <unistd.h>
 #include <asm/unistd.h>
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index ab6528c935a1..4324eb47d214 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 #include <errno.h>
 #include <linux/err.h>
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 47969aa0faf8..8d64ada5f728 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -18,6 +18,7 @@
 #include <libgen.h>
 #include <inttypes.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: add missing strings.h include
  2019-02-07 17:50 [PATCH bpf-next] tools/bpf: add missing strings.h include Andrii Nakryiko
@ 2019-02-07 19:02 ` Andrii Nakryiko
  2019-02-07 19:18 ` Alexei Starovoitov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-02-07 19:02 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Yonghong Song, Song Liu, Alexei Starovoitov, Martin Lau, netdev,
	kernel-team, Arnaldo Carvalho de Melo

cc Arnaldo

On Thu, Feb 7, 2019 at 9:52 AM Andrii Nakryiko <andriin@fb.com> wrote:
>
> Few files in libbpf are using bzero() function (defined in strings.h header), but
> don't include corresponding header. When libbpf is added as a dependency to pahole,
> this undeterministically causes warnings on some machines:
>
> bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
>   bzero(&attr, sizeof(attr));
>     ^~~~~
> ---
>  tools/lib/bpf/bpf.c    | 1 +
>  tools/lib/bpf/btf.c    | 1 +
>  tools/lib/bpf/libbpf.c | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 3defad77dc7a..92fd27fe0599 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -22,6 +22,7 @@
>   */
>
>  #include <stdlib.h>
> +#include <strings.h>
>  #include <memory.h>
>  #include <unistd.h>
>  #include <asm/unistd.h>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index ab6528c935a1..4324eb47d214 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -4,6 +4,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <unistd.h>
>  #include <errno.h>
>  #include <linux/err.h>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 47969aa0faf8..8d64ada5f728 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -18,6 +18,7 @@
>  #include <libgen.h>
>  #include <inttypes.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <errno.h>
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: add missing strings.h include
  2019-02-07 17:50 [PATCH bpf-next] tools/bpf: add missing strings.h include Andrii Nakryiko
  2019-02-07 19:02 ` Andrii Nakryiko
@ 2019-02-07 19:18 ` Alexei Starovoitov
  2019-02-07 19:21 ` Arnaldo Carvalho de Melo
  2019-02-08 10:23 ` David Laight
  3 siblings, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2019-02-07 19:18 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: yhs, songliubraving, ast, kafai, netdev, kernel-team

On Thu, Feb 07, 2019 at 09:50:27AM -0800, Andrii Nakryiko wrote:
> Few files in libbpf are using bzero() function (defined in strings.h header), but
> don't include corresponding header. When libbpf is added as a dependency to pahole,
> this undeterministically causes warnings on some machines:
> 
> bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
>   bzero(&attr, sizeof(attr));
>     ^~~~~
> ---

SOB is missing.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: add missing strings.h include
  2019-02-07 17:50 [PATCH bpf-next] tools/bpf: add missing strings.h include Andrii Nakryiko
  2019-02-07 19:02 ` Andrii Nakryiko
  2019-02-07 19:18 ` Alexei Starovoitov
@ 2019-02-07 19:21 ` Arnaldo Carvalho de Melo
  2019-02-07 19:23   ` Andrii Nakryiko
  2019-02-08 10:23 ` David Laight
  3 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-02-07 19:21 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: yhs, songliubraving, ast, kafai, netdev, kernel-team

Em Thu, Feb 07, 2019 at 09:50:27AM -0800, Andrii Nakryiko escreveu:
> Few files in libbpf are using bzero() function (defined in strings.h header), but
> don't include corresponding header. When libbpf is added as a dependency to pahole,
> this undeterministically causes warnings on some machines:
> 
> bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
>   bzero(&attr, sizeof(attr));
     ^~~~~

You forgot your:

Signed-off-by: Andrii Nakryiko <andriin@fb.com>

And a:

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>

:-)

- Arnaldo

> ---
>  tools/lib/bpf/bpf.c    | 1 +
>  tools/lib/bpf/btf.c    | 1 +
>  tools/lib/bpf/libbpf.c | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 3defad77dc7a..92fd27fe0599 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -22,6 +22,7 @@
>   */
>  
>  #include <stdlib.h>
> +#include <strings.h>
>  #include <memory.h>
>  #include <unistd.h>
>  #include <asm/unistd.h>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index ab6528c935a1..4324eb47d214 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -4,6 +4,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <unistd.h>
>  #include <errno.h>
>  #include <linux/err.h>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 47969aa0faf8..8d64ada5f728 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -18,6 +18,7 @@
>  #include <libgen.h>
>  #include <inttypes.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <errno.h>
> -- 
> 2.17.1

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: add missing strings.h include
  2019-02-07 19:21 ` Arnaldo Carvalho de Melo
@ 2019-02-07 19:23   ` Andrii Nakryiko
  0 siblings, 0 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-02-07 19:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Andrii Nakryiko, Yonghong Song, Song Liu, Alexei Starovoitov,
	Martin Lau, netdev, kernel-team

On Thu, Feb 7, 2019 at 11:21 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Thu, Feb 07, 2019 at 09:50:27AM -0800, Andrii Nakryiko escreveu:
> > Few files in libbpf are using bzero() function (defined in strings.h header), but
> > don't include corresponding header. When libbpf is added as a dependency to pahole,
> > this undeterministically causes warnings on some machines:
> >
> > bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
> >   bzero(&attr, sizeof(attr));
>      ^~~~~
>
> You forgot your:
>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> And a:
>
> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> :-)
>

argh... v2 incoming, thanks!

> - Arnaldo
>
> > ---
> >  tools/lib/bpf/bpf.c    | 1 +
> >  tools/lib/bpf/btf.c    | 1 +
> >  tools/lib/bpf/libbpf.c | 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> > index 3defad77dc7a..92fd27fe0599 100644
> > --- a/tools/lib/bpf/bpf.c
> > +++ b/tools/lib/bpf/bpf.c
> > @@ -22,6 +22,7 @@
> >   */
> >
> >  #include <stdlib.h>
> > +#include <strings.h>
> >  #include <memory.h>
> >  #include <unistd.h>
> >  #include <asm/unistd.h>
> > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> > index ab6528c935a1..4324eb47d214 100644
> > --- a/tools/lib/bpf/btf.c
> > +++ b/tools/lib/bpf/btf.c
> > @@ -4,6 +4,7 @@
> >  #include <stdio.h>
> >  #include <stdlib.h>
> >  #include <string.h>
> > +#include <strings.h>
> >  #include <unistd.h>
> >  #include <errno.h>
> >  #include <linux/err.h>
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index 47969aa0faf8..8d64ada5f728 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -18,6 +18,7 @@
> >  #include <libgen.h>
> >  #include <inttypes.h>
> >  #include <string.h>
> > +#include <strings.h>
> >  #include <unistd.h>
> >  #include <fcntl.h>
> >  #include <errno.h>
> > --
> > 2.17.1
>
> --
>
> - Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH bpf-next] tools/bpf: add missing strings.h include
  2019-02-07 17:50 [PATCH bpf-next] tools/bpf: add missing strings.h include Andrii Nakryiko
                   ` (2 preceding siblings ...)
  2019-02-07 19:21 ` Arnaldo Carvalho de Melo
@ 2019-02-08 10:23 ` David Laight
  3 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2019-02-08 10:23 UTC (permalink / raw)
  To: 'Andrii Nakryiko', yhs@fb.com, songliubraving@fb.com,
	ast@fb.com, kafai@fb.com, netdev@vger.kernel.org,
	kernel-team@fb.com

From: Andrii Nakryiko
> Sent: 07 February 2019 17:50
> 
> Few files in libbpf are using bzero() function (defined in strings.h header), but
> don't include corresponding header. When libbpf is added as a dependency to pahole,
> this undeterministically causes warnings on some machines:
> 
> bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
>   bzero(&attr, sizeof(attr));
>     ^~~~~

Wouldn't it be better to change these to the more portable memset()?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-08 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 17:50 [PATCH bpf-next] tools/bpf: add missing strings.h include Andrii Nakryiko
2019-02-07 19:02 ` Andrii Nakryiko
2019-02-07 19:18 ` Alexei Starovoitov
2019-02-07 19:21 ` Arnaldo Carvalho de Melo
2019-02-07 19:23   ` Andrii Nakryiko
2019-02-08 10:23 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).