public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] tools: io_uring-bench: rename gettid to avoid conflict with glibc
@ 2020-07-14  7:41 Josh Triplett
  0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2020-07-14  7:41 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring

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 <[email protected]>
---
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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-14  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14  7:41 [PATCH] tools: io_uring-bench: rename gettid to avoid conflict with glibc Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox