From nobody Sat Feb 7 05:48:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1584116973; cv=none; d=zohomail.com; s=zohoarc; b=FvyTZHLMIxZI9QA/9NEyy1QTzG0xxbmhn1M9wckCGqPCwCJyGtjApvZrnkSePBLPFHk/JkkNiY8kQQ1LNMmrZG0A1eAo4wflf6CjnWLjEtIErJ1YkDgT/ipysdDjdJEIEtvBAw0wgwSegGP6xBkpg/S+BCm6TtLIC4YQ7bAlfxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584116973; 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=UWhYFPNDWref0T2FeB8iR4x/GlcZGn4HDPWw5+ueG1w=; b=Ce65DGGTXqFS4Suha6gLHX40S2I9Wi7KPtx+dhyY7iF+hqOfMqUWrmFb7tZ6/ykeuucQ6QTOQCm6WZsUksSQKx06jhOxOXuSAvwBQuER5z7SiXuFyiHylfpw7+YbDU6OdGV6P+7BxBUtT2mB857NPvuWB23jr5/b0dLe7KSaRMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158411697362473.75346536620486; Fri, 13 Mar 2020 09:29:33 -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-446-mG4qUjUxMDaLvPdfTbZUHA-1; Fri, 13 Mar 2020 12:29:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C893C8017CC; Fri, 13 Mar 2020 16:29:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 925B360F82; Fri, 13 Mar 2020 16:29:24 +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 32A4F18089CE; Fri, 13 Mar 2020 16:29:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02DGT0PY010879 for ; Fri, 13 Mar 2020 12:29:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id E15DC1001902; Fri, 13 Mar 2020 16:29:00 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65DF2100164D for ; Fri, 13 Mar 2020 16:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584116972; 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=UWhYFPNDWref0T2FeB8iR4x/GlcZGn4HDPWw5+ueG1w=; b=QBqWbkyYJ85vR31s5IMGITr1T3hewG0Rp973jr/6+WRKjU4ZO5kzjkr3BKZUN4vgH8jsfm aJaFTIZPCfuN6PAIUWAh3bS+mbDPPtNcxeLBiPXCqW8nUkSMjZK2mwDttgPhstdIBuXq3e HXXFmyDZzeaxeRz3nOsJRqR5knZ/W0Y= X-MC-Unique: mG4qUjUxMDaLvPdfTbZUHA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/5] qemuSlirpStop: Simplify helper kill Date: Fri, 13 Mar 2020 17:28:51 +0100 Message-Id: <24bae1cc72521b2df1052ee8cfba461a62c62a62.1584116228.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now, that we know that the slirp helper will have the pidfile open and locked we can use virPidFileForceCleanupPath() to kill it and unlink the pidfile. Signed-off-by: Michal Privoznik --- src/qemu/qemu_slirp.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index 5266b36eaa..be586ade12 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -246,8 +246,6 @@ qemuSlirpStop(qemuSlirpPtr slirp, g_autofree char *dbus_path =3D NULL; g_autofree char *id =3D qemuSlirpGetDBusVMStateId(net); virErrorPtr orig_err; - pid_t pid; - int rc; =20 if (!(pidfile =3D qemuSlirpCreatePidFilename(cfg, vm->def, net->info.a= lias))) { VIR_WARN("Unable to construct slirp pidfile path"); @@ -261,17 +259,11 @@ qemuSlirpStop(qemuSlirpPtr slirp, } =20 virErrorPreserveLast(&orig_err); - rc =3D virPidFileReadPathIfAlive(pidfile, &pid, cfg->slirpHelperName); - if (rc >=3D 0 && pid !=3D (pid_t) -1) - virProcessKillPainfully(pid, true); - - if (unlink(pidfile) < 0 && - errno !=3D ENOENT) { - virReportSystemError(errno, - _("Unable to remove stale pidfile %s"), - pidfile); + if (virPidFileForceCleanupPath(pidfile) < 0) { + VIR_WARN("Unable to kill slirp process"); + } else { + slirp->pid =3D 0; } - slirp->pid =3D 0; =20 dbus_path =3D qemuSlirpGetDBusPath(cfg, vm->def, net->info.alias); if (dbus_path) { --=20 2.24.1