[PATCH 4/4] Use printpid for printing pid of pidfd
Dmitry V. Levin
ldv at altlinux.org
Sat Sep 4 12:05:39 UTC 2021
On Sat, Sep 04, 2021 at 05:28:43AM +0900, Masatake YAMATO wrote:
> * src/util.c (printpidfd): Use printfd instead of
> PRINT_VAL_D.
>
> * src/pidns.c (printfd): Allow to pass NULL
> as tcb when PID translation is not needed.
>
> Suggested-by: Ákos Uzonyi <uzonyi.akos at gmail.com>
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
> src/pidns.c | 3 ++-
> src/util.c | 4 +++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/pidns.c b/src/pidns.c
> index 9c7b7ce1a..59703d8c4 100644
> --- a/src/pidns.c
> +++ b/src/pidns.c
> @@ -539,7 +539,8 @@ void
> printpid(struct tcb *tcp, int pid, enum pid_type type)
> {
> PRINT_VAL_D(pid);
> - printpid_translation(tcp, pid, type);
> + if (tcp)
> + printpid_translation(tcp, pid, type);
Please fix indentation.
> }
>
> void
> diff --git a/src/util.c b/src/util.c
> index c944b3816..f9017b165 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -641,7 +641,9 @@ printpidfd(pid_t pid_of_fd, int fd, const char *path)
> return false;
>
> tprints("pid:");
> - PRINT_VAL_D(pid);
> + /* The pid translation is not needed because
> + * the pid is in strace's namespace. */
> + printpid(NULL, pid, PT_TID);
Please follow the style of multi-line comments we use in strace.
--
ldv
More information about the Strace-devel
mailing list