[CRIU] [PATCH] pstree: Avoid double getpid() call
Dmitry Safonov
0x7f454c46 at gmail.com
Sun Oct 28 22:26:57 MSK 2018
On 10/28/18 11:06 AM, Radostin Stoyanov wrote:
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
> criu/pstree.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/criu/pstree.c b/criu/pstree.c
> index 928fe2d1..ba9ff993 100644
> --- a/criu/pstree.c
> +++ b/criu/pstree.c
> @@ -335,8 +335,9 @@ err:
>
> static int prepare_pstree_for_shell_job(void)
> {
> - pid_t current_sid = getsid(getpid());
> - pid_t current_gid = getpgid(getpid());
> + pid_t current_pid = getpid();
> + pid_t current_sid = getsid(current_pid);
> + pid_t current_gid = getpgid(current_pid);
I like it. Can you add pid_t as a parameter and eliminate another call
in prepare_pstree_ids()?
--
Dima
More information about the CRIU
mailing list