linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/io_uring: fix compile breakage
@ 2020-09-14 21:36 Douglas Gilbert
  2020-09-15  1:34 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Douglas Gilbert @ 2020-09-14 21:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-block, axboe

It would seem none of the kernel continuous integration does this:
    $ cd tools/io_uring
    $ make

Otherwise it may have noticed:
   cc -Wall -Wextra -g -D_GNU_SOURCE   -c -o io_uring-bench.o
	 io_uring-bench.c
io_uring-bench.c:133:12: error: static declaration of ‘gettid’
	 follows non-static declaration
  133 | static int gettid(void)
      |            ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from io_uring-bench.c:27:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note:
	 previous declaration of ‘gettid’ was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
make: *** [<builtin>: io_uring-bench.o] Error 1

The problem on Ubuntu 20.04 (with lk 5.9.0-rc5) is that unistd.h
already defines gettid(). So prefix the local definition with
"lk_".

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
 tools/io_uring/io_uring-bench.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/io_uring/io_uring-bench.c b/tools/io_uring/io_uring-bench.c
index 0f257139b003..7703f0118385 100644
--- a/tools/io_uring/io_uring-bench.c
+++ b/tools/io_uring/io_uring-bench.c
@@ -130,7 +130,7 @@ static int io_uring_register_files(struct submitter *s)
 					s->nr_files);
 }
 
-static int gettid(void)
+static int lk_gettid(void)
 {
 	return syscall(__NR_gettid);
 }
@@ -281,7 +281,7 @@ static void *submitter_fn(void *data)
 	struct io_sq_ring *ring = &s->sq_ring;
 	int ret, prepped;
 
-	printf("submitter=%d\n", gettid());
+	printf("submitter=%d\n", lk_gettid());
 
 	srand48_r(pthread_self(), &s->rand);
 
-- 
2.25.1


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

* Re: [PATCH] tools/io_uring: fix compile breakage
  2020-09-14 21:36 [PATCH] tools/io_uring: fix compile breakage Douglas Gilbert
@ 2020-09-15  1:34 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-09-15  1:34 UTC (permalink / raw)
  To: Douglas Gilbert, linux-kernel; +Cc: linux-block

On 9/14/20 3:36 PM, Douglas Gilbert wrote:
> It would seem none of the kernel continuous integration does this:
>     $ cd tools/io_uring
>     $ make
> 
> Otherwise it may have noticed:
>    cc -Wall -Wextra -g -D_GNU_SOURCE   -c -o io_uring-bench.o
> 	 io_uring-bench.c
> io_uring-bench.c:133:12: error: static declaration of ‘gettid’
> 	 follows non-static declaration
>   133 | static int gettid(void)
>       |            ^~~~~~
> In file included from /usr/include/unistd.h:1170,
>                  from io_uring-bench.c:27:
> /usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note:
> 	 previous declaration of ‘gettid’ was here
>    34 | extern __pid_t gettid (void) __THROW;
>       |                ^~~~~~
> make: *** [<builtin>: io_uring-bench.o] Error 1
> 
> The problem on Ubuntu 20.04 (with lk 5.9.0-rc5) is that unistd.h
> already defines gettid(). So prefix the local definition with
> "lk_".

Thanks Doug - I haven't really been maintaining the examples in
the kernel, only in liburing. I'll apply this one, and hopefully
sync them up for 5.10 in general.


-- 
Jens Axboe


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

end of thread, other threads:[~2020-09-15  1:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 21:36 [PATCH] tools/io_uring: fix compile breakage Douglas Gilbert
2020-09-15  1:34 ` Jens Axboe

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