From nobody Sun Feb 8 19:57:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1584980037; cv=none; d=zohomail.com; s=zohoarc; b=AoSQedIxMzzNOv3pxEeyk87EJikOnboyLVjQGozLvYlVgsYbDxYSDvy7jg51aIxuQD8llAXB+dQBKdWn4lIoCT8E3ioq0IGEXkzymI4fIRrpSTX24a+fb7MOEAEI5i6f9GDyWjHGxBEcPsOTrbejkzLGb2DLbFL7Pesy/B0iclY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584980037; 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=LU9u/OmoTV6PQU9RLHOYKOOoLu8kZp7l+sVtzFb8gLEP0PmPkyCWYqEQkWTdZcN2HgndkD3APZlROHy42MIQ8g6mPkPKhXnI7QD1m/myHjiEVykEGPKLWSzAEje4I8jt0TGnAJ36xwhjuADh4vJqXV3MljW2yGV15G2N7xtxElE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584980037065257.8873834603396; Mon, 23 Mar 2020 09:13:57 -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-354-Ji-FfHPGPsuvC9rMFlJcvQ-1; Mon, 23 Mar 2020 12:13:51 -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 8E6DF107ACCD; Mon, 23 Mar 2020 16:13:45 +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 64CA7BBBE6; Mon, 23 Mar 2020 16:13:45 +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 1009D8639F; Mon, 23 Mar 2020 16:13:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02NGDgYg005230 for ; Mon, 23 Mar 2020 12:13:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id A69AA94B30; Mon, 23 Mar 2020 16:13:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 250789497F for ; Mon, 23 Mar 2020 16:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584980033; 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=DDyMMoeYTO1I1FyC/89bMu5cPty3xD/TPu99hui7uNnlg1BJK5C2W6SAvYoXWw/XEYCnC3 8xaBwYQmHgvrmCTcuMdNcXNeB/19jmNIEbqxMVAh20v304oHIJu6vDvASzVn369mHAniN0 9YFVX4HzPOi9wB6869pEqFIeevimtHg= X-MC-Unique: Ji-FfHPGPsuvC9rMFlJcvQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH RESEND 3/5] qemuSlirpStop: Simplify helper kill Date: Mon, 23 Mar 2020 17:13:32 +0100 Message-Id: <4cebca147f2955ce4233eaf227fa40f434ec7b6e.1584979958.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 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 Reviewed-by: Marc-Andr=C3=A9 Lureau --- 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