[Openmp-commits] [PATCH] D128466: [OpenMP] Use /proc/self instead of /proc/<getpid()> to get mapped addresses

Leon Yang via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 23 15:18:27 PDT 2022


lnyng updated this revision to Diff 439547.
lnyng added a comment.

Only apply change to Linux but not Hurd


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128466

Files:
  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
@@ -2021,7 +2021,11 @@
   /* On GNUish OSes, read the /proc/<pid>/maps pseudo-file to get all the
      address ranges mapped into the address space. */

+#if KMP_OS_LINUX
+  char *name = "/proc/self/maps";
+#else
   char *name = __kmp_str_format("/proc/%d/maps", getpid());
+#endif
   FILE *file = NULL;

   file = fopen(name, "r");
@@ -2053,7 +2057,9 @@

   // Free resources.
   fclose(file);
+#if !KMP_OS_LINUX
   KMP_INTERNAL_FREE(name);
+#endif
 #elif KMP_OS_FREEBSD
   char *buf;
   size_t lstsz;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128466.439547.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220623/d1c2aad4/attachment.bin>


More information about the Openmp-commits mailing list