From 0629f60b79cd8958b0abd01611374c814354b0b1 Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Tue, 1 May 2012 19:44:17 -0700 Subject: rt-tests: cyclictest segfault with '-a' This fixes a segfault on ARM when the '-a' option is used. man sched_setaffinity says to use pthread_setaffinity_np() when using the POSIX threads API. Signed-off-by: Frank Rowand Tested-by: Darren Hart Signed-off-by: Clark Williams --- src/cyclictest/cyclictest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index dadced8..5a518e7 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -611,6 +611,7 @@ void *timerthread(void *param) struct thread_stat *stat = par->stats; int stopped = 0; cpu_set_t mask; + pthread_t thread; /* if we're running in numa mode, set our memory node */ if (par->node != -1) @@ -619,7 +620,8 @@ void *timerthread(void *param) if (par->cpu != -1) { CPU_ZERO(&mask); CPU_SET(par->cpu, &mask); - if(sched_setaffinity(0, sizeof(mask), &mask) == -1) + thread = pthread_self(); + if(pthread_setaffinity_np(thread, sizeof(mask), &mask) == -1) warn("Could not set CPU affinity to CPU #%d\n", par->cpu); } -- cgit 1.2.3-korg