qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Warner Losh <imp@bsdimp.com>
Subject: Re: [PATCH 2/4] qtest: kill orphaned qtest QEMU processes on FreeBSD
Date: Tue, 12 Sep 2023 12:05:05 -0700	[thread overview]
Message-ID: <c2993aec-a002-a7ad-b27e-c9c9253d2abe@linaro.org> (raw)
In-Reply-To: <20230912184130.3056054-3-berrange@redhat.com>

On 9/12/23 11:41, Daniel P. Berrangé wrote:
> On Linux we use PR_SET_PDEATHSIG to kill orphaned QEMU processes
> if we fail to call qtest_quit(), or the test program aborts/segvs.
> This prevents meson from hanging forever due to the orphaned
> process keeping stdout open.
> 
> On FreeBSD we can achieve the same using PROC_PDEATHSIG_CTL, which
> gives us the equivalent protection against hangs.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   tests/qtest/libqtest.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index 34b9c14b75..b1eba71ffe 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -24,6 +24,9 @@
>   #ifdef __linux__
>   #include <sys/prctl.h>
>   #endif /* __linux__ */
> +#ifdef __FreeBSD__
> +#include <sys/procctl.h>
> +#endif /* __FreeBSD__ */
>   
>   #include "libqtest.h"
>   #include "libqmp.h"
> @@ -414,6 +417,10 @@ static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu(const char *fmt, ...)
>            */
>           prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
>   #endif /* __linux__ */
> +#ifdef __FreeBSD__
> +        int sig = SIGKILL;
> +        procctl(P_PID, getpid(), PROC_PDEATHSIG_CTL, &sig);

We could use 0 for "current process", but this works too.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


  reply	other threads:[~2023-09-12 19:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 18:41 [PATCH 0/4] ci: fix hang of FreeBSD CI jobs Daniel P. Berrangé
2023-09-12 18:41 ` [PATCH 1/4] microbit: add missing qtest_quit() call Daniel P. Berrangé
2023-09-12 19:10   ` Richard Henderson
2023-09-13  8:06     ` Daniel P. Berrangé
2023-09-12 18:41 ` [PATCH 2/4] qtest: kill orphaned qtest QEMU processes on FreeBSD Daniel P. Berrangé
2023-09-12 19:05   ` Richard Henderson [this message]
2023-09-12 18:41 ` [PATCH 3/4] gitlab: make Cirrus CI timeout explicit Daniel P. Berrangé
2023-09-13  5:54   ` Philippe Mathieu-Daudé
2023-09-12 18:41 ` [PATCH 4/4] gitlab: make Cirrus CI jobs gating Daniel P. Berrangé
2023-09-12 19:00 ` [PATCH 0/4] ci: fix hang of FreeBSD CI jobs Stefan Hajnoczi
2023-09-12 20:03 ` Thomas Huth
2023-09-13  8:48   ` Alex Bennée
2023-09-13  9:00     ` Daniel P. Berrangé
2023-09-13  9:02     ` Thomas Huth
2023-09-13  9:53       ` Philippe Mathieu-Daudé

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=c2993aec-a002-a7ad-b27e-c9c9253d2abe@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=berrange@redhat.com \
    --cc=imp@bsdimp.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).