Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/io_uring: fix compile breakage

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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Douglas Gilbert and committed by
Jens Axboe
72f04da4 f5cac8b1

+2 -2
+2 -2
tools/io_uring/io_uring-bench.c
··· 130 130 s->nr_files); 131 131 } 132 132 133 - static int gettid(void) 133 + static int lk_gettid(void) 134 134 { 135 135 return syscall(__NR_gettid); 136 136 } ··· 281 281 struct io_sq_ring *ring = &s->sq_ring; 282 282 int ret, prepped; 283 283 284 - printf("submitter=%d\n", gettid()); 284 + printf("submitter=%d\n", lk_gettid()); 285 285 286 286 srand48_r(pthread_self(), &s->rand); 287 287