public inbox for [email protected]
 help / color / mirror / Atom feed
From: Josh Triplett <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected]
Subject: [PATCH] tools: io_uring-bench: rename gettid to avoid conflict with glibc
Date: Tue, 14 Jul 2020 00:41:26 -0700	[thread overview]
Message-ID: <0d4af5e77c9f5f3fe490f0287072084ed8624c56.1594712356.git.josh@joshtriplett.org> (raw)

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


                 reply	other threads:[~2020-07-14  7:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d4af5e77c9f5f3fe490f0287072084ed8624c56.1594712356.git.josh@joshtriplett.org \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox