From patchwork Fri Sep 15 15:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 723120 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp436362wro; Fri, 15 Sep 2023 08:11:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6XZuPUj5ZkJwX8GhogsdgYhHD88vnVsfFyienJ5g55R7AHip9bIVPsT0oCRXkhRuYfT9M X-Received: by 2002:a05:6102:408:b0:44d:4dd6:7966 with SMTP id d8-20020a056102040800b0044d4dd67966mr1906601vsq.34.1694790688425; Fri, 15 Sep 2023 08:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694790688; cv=none; d=google.com; s=arc-20160816; b=dLny3A+IAMbuKtafIVfNqOwkgX3Mq+kDYI9hR5UBQV9Yx4iffPxu5MwdzeIPxlAV3Q HeTj2KOr4porL5iy65Av5GIEC4HnlybLSg2nJrR237RRhFRMM5asjzJNfPKzhsLbhdSq PcSUxsRgCSHUV0KtG0PjJD9sF25tkR9HjKb6yP1yV/+3kEDpPApWr2qvuIYOU4WHwtIE cYSvqpubzVmncshibMWkYTwBmKYQ5FRCSYRju3gK/0uwoq8D6JLkLKC6H205tyzAymVF 5gwkqfpTnzl2FezD0kpax/bWeekpvKCTjmOjIRG4J+LZwdaFeuSp+qg8FcciJM0HoB2b dq7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ODBQ1lRWFRqN+1C2qyimy7vJFOa6KXmE7+4RiDeBuo=; fh=xfkjUhzHS3E2Oldl3Y6EA/0pJurhODVvJIvqI9+5fQQ=; b=ndSgTK0JpIfKJkCro2gyB+69ufI7FgYgyLzzKcebANv1D2j7M/eDLipM1EDrpeFELo /YahtWMv70ETBjV00McoI+pp5QkRrR7cYXrfXzXTQCqnLiQ3ObD29u3Apdfaks9BGgsW X1LVUVFztuoB4COTeJ9IIhe+XZlykKXk/sP5jbWytN/esHM8k4ql4p7md6mwf6rPqV5r /5dZYbofLGPQdL6m4SdnRIqgRtQP02AAaJ2/HsEaTXQt7wCggqS4o5qkKVWvpt6F/43b BsHXCCCKP/LF8aFzLU+OhQIDd/48/xfGxKX4FODvRKc8SMnMRa89GEs3aNvfz/7LP9aJ EBtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGOEaIPm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n29-20020a67d61d000000b004409ad72a3bsi304451vsj.408.2023.09.15.08.11.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 08:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGOEaIPm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhARU-0003Nw-Km; Fri, 15 Sep 2023 11:09:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhARJ-0003HS-HM for qemu-devel@nongnu.org; Fri, 15 Sep 2023 11:09:02 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhARD-00029D-Ar for qemu-devel@nongnu.org; Fri, 15 Sep 2023 11:09:01 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31c3df710bdso2082234f8f.1 for ; Fri, 15 Sep 2023 08:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694790534; x=1695395334; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+ODBQ1lRWFRqN+1C2qyimy7vJFOa6KXmE7+4RiDeBuo=; b=zGOEaIPmSn8BaOw8q1kBbaL/FklbHxMxGOh5+lGt0leQfYgMtTHYgUxJl9X3dVLx7o vgx92S0BfRrPVGLoWi8jk/1uryIhbf9kM0JLxC/SyzE4s2nr0TFi06PJ7szX5OgiXwBx BcOP6gOTiWKQT7iUQofcMyX9So2S28ALg2LP81vfqvLGuNylKyqbgrR7UaH94OdNUlKR 9EQjJuvLTfdymOTD5aSLldZHyVikfFed+bGaBYVcSI6BxS46F2BaVFyFCmEnRSVyCdvA ozf0AZD/eZPSKvtQy49q7xIttjjzrPXfJ3QgvpuHrqJXX7Ex+hWp2kOUFU6jh7IiTF6n 9UBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694790534; x=1695395334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+ODBQ1lRWFRqN+1C2qyimy7vJFOa6KXmE7+4RiDeBuo=; b=kKWSLNyGfJCZihHVT0OdnwvcMF9kKqyH69T1J2lPhUtOHaXvG3wHhtaqAMa+GbQaWH 5DJMDv08HzXOwXn+qQ28kHMzlSZhX08hD9R9+HNoQpuN8nH01bnzE7MOwY9GMzssdmIY y3P85KtJtqGsl6GXnJcP0SAKDbTl2pocGM4pw7CllUvKYTCKAplfesA8jSrqYZ7fEy2f bEYoNwTsxkQCHyG5vnQqBS8H6EZUp4ERUUlZiWASnx+IrUWOXtsekdhOTY+yCtWqRBF/ n26YomhKf1wKPu4iBYJJ/maOq5Z6AwyuURfU/eC/9rW/5UXCxiijsSZvHGV43LRs8ATn 1mRQ== X-Gm-Message-State: AOJu0YybDMPg60Gw0Hw/Gz4nrU7thPdUVLQsUDnVCGl7ZFUjCcxqF70q /wZq4wOMxdW5R0/QFuyR0gNMAw== X-Received: by 2002:a05:6000:a1a:b0:31f:facb:e1ba with SMTP id co26-20020a0560000a1a00b0031ffacbe1bamr283441wrb.70.1694790533714; Fri, 15 Sep 2023 08:08:53 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id p7-20020a056000018700b003176aa612b1sm4653970wrx.38.2023.09.15.08.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 08:08:52 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 79AFC1FFC0; Fri, 15 Sep 2023 16:08:50 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Richard Henderson , Stefan Hajnoczi , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , Paolo Bonzini Subject: [PULL 5/9] qtest: kill orphaned qtest QEMU processes on FreeBSD Date: Fri, 15 Sep 2023 16:08:45 +0100 Message-Id: <20230915150849.595896-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230915150849.595896-1-alex.bennee@linaro.org> References: <20230915150849.595896-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Daniel P. Berrangé 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é" Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi Reviewed-by: Thomas Huth Message-Id: <20230912184130.3056054-3-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230914155422.426639-6-alex.bennee@linaro.org> 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 #endif /* __linux__ */ +#ifdef __FreeBSD__ +#include +#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); +#endif /* __FreeBSD__ */ if (!g_setenv("QEMU_AUDIO_DRV", "none", true)) { exit(1); }