[DTrace-devel] [PATCH 12/17] drti: use /proc/self/maps

Nick Alcock nick.alcock at oracle.com
Wed Aug 10 22:07:04 UTC 2022


This works in conjunction with PID namespaces where using getpid() does
not.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 libdtrace/drti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdtrace/drti.c b/libdtrace/drti.c
index a5faa678a1e0..901f2a559c76 100644
--- a/libdtrace/drti.c
+++ b/libdtrace/drti.c
@@ -96,7 +96,7 @@ dtrace_dof_init(void)
 #else
 	lmid = 0;			/* We need a way to determine this. */
 
-	snprintf(mfn, sizeof(mfn), "/proc/%d/maps", getpid());
+	snprintf(mfn, sizeof(mfn), "/proc/self/maps");
 	if ((fp = fopen(mfn, "re")) == NULL) {
 		dprintf(2, "DRTI: Failed to open maps file.\n");
                 goto out;
-- 
2.37.1.265.g363c192786.dirty




More information about the DTrace-devel mailing list