All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process
Date: Mon, 31 May 2021 14:35:24 +0200	[thread overview]
Message-ID: <YLTYDC4hxQPVxkZq@yuki> (raw)
In-Reply-To: <d70f9e5f-0008-02aa-e099-2a8243c4b3fa@jv-coder.de>

Hi!
> But one more strange thing here.
> I wonder why this even works. $pid is used in _tst_kill_test and defined 
> in _tst_setup_timer as a local variable.
> It looks like it is inherited through the call chain and since it is 
> copied to the background process, it cannot be manipulated by the tests.
> Still I would vote for changing this at some point, because it is highly 
> confusing.

That's actually a correct and well defined behavior, if you call a
function g from function f the function g has access to the variables
local to f.

And yes it's confusing, but the alternative is having another global
variable which I do not think is much better than this.

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2021-05-31 12:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 12:26 [LTP] [PATCH 1/2] tst_test: discard the stderr output Li Wang
2021-05-18 12:26 ` [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process Li Wang
2021-05-19  6:46   ` Joerg Vehlow
2021-05-19  8:52     ` Li Wang
2021-05-31 12:35     ` Cyril Hrubis [this message]
2021-05-31 13:16       ` Joerg Vehlow
2021-05-31 12:54         ` Cyril Hrubis
2021-06-01  4:23           ` Joerg Vehlow
2021-05-31 12:49   ` Cyril Hrubis
2021-05-31 13:20     ` Joerg Vehlow
2021-05-31 12:57       ` Cyril Hrubis
2021-06-01  2:08         ` Li Wang
2021-06-01  4:03           ` Petr Vorel
2021-05-18 13:50 ` [LTP] [PATCH 1/2] tst_test: discard the stderr output Cyril Hrubis
2021-05-18 14:35 ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLTYDC4hxQPVxkZq@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.