[DTrace-devel] [PATCH v2 13/20] drti: use /proc/self/maps

Nick Alcock nick.alcock at oracle.com
Wed Sep 7 13:00:00 UTC 2022


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

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/drti.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libdtrace/drti.c b/libdtrace/drti.c
index a5faa678a1e0..a533028264d3 100644
--- a/libdtrace/drti.c
+++ b/libdtrace/drti.c
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  */
@@ -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