From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 09/11] syscalls/waitpid: adapt reap_children() to test stopped children
Date: Thu, 25 Aug 2016 13:39:05 +0200 [thread overview]
Message-ID: <20160825113904.GF10490@rei.lan> (raw)
In-Reply-To: <1472041679-29759-10-git-send-email-stanislav.kholmanskikh@oracle.com>
Hi!
> If the pid returned by waitpid() is the pid of a stopped child,
> we send it the SIGCONT signal.
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> This is a new patch in the series, extracted from V1 of waitpid13.c
>
> testcases/kernel/syscalls/waitpid/waitpid_common.h | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/waitpid/waitpid_common.h b/testcases/kernel/syscalls/waitpid/waitpid_common.h
> index f724a17..7b67a06 100644
> --- a/testcases/kernel/syscalls/waitpid/waitpid_common.h
> +++ b/testcases/kernel/syscalls/waitpid/waitpid_common.h
> @@ -131,6 +131,23 @@ static int reap_children(pid_t wp_pid, int wp_opts, pid_t *children, int len)
> return -1;
> }
>
> + if (WIFSTOPPED(status)) {
> + if (WSTOPSIG(status) != SIGSTOP) {
> + tst_res(TFAIL,
> + "Pid %d: expected SIGSTOP, got %d",
> + pid, WSTOPSIG(status));
> + return -1;
> + }
Maybe we should print tst_res(TINFO, "Seding SIGCONT to %i", pid); here.
> + if (kill(pid, SIGCONT) < 0) {
> + tst_res(TFAIL | TERRNO,
> + "kill(%d, SIGCONT) failed", pid);
> + return -1;
> + }
> +
> + continue;
> + }
> +
> for (i = 0; i < len; i++) {
> if (pid == children[i]) {
> children[i] = 0;
Otherwise it looks good.
I guess that there is no real chance that some of the children in
testcases that use this function would be SIGSTOPed accidentally and
this code will make that bug disappear...
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-08-25 11:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 12:27 [LTP] waitpid: new API (part 2) V2 Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 01/11] waitpid09: use the new API Stanislav Kholmanskikh
2016-08-25 10:49 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 02/11] waitpid10: " Stanislav Kholmanskikh
2016-08-25 11:09 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 03/11] Add TST_TRACE Stanislav Kholmanskikh
2016-08-25 11:15 ` Cyril Hrubis
2016-08-25 12:09 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 04/11] syscalls/waitpid: call reap_children() via TST_TRACE() Stanislav Kholmanskikh
2016-08-25 11:20 ` Cyril Hrubis
2016-08-25 11:56 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 05/11] syscalls/waitpid: implement waitpid_ret_test() Stanislav Kholmanskikh
2016-08-25 11:28 ` Cyril Hrubis
2016-08-25 12:00 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 06/11] syscalls/waitpid: make reap_children() fail if errno is not ECHILD Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 07/11] waitpid11: update the description Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 08/11] waitpid12: use the new API Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 09/11] syscalls/waitpid: adapt reap_children() to test stopped children Stanislav Kholmanskikh
2016-08-25 11:39 ` Cyril Hrubis [this message]
2016-08-25 12:02 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 10/11] waitpid13: use the new API Stanislav Kholmanskikh
2016-08-25 12:07 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 11/11] waitpid08: test stopped children Stanislav Kholmanskikh
2016-08-25 12:08 ` Cyril Hrubis
2016-08-26 9:06 ` Stanislav Kholmanskikh
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=20160825113904.GF10490@rei.lan \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox