[Openmp-commits] [PATCH] D72132: [OpenMP] affinity little fix for FreeBSD

David CARLIER via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 20 10:54:20 PST 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea99c0996348: [OpenMP] affinity little fix for FreeBSD (authored by devnexen).

Changed prior to commit:
  https://reviews.llvm.org/D72132?vs=236004&id=239172#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72132/new/

https://reviews.llvm.org/D72132

Files:
  openmp/runtime/src/kmp_affinity.h
  openmp/runtime/src/z_Linux_util.cpp


Index: openmp/runtime/src/z_Linux_util.cpp
===================================================================
--- openmp/runtime/src/z_Linux_util.cpp
+++ 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;
Index: openmp/runtime/src/kmp_affinity.h
===================================================================
--- openmp/runtime/src/kmp_affinity.h
+++ 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<cpuset_t *>(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<cpuset_t *>(mask));
+      int retval = (r == 0 ? 0 : -1);
 #endif
       if (retval >= 0) {
         return 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72132.239172.patch
Type: text/x-patch
Size: 1944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200120/b6e36179/attachment-0001.bin>


More information about the Openmp-commits mailing list