All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c
@ 2024-10-28  3:41 Jason Xing
  2024-10-28 16:19 ` Andrii Nakryiko
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Xing @ 2024-10-28  3:41 UTC (permalink / raw)
  To: ast, daniel, andrii, eddyz87, mykolal, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah
  Cc: bpf, linux-kselftest, Jason Xing

From: Jason Xing <kernelxing@tencent.com>

As we can see from the title, when I compiled the selftests/bpf, I
saw the error:
implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
  skel->bss->tid = gettid();
                   ^~~~~~
                   getgid

Adding a define to fix it (referring to
tools/perf/tests/shell/coresight/thread_loop/thread_loop.c file.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
 tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
index f0a3a9c18e9e..a105759f3dcf 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
@@ -34,6 +34,8 @@
 #include "bpf_iter_ksym.skel.h"
 #include "bpf_iter_sockmap.skel.h"
 
+#define gettid() syscall(SYS_gettid)
+
 static void test_btf_id_or_null(void)
 {
 	struct bpf_iter_test_kern3 *skel;
-- 
2.37.3


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

* Re: [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c
  2024-10-28  3:41 [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c Jason Xing
@ 2024-10-28 16:19 ` Andrii Nakryiko
  2024-10-29  0:42   ` Jason Xing
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2024-10-28 16:19 UTC (permalink / raw)
  To: Jason Xing
  Cc: ast, daniel, andrii, eddyz87, mykolal, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
	bpf, linux-kselftest, Jason Xing

On Sun, Oct 27, 2024 at 8:41 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> From: Jason Xing <kernelxing@tencent.com>
>
> As we can see from the title, when I compiled the selftests/bpf, I
> saw the error:
> implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
>   skel->bss->tid = gettid();
>                    ^~~~~~
>                    getgid
>
> Adding a define to fix it (referring to
> tools/perf/tests/shell/coresight/thread_loop/thread_loop.c file.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
>  tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> index f0a3a9c18e9e..a105759f3dcf 100644
> --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> @@ -34,6 +34,8 @@
>  #include "bpf_iter_ksym.skel.h"
>  #include "bpf_iter_sockmap.skel.h"
>
> +#define gettid() syscall(SYS_gettid)
> +

We just call syscall(SYS_gettid) directly in all other tests, so let's
do just that?

pw-bot: cr

>  static void test_btf_id_or_null(void)
>  {
>         struct bpf_iter_test_kern3 *skel;
> --
> 2.37.3
>

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

* Re: [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c
  2024-10-28 16:19 ` Andrii Nakryiko
@ 2024-10-29  0:42   ` Jason Xing
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Xing @ 2024-10-29  0:42 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: ast, daniel, andrii, eddyz87, mykolal, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
	bpf, linux-kselftest, Jason Xing

On Tue, Oct 29, 2024 at 12:20 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sun, Oct 27, 2024 at 8:41 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
> >
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > As we can see from the title, when I compiled the selftests/bpf, I
> > saw the error:
> > implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
> >   skel->bss->tid = gettid();
> >                    ^~~~~~
> >                    getgid
> >
> > Adding a define to fix it (referring to
> > tools/perf/tests/shell/coresight/thread_loop/thread_loop.c file.
> >
> > Signed-off-by: Jason Xing <kernelxing@tencent.com>
> > ---
> >  tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > index f0a3a9c18e9e..a105759f3dcf 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > @@ -34,6 +34,8 @@
> >  #include "bpf_iter_ksym.skel.h"
> >  #include "bpf_iter_sockmap.skel.h"
> >
> > +#define gettid() syscall(SYS_gettid)
> > +
>
> We just call syscall(SYS_gettid) directly in all other tests, so let's
> do just that?

I got it and will adjust the bpf_iter.c in the next version.

Thanks,
Jason

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

end of thread, other threads:[~2024-10-29  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28  3:41 [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c Jason Xing
2024-10-28 16:19 ` Andrii Nakryiko
2024-10-29  0:42   ` Jason Xing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.