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

Kris Van Hees kris.van.hees at oracle.com
Thu Sep 22 20:33:30 UTC 2022


On Wed, Aug 10, 2022 at 11:07:04PM +0100, Nick Alcock via DTrace-devel wrote:
> This works in conjunction with PID namespaces where using getpid() does
> not.
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees 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
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list