| From 575bea1c9b642a11ac5b7162aea6a9f905c60318 Mon Sep 17 00:00:00 2001 |
| From: Jens Axboe <axboe@kernel.dk> |
| Date: Fri, 26 Aug 2022 14:14:44 -0600 |
| Subject: [PATCH] t/io_uring: remove duplicate definition of gettid() |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| With a recent change, we now include os.h through nvme.h, and this |
| can cause a duplicate gettid() definition: |
| |
| t/io_uring.c:499:12: error: redefinition of ‘gettid’ |
| static int gettid(void) |
| ^~~~~~ |
| In file included from t/../engines/../os/os.h:39, |
| from t/../engines/../thread_options.h:5, |
| from t/../engines/../fio.h:18, |
| from t/../engines/nvme.h:10, |
| from t/io_uring.c:38: |
| t/../engines/../os/os-linux.h:147:19: note: previous definition of |
| ‘gettid’ was here |
| static inline int gettid(void) |
| ^~~~~~ |
| |
| Include os.h directly to make it clear that we use it, and remove the |
| gettid() definition from io_uring.c. |
| |
| Reported-by: Yi Zhang <yi.zhang@redhat.com> |
| Signed-off-by: Jens Axboe <axboe@kernel.dk> |
| --- |
| t/io_uring.c | 8 +------- |
| 1 file changed, 1 insertion(+), 7 deletions(-) |
| |
| diff --git a/t/io_uring.c b/t/io_uring.c |
| index b90bcf78..e8e41796 100644 |
| --- a/t/io_uring.c |
| +++ b/t/io_uring.c |
| @@ -30,6 +30,7 @@ |
| #include <sched.h> |
| |
| #include "../arch/arch.h" |
| +#include "../os/os.h" |
| #include "../lib/types.h" |
| #include "../lib/roundup.h" |
| #include "../lib/rand.h" |
| @@ -495,13 +496,6 @@ static int io_uring_enter(struct submitter *s, unsigned int to_submit, |
| #endif |
| } |
| |
| -#ifndef CONFIG_HAVE_GETTID |
| -static int gettid(void) |
| -{ |
| - return syscall(__NR_gettid); |
| -} |
| -#endif |
| - |
| static unsigned file_depth(struct submitter *s) |
| { |
| return (depth + s->nr_files - 1) / s->nr_files; |