From nobody Sat Feb 7 08:23:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 158021725255338.004750387872605; Tue, 28 Jan 2020 05:14:12 -0800 (PST) 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-426-42fHKtdIM6yoUvIUer8bMQ-1; Tue, 28 Jan 2020 08:14:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03C211005510; Tue, 28 Jan 2020 13:14:01 +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 CEF415E24A; Tue, 28 Jan 2020 13:14:00 +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 83B2C85E4C; Tue, 28 Jan 2020 13:14:00 +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 00SDDr5Y019545 for ; Tue, 28 Jan 2020 08:13:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 47B601001B08; Tue, 28 Jan 2020 13:13:53 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACDC41001DE1; Tue, 28 Jan 2020 13:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580217251; 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=gpPUJxbQIpmialf/wpBSKaG4HB2phN05x3CEqp1ozys=; b=eU9oW5aLvw8sZunsxFEt8hajOzCL3c8CZhT7o9n70698f1vW/sxNiMWBGK12YJvBmkKcTn Hi9d9XaPq0w4KRPDxSHteZcu+w/fW2xGBHEaJ++ouhQrP3MyU9Et7rPaw4ingCLBZF5+iN QMnz/yAyfs/dl8/SobmCMvXV4LnSKmo= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 38/56] tools: convert to use g_poll instead of poll Date: Tue, 28 Jan 2020 13:11:19 +0000 Message-Id: <20200128131137.1762449-39-berrange@redhat.com> In-Reply-To: <20200128131137.1762449-1-berrange@redhat.com> References: <20200128131137.1762449-1-berrange@redhat.com> 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.14 X-MC-Unique: 42fHKtdIM6yoUvIUer8bMQ-1 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" g_poll is portable to Windows platforms. Signed-off-by: Daniel P. Berrang=C3=A9 --- tools/virsh-domain.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1a48695b4e..04ba44d4f2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -23,7 +23,6 @@ #include "virsh-util.h" =20 #include -#include #include #include =20 @@ -4299,15 +4298,15 @@ virshWatchJob(vshControl *ctl, struct sigaction old_sig_action; sigset_t sigmask, oldsigmask; #endif /* !WIN32 */ - struct pollfd pollfd[2] =3D {{.fd =3D pipe_fd, .events =3D POLLIN, .re= vents =3D 0}, - {.fd =3D STDIN_FILENO, .events =3D POLLIN, = .revents =3D 0}}; + GPollFD pollfd[2] =3D {{.fd =3D pipe_fd, .events =3D G_IO_IN, .revents= =3D 0}, + {.fd =3D STDIN_FILENO, .events =3D G_IO_IN, .reve= nts =3D 0}}; unsigned long long start_us, curr_us; virDomainJobInfo jobinfo; int ret =3D -1; char retchar; bool functionReturn =3D false; bool jobStarted =3D false; - nfds_t npollfd =3D 2; + int npollfd =3D 2; =20 #ifndef WIN32 sigemptyset(&sigmask); @@ -4326,16 +4325,16 @@ virshWatchJob(vshControl *ctl, =20 start_us =3D g_get_real_time(); while (1) { - ret =3D poll((struct pollfd *)&pollfd, npollfd, 500); + ret =3D g_poll(pollfd, npollfd, 500); if (ret > 0) { - if (pollfd[1].revents & POLLIN && + if (pollfd[1].revents & G_IO_IN && saferead(STDIN_FILENO, &retchar, sizeof(retchar)) > 0) { if (vshTTYIsInterruptCharacter(ctl, retchar)) virDomainAbortJob(dom); continue; } =20 - if (pollfd[0].revents & POLLIN && + if (pollfd[0].revents & G_IO_IN && saferead(pipe_fd, &retchar, sizeof(retchar)) > 0 && retchar =3D=3D '0') { if (verbose) { --=20 2.24.1