[LTP] [PATCH] rt-migrate: Use int instead of pthread_t for thread IDs

Khem Raj raj.khem@gmail.com
Wed Aug 24 08:25:42 CEST 2022


pthread_t is opaque, but create_fifo_thread() returns integer therefore
on musl where thread_t is not integer, this fails to compile e.g.

| rt-migrate.c:450:14: error: incompatible integer to pointer conversion assigning to 'pthread_t' (aka 'struct __pthread *') from 'int' [-Wint-conversion]
|                 threads[i] = create_fifo_thread(start_task, (void *)i,
|                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Align the types used to fix the problems.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 testcases/realtime/func/rt-migrate/rt-migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/realtime/func/rt-migrate/rt-migrate.c b/testcases/realtime/func/rt-migrate/rt-migrate.c
index 3e6c82a2f..97ab604c7 100644
--- a/testcases/realtime/func/rt-migrate/rt-migrate.c
+++ b/testcases/realtime/func/rt-migrate/rt-migrate.c
@@ -394,7 +394,7 @@ static void stop_log(int sig)
 
 int main(int argc, char **argv)
 {
-	pthread_t *threads;
+	int *threads;
 	long i;
 	int ret;
 	struct timespec intv;
-- 
2.37.2



More information about the ltp mailing list