From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/3] syscalls/getrusage: Cleanup and bugfix for getrusage03
Date: Wed, 16 Jun 2021 15:13:38 +0200 [thread overview]
Message-ID: <YMn5AvbsDDV8ojWu@yuki> (raw)
In-Reply-To: <8f8852e0-eed3-f7ae-744e-db48724e9b02@huawei.com>
Hi!
> Same with lib: tst_process_state: Add tst_process_release_wait().
>
> If we call the signal(SIGCHLD,SIG_IGN), the SIGCHLD signal is ignored by
> the system. Thus, no zombie is created before the child is terminated.
> The logs are as follows:
>
> getrusage03.h:27: TINFO: allocate 400MB
> getrusage03.c:39: TPASS: check that initial.children ~= pre_wait.children
> getrusage03.c:39: TPASS: check that post_wait.children ~= 400MB
> getrusage03.h:27: TINFO: allocate 500MB
> getrusage03.c:123: TBROK: Failed to open FILE '/proc/84598/stat' for
> reading: ENOENT (2)
>
> So I write TST_PROCESS_RELEASE_WAIT() here to check /proc/$PID.
Ah right, reading the documentation if parent ignores sigchild the child
is discarded and there is no trace of it on the system once it returns
from main().
So I guess that we should add a function that checks that a given pid is
present on a system but there is simpler interface for this, if you do
kill(2) with signal == 0 it returns with with errno set to ESRCH if the
pid is no longer present on a system.
Also I'm not sure if release is right word here, maybe it would better
describe the action if the function name was tst_process_exit_wait().
> I noticed that some safe_ micro checks tst_test->forks_child or other
> tst_test->xx, while tst_test is not defined in some functions with
> #define TST_NO_DEFAULT_MAIN.
Ah right, I guess that in a case of fork() and clone() calls it would be
easier not to use SAFE_MACROS() for processes that have been started by
exec().
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2021-06-16 13:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 9:36 [LTP] [PATCH 0/3] Cleanup and bugfix for getrusage{01, 03} Xie Ziyao
2021-06-16 9:36 ` [LTP] [PATCH 1/3] lib: tst_process_state: Add tst_process_release_wait() Xie Ziyao
2021-06-16 11:04 ` Cyril Hrubis
2021-06-16 11:54 ` Xie Ziyao
2021-06-16 9:36 ` [LTP] [PATCH 2/3] syscalls/getrusage: Cleanup and bugfix for getrusage03 Xie Ziyao
2021-06-16 11:47 ` Cyril Hrubis
2021-06-16 13:13 ` Xie Ziyao
2021-06-16 13:13 ` Cyril Hrubis [this message]
2021-06-16 9:36 ` [LTP] [PATCH 3/3] syscalls/getrusage: Convert getrusage01 to the new API Xie Ziyao
2021-06-16 11:56 ` Cyril Hrubis
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=YMn5AvbsDDV8ojWu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox