All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c
@ 2022-08-02  7:12 Jinrong Liang
  2022-08-02 15:08 ` Andrew Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jinrong Liang @ 2022-08-02  7:12 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Wanpeng Li, Sean Christopherson, Jim Mattson, Vitaly Kuznetsov,
	Joerg Roedel, Jinrong Liang, kvm, linux-kernel

From: Jinrong Liang <cloudliang@tencent.com>

The following warning appears when executing:
	make -C tools/testing/selftests/kvm

rseq_test.c: In function ‘main’:
rseq_test.c:237:33: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]
          (void *)(unsigned long)gettid());
                                 ^~~~~~
                                 getgid
/usr/bin/ld: /tmp/ccr5mMko.o: in function `main':
../kvm/tools/testing/selftests/kvm/rseq_test.c:237: undefined reference to `gettid'
collect2: error: ld returned 1 exit status
make: *** [../lib.mk:173: ../kvm/tools/testing/selftests/kvm/rseq_test] Error 1

Use the more compatible syscall(SYS_gettid) instead of gettid() to fix it.
More subsequent reuse may cause it to be wrapped in a lib file.

Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
---
 tools/testing/selftests/kvm/rseq_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c
index a54d4d05a058..299d316cc759 100644
--- a/tools/testing/selftests/kvm/rseq_test.c
+++ b/tools/testing/selftests/kvm/rseq_test.c
@@ -229,7 +229,7 @@ int main(int argc, char *argv[])
 	ucall_init(vm, NULL);
 
 	pthread_create(&migration_thread, NULL, migration_worker,
-		       (void *)(unsigned long)gettid());
+		       (void *)(unsigned long)syscall(SYS_gettid));
 
 	for (i = 0; !done; i++) {
 		vcpu_run(vcpu);
-- 
2.37.1


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

end of thread, other threads:[~2022-09-22 21:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  7:12 [PATCH] selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c Jinrong Liang
2022-08-02 15:08 ` Andrew Jones
2022-08-03 13:58   ` Jinrong Liang
2022-08-03 14:26     ` Andrew Jones
2022-08-03 16:10       ` Sean Christopherson
2022-08-03 17:26         ` Andrew Jones
2022-08-04 23:41           ` Sean Christopherson
2022-09-07 16:01 ` Sean Christopherson
2022-09-07 16:54   ` Liam Merwick
2022-09-16 10:02     ` JinrongLiang
2022-09-21 23:29       ` David Matlack
2022-09-22 21:02 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.