selftests: kvm: fix build with glibc >= 2.30
PATCH 1/1 selftests: kvm: fix build with glibc >= 2.30
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 <[email protected]>
--- tools/testing/selftests/kvm/lib/assert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/lib/assert.c +2 -2
@@ -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) {
Signature · 1 line
2.20.1
Quoted 32 lines · Vitaly Kuznetsov
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 | staticpid_tgettid(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 <[email protected]>--- tools/testing/selftests/kvm/lib/assert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/assert.c +1
-1@@ -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); }
tools/testing/selftests/kvm/lib/assert.c test_assert(bool exp, const char *exp_str, · line 78
Quoted 8 lines
tools/testing/selftests/kvm/lib/assert.c +1
-1@@ -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