From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API
Date: Fri, 5 Aug 2016 11:56:49 +0300 [thread overview]
Message-ID: <57A454D1.5040501@oracle.com> (raw)
In-Reply-To: <20160804161323.GC3367@rei.lan>
On 08/04/2016 07:13 PM, Cyril Hrubis wrote:
> Hi!
>> +[source,c]
>> +-------------------------------------------------------------------------------
>> +#include "tst_test.h"
>> +
>> +void tst_reap_children(void);
>> +-------------------------------------------------------------------------------
>> +
>> +The 'tst_reap_children()' function makes the process wait for all of its
>> +children and exits with 'tst_brk(TBROK, ...)' if any of them returned
>> +a non zero exit code. This function may be called only from the main
>> +test process.
>
> There is no reason to limit the function to the main test process only.
> All it does it to reap all children and call tst_brk() in case that
> someting went wrong.
>
> We can for instance do:
>
> [main test pid]
> fork() --> [child]
> tst_reap_children() fork() -->[child]
> tst_reap_children() tst_brk(TBROK, ...)
>
> In this case the second level child will simply call exit(TBROK), the
> first level child will wait it and call exit(TBROK) because the second
> level child exitted uncleanly. And finally the main test pid will exit
> with TBROK, after a it's cleanup is called (if set).
>
> And it's nearly the same in case of tst_brk(TCONF, ...) but the exit
> value will be 0 and the TCONF is instead stored in the result structure
> in the shared memory.
>
> Maybe we should include this ascii art diagram in the documentation as
> well.
>
>
> The rest of the patchset is good, acked.
>
> Let's commit it without the sentence that limits this function to the
> main test process. I will do something about the documentation later.
>
Thank you! Committed the series without the sentence.
prev parent reply other threads:[~2016-08-05 8:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 14:16 [LTP] [PATCH V3 1/6] tst_safe_macros: SAFE_GETPGID Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 3/6] waitpid06: use the new API Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 4/6] waitpid07: " Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 5/6] waitpid08: " Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 6/6] waitpid11: " Stanislav Kholmanskikh
2016-08-04 16:13 ` [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API Cyril Hrubis
2016-08-05 8:30 ` Cyril Hrubis
2016-08-05 8:56 ` Stanislav Kholmanskikh [this message]
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=57A454D1.5040501@oracle.com \
--to=stanislav.kholmanskikh@oracle.com \
--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