bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: add _GNU_SOURCE for reallocarray to ringbuf.c
@ 2020-06-01 20:26 Andrii Nakryiko
  2020-06-01 20:35 ` Song Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2020-06-01 20:26 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

On systems with recent enough glibc, reallocarray compat won't kick in, so
reallocarray() itself has to come from stdlib.h include. But _GNU_SOURCE is
necessary to enable it. So add it.

Fixes: 4cff2ba58bf1 ("libbpf: Add BPF ring buffer support")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/ringbuf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c
index bc10fa1d43c7..4fc6c6cbb4eb 100644
--- a/tools/lib/bpf/ringbuf.c
+++ b/tools/lib/bpf/ringbuf.c
@@ -4,6 +4,9 @@
  *
  * Copyright (C) 2020 Facebook, Inc.
  */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
-- 
2.24.1


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

* Re: [PATCH bpf-next] libbpf: add _GNU_SOURCE for reallocarray to ringbuf.c
  2020-06-01 20:26 [PATCH bpf-next] libbpf: add _GNU_SOURCE for reallocarray to ringbuf.c Andrii Nakryiko
@ 2020-06-01 20:35 ` Song Liu
  2020-06-01 22:14   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2020-06-01 20:35 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Networking, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Kernel Team

On Mon, Jun 1, 2020 at 1:26 PM Andrii Nakryiko <andriin@fb.com> wrote:
>
> On systems with recent enough glibc, reallocarray compat won't kick in, so
> reallocarray() itself has to come from stdlib.h include. But _GNU_SOURCE is
> necessary to enable it. So add it.
>
> Fixes: 4cff2ba58bf1 ("libbpf: Add BPF ring buffer support")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>

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

* Re: [PATCH bpf-next] libbpf: add _GNU_SOURCE for reallocarray to ringbuf.c
  2020-06-01 20:35 ` Song Liu
@ 2020-06-01 22:14   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-06-01 22:14 UTC (permalink / raw)
  To: Song Liu
  Cc: Andrii Nakryiko, bpf, Networking, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Kernel Team

On Mon, Jun 1, 2020 at 1:36 PM Song Liu <song@kernel.org> wrote:
>
> On Mon, Jun 1, 2020 at 1:26 PM Andrii Nakryiko <andriin@fb.com> wrote:
> >
> > On systems with recent enough glibc, reallocarray compat won't kick in, so
> > reallocarray() itself has to come from stdlib.h include. But _GNU_SOURCE is
> > necessary to enable it. So add it.
> >
> > Fixes: 4cff2ba58bf1 ("libbpf: Add BPF ring buffer support")
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> Acked-by: Song Liu <songliubraving@fb.com>

Applied. Thanks

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

end of thread, other threads:[~2020-06-01 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 20:26 [PATCH bpf-next] libbpf: add _GNU_SOURCE for reallocarray to ringbuf.c Andrii Nakryiko
2020-06-01 20:35 ` Song Liu
2020-06-01 22:14   ` Alexei Starovoitov

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).