linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm: fix build with glibc >= 2.30
@ 2019-11-13 12:51 Vitaly Kuznetsov
  2019-11-13 14:48 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Kuznetsov @ 2019-11-13 12:51 UTC (permalink / raw)
  To: kvm; +Cc: linux-kernel, Paolo Bonzini

Glibc-2.30 gained gettid() wrapper, selftests fail to compile:

lib/assert.c:58:14: error: static declaration of ‘gettid’ follows non-static declaration
   58 | static pid_t gettid(void)
      |              ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from include/test_util.h:18,
                 from lib/assert.c:10:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/testing/selftests/kvm/lib/assert.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/lib/assert.c b/tools/testing/selftests/kvm/lib/assert.c
index 4911fc77d0f6..d1cf9f6e0e6b 100644
--- a/tools/testing/selftests/kvm/lib/assert.c
+++ b/tools/testing/selftests/kvm/lib/assert.c
@@ -55,7 +55,7 @@ static void test_dump_stack(void)
 #pragma GCC diagnostic pop
 }
 
-static pid_t gettid(void)
+static pid_t _gettid(void)
 {
 	return syscall(SYS_gettid);
 }
@@ -72,7 +72,7 @@ test_assert(bool exp, const char *exp_str,
 		fprintf(stderr, "==== Test Assertion Failure ====\n"
 			"  %s:%u: %s\n"
 			"  pid=%d tid=%d - %s\n",
-			file, line, exp_str, getpid(), gettid(),
+			file, line, exp_str, getpid(), _gettid(),
 			strerror(errno));
 		test_dump_stack();
 		if (fmt) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests: kvm: fix build with glibc >= 2.30
  2019-11-13 12:51 [PATCH] selftests: kvm: fix build with glibc >= 2.30 Vitaly Kuznetsov
@ 2019-11-13 14:48 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-11-13 14:48 UTC (permalink / raw)
  To: Vitaly Kuznetsov, kvm; +Cc: linux-kernel

On 13/11/19 13:51, Vitaly Kuznetsov wrote:
> Glibc-2.30 gained gettid() wrapper, selftests fail to compile:
> 
> lib/assert.c:58:14: error: static declaration of ‘gettid’ follows non-static declaration
>    58 | static pid_t gettid(void)
>       |              ^~~~~~
> In file included from /usr/include/unistd.h:1170,
>                  from include/test_util.h:18,
>                  from lib/assert.c:10:
> /usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
>    34 | extern __pid_t gettid (void) __THROW;
>       |                ^~~~~~
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  tools/testing/selftests/kvm/lib/assert.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/lib/assert.c b/tools/testing/selftests/kvm/lib/assert.c
> index 4911fc77d0f6..d1cf9f6e0e6b 100644
> --- a/tools/testing/selftests/kvm/lib/assert.c
> +++ b/tools/testing/selftests/kvm/lib/assert.c
> @@ -55,7 +55,7 @@ static void test_dump_stack(void)
>  #pragma GCC diagnostic pop
>  }
>  
> -static pid_t gettid(void)
> +static pid_t _gettid(void)
>  {
>  	return syscall(SYS_gettid);
>  }
> @@ -72,7 +72,7 @@ test_assert(bool exp, const char *exp_str,
>  		fprintf(stderr, "==== Test Assertion Failure ====\n"
>  			"  %s:%u: %s\n"
>  			"  pid=%d tid=%d - %s\n",
> -			file, line, exp_str, getpid(), gettid(),
> +			file, line, exp_str, getpid(), _gettid(),
>  			strerror(errno));
>  		test_dump_stack();
>  		if (fmt) {
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-13 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 12:51 [PATCH] selftests: kvm: fix build with glibc >= 2.30 Vitaly Kuznetsov
2019-11-13 14:48 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).