diff --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h --- a/openmp/runtime/src/kmp_affinity.h +++ b/openmp/runtime/src/kmp_affinity.h @@ -303,8 +303,9 @@ int retval = syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size, mask); #elif KMP_OS_FREEBSD - int retval = + int r = pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast(mask)); + int retval = (r == 0 ? 0 : -1); #endif if (retval >= 0) { return 0; @@ -322,8 +323,9 @@ int retval = syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size, mask); #elif KMP_OS_FREEBSD - int retval = + int r = pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast(mask)); + int retval = (r == 0 ? 0 : -1); #endif if (retval >= 0) { return 0; diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp --- a/openmp/runtime/src/z_Linux_util.cpp +++ b/openmp/runtime/src/z_Linux_util.cpp @@ -164,7 +164,7 @@ if (gCode > 0) { // Linux* OS only // The optimal situation: the OS returns the size of the buffer it expects. // - // A verification of correct behavior is that Isetaffinity on a NULL + // A verification of correct behavior is that setaffinity on a NULL // buffer with the same size fails with errno set to EFAULT. sCode = syscall(__NR_sched_setaffinity, 0, gCode, NULL); KA_TRACE(30, ("__kmp_affinity_determine_capable: " @@ -286,7 +286,7 @@ if (gCode == 0) { KMP_AFFINITY_ENABLE(KMP_CPU_SET_SIZE_LIMIT); KA_TRACE(10, ("__kmp_affinity_determine_capable: " - "affinity supported (mask size %d)\n"< + "affinity supported (mask size %d)\n", (int)__kmp_affin_mask_size)); KMP_INTERNAL_FREE(buf); return;