diff options
author | Frank Rowand <frank.rowand@am.sony.com> | 2012-05-01 19:44:17 -0700 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2012-05-03 16:17:38 -0500 |
commit | 0629f60b79cd8958b0abd01611374c814354b0b1 (patch) | |
tree | b8c2b254c1ec882b492f9dfb2a1b3d7f08575659 | |
parent | d5c8f73345ea4cb5791b9f399ed7793231f0c73b (diff) | |
download | cyclictest-0629f60b79cd8958b0abd01611374c814354b0b1.tar.gz |
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 <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | src/cyclictest/cyclictest.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |