[Openmp-commits] [openmp] 3f1eafa - [OpenMP] Provide __NR_sched_[gs]etaffinity on Linux/sparc64 (#138525)

via Openmp-commits openmp-commits at lists.llvm.org
Tue May 6 00:13:37 PDT 2025


Author: Rainer Orth
Date: 2025-05-06T09:13:34+02:00
New Revision: 3f1eafaa04f1c04ae5c7aae3e452eb75c507584d

URL: https://github.com/llvm/llvm-project/commit/3f1eafaa04f1c04ae5c7aae3e452eb75c507584d
DIFF: https://github.com/llvm/llvm-project/commit/3f1eafaa04f1c04ae5c7aae3e452eb75c507584d.diff

LOG: [OpenMP] Provide __NR_sched_[gs]etaffinity on Linux/sparc64 (#138525)

`libomp` doesn't currently build on Linux/sparc64 due to lack of
`__NR_sched_setaffinity` and `__NR_sched_getaffinity` definitions.

This patch provides those.

Tested on `sparcv9-sun-solaris2.11`, `sparc64-unknown-linux-gnu`,
`amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.

Added: 
    

Modified: 
    openmp/runtime/src/kmp_affinity.h

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h
index 9ab2c0cc70d8c..dc3191caae634 100644
--- a/openmp/runtime/src/kmp_affinity.h
+++ b/openmp/runtime/src/kmp_affinity.h
@@ -311,6 +311,17 @@ class KMPHwlocAffinity : public KMPAffinity {
 #elif __NR_sched_getaffinity != 240
 #error Wrong code for getaffinity system call.
 #endif /* __NR_sched_getaffinity */
+#elif KMP_ARCH_SPARC
+#ifndef __NR_sched_setaffinity
+#define __NR_sched_setaffinity 261
+#elif __NR_sched_setaffinity != 261
+#error Wrong code for setaffinity system call.
+#endif /* __NR_sched_setaffinity */
+#ifndef __NR_sched_getaffinity
+#define __NR_sched_getaffinity 260
+#elif __NR_sched_getaffinity != 260
+#error Wrong code for getaffinity system call.
+#endif /* __NR_sched_getaffinity */
 #else
 #error Unknown or unsupported architecture
 #endif /* KMP_ARCH_* */


        


More information about the Openmp-commits mailing list