[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:51:26 PDT 2022
lnyng updated this revision to Diff 439555.
lnyng added a comment.
Address comment
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
+ const 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.439555.patch
Type: text/x-patch
Size: 701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220623/b7ef9fc5/attachment-0001.bin>
More information about the Openmp-commits
mailing list