[PATCH] tools: io_uring-bench: rename gettid to avoid conflict with glibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Current glibc defines a gettid function, which results in the following error:

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;
      |                ^~~~~~

Rename the syscall-based gettid to sys_gettid to avoid a name conflict.

Signed-off-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
---
Another alternative would be for io_uring-bench to count on recent
glibc, and call settid without defining its own version.

 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..850f0ee90828 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 sys_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", sys_gettid());
 
 	srand48_r(pthread_self(), &s->rand);
 
-- 
2.28.0.rc0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux