[Openmp-commits] [PATCH] D92660: [OpenMP] Fix too long name for shm segment on macOS

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 4 08:34:34 PST 2020


jlpeyton created this revision.
jlpeyton added reviewers: AndreyChurbanov, terdner.
jlpeyton added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
jlpeyton requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

For macOS the shm segment name is apparently too long with the user id added to the end. Remove the user id component of the shm segment name and just use the pid like before.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92660

Files:
  openmp/runtime/src/kmp_runtime.cpp


Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -6356,11 +6356,12 @@
 // Value to be saved in env var __KMP_REGISTERED_LIB_<pid>.
 
 static inline char *__kmp_reg_status_name() {
-  /* On RHEL 3u5 if linked statically, getpid() returns different values in
-     each thread. If registration and unregistration go in different threads
-     (omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
-     env var can not be found, because the name will contain different pid. */
-#if KMP_OS_UNIX && KMP_DYNAMIC_LIB // shared memory is with dynamic library
+/* On RHEL 3u5 if linked statically, getpid() returns different values in
+   each thread. If registration and unregistration go in different threads
+   (omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
+   env var can not be found, because the name will contain different pid. */
+// macOS* complains about name being too long with additional getuid()
+#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
   return __kmp_str_format("__KMP_REGISTERED_LIB_%d_%d", (int)getpid(),
                           (int)getuid());
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92660.309543.patch
Type: text/x-patch
Size: 1267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201204/afb4fd44/attachment.bin>


More information about the Openmp-commits mailing list