From nobody Sun Feb 8 11:16:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628009256; cv=none; d=zohomail.com; s=zohoarc; b=M7okwC55+SmnFuF4p4fB5Yzg2EnStdlFXcxseAS5FoEROqAVsJbQpvdWqSJcdqI/uFTt0g1jXyJmVSapUo/ehY4TI4tURXzCmOymWrBwO2UBJDWItT4pAKL5g9lajazdyqfncfddO8sVduC4ChYwxIF3evliF4d/4W3BA9y4CYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628009256; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0duwPeip9/+J4BSgFfsITgNsIKU6DAmT4Rwip31H1ww=; b=ED3uu4LD4sBigGLqBhcHluR/O0o73Zz/bz5RgRKYcSkh9hJ+VqwY0Vp6UIfcInTLVA/iHhWU+f6MJfS8OrwAuHizDnTT20uwKg28JwKXxZy/srfz6xO3hkqER+BA/kejYY8mKv4vWrGYvOOAWHNOUbU4jPqDth16ynZdaLj58ZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628009256947120.83145922469839; Tue, 3 Aug 2021 09:47:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-FtkXEb6IOVGGH9khRqVvEw-1; Tue, 03 Aug 2021 12:47:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D10B087D544; Tue, 3 Aug 2021 16:47:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B621B60C25; Tue, 3 Aug 2021 16:47:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8512550039; Tue, 3 Aug 2021 16:47:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 173FDrBn011125 for ; Tue, 3 Aug 2021 11:13:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id D18DE4536; Tue, 3 Aug 2021 15:13:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C86419C44 for ; Tue, 3 Aug 2021 15:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628009256; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0duwPeip9/+J4BSgFfsITgNsIKU6DAmT4Rwip31H1ww=; b=bnjvpqUmtk4jCy7W3MvfLLbpWyitpmghwMIwe028uJ2fACqbAXZtTXB/Lwh/4jQ5YAtTAX KR1hrRvwhQcNxWdWx2S4RDgvcXn9HOrPj0WyStzpAtW/ZOAvOhNk1nB8AoAcA2yvvHxcU7 +4fumkd2b4UczVNR0DPOLZ3GuZxh81c= X-MC-Unique: FtkXEb6IOVGGH9khRqVvEw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] util: Introduce virProcessGroupKill Date: Tue, 3 Aug 2021 17:13:41 +0200 Message-Id: <341314b81d67f91eaa78ca933507feff7459ddf8.1628003420.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628009258523100012 Signed-off-by: J=C3=A1n Tomko --- src/util/virprocess.c | 17 +++++++++++++++++ src/util/virprocess.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index d58e983b56..c01c8e267b 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -361,6 +361,23 @@ int virProcessKill(pid_t pid, int sig) } =20 =20 +/* send signal to a process group */ +int virProcessGroupKill(pid_t pid, int sig) +{ + if (pid <=3D 1) { + errno =3D ESRCH; + return -1; + } + +#ifdef WIN32 + errno =3D ENOSYS; + return -1; +#else + return killpg(pid, sig); +#endif +} + + /* * Try to kill the process and verify it has exited * diff --git a/src/util/virprocess.h b/src/util/virprocess.h index d16e8b23bb..0359d7fd9f 100644 --- a/src/util/virprocess.h +++ b/src/util/virprocess.h @@ -52,6 +52,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw) G_GNUC_WARN_UNUSED_RESULT; =20 int virProcessKill(pid_t pid, int sig); +int virProcessGroupKill(pid_t pid, int sig); =20 int virProcessKillPainfully(pid_t pid, bool force); int virProcessKillPainfullyDelay(pid_t pid, --=20 2.31.1