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

Eugene Loh eugene.loh at oracle.com
Thu Sep 1 02:05:13 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 8/10/22 18:07, 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>
> ---
>   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;



More information about the DTrace-devel mailing list