From nobody Fri May 3 23:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15541993420731001.4501336230276; Tue, 2 Apr 2019 03:02:22 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7F7F93082E5F; Tue, 2 Apr 2019 10:02:20 +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 DAA2E60BE6; Tue, 2 Apr 2019 10:02:19 +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 E6D581803389; Tue, 2 Apr 2019 10:02:18 +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 x32A2IZ3009882 for ; Tue, 2 Apr 2019 06:02:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B7F46FB9D; Tue, 2 Apr 2019 10:02:18 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA24157A9; Tue, 2 Apr 2019 10:02:16 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 11:02:07 +0100 Message-Id: <20190402100211.2252-2-berrange@redhat.com> In-Reply-To: <20190402100211.2252-1-berrange@redhat.com> References: <20190402100211.2252-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] examples: fix 64-bit integer formatting on Windows 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 02 Apr 2019 10:02:21 +0000 (UTC) The Windows printf functions don't support %llu/%lld for printing 64-bit integers. For most of libvirt this doesn't matter as we rely on gnulib which provides a replacement printf that is sane. The example code is designed to compile against the normal OS headers, with no use of gnulib and thus has to use the platform specific printf. To deal with this we must use the macros PRI* macros from inttypes.h to get the platform specific format string. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- examples/admin/client_info.c | 7 ++++--- examples/admin/list_clients.c | 3 ++- examples/domtop/domtop.c | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c index f3f62a656b..7fc6c72bbd 100644 --- a/examples/admin/client_info.c +++ b/examples/admin/client_info.c @@ -3,6 +3,7 @@ #include #include #include +#include #include =20 static const char * @@ -66,11 +67,11 @@ exampleGetTypedParamValue(virTypedParameterPtr item) break; =20 case VIR_TYPED_PARAM_LLONG: - ret =3D asprintf(&str, "%lld", item->value.l); + ret =3D asprintf(&str, "%" PRId64, (int64_t)item->value.l); break; =20 case VIR_TYPED_PARAM_ULLONG: - ret =3D asprintf(&str, "%llu", item->value.ul); + ret =3D asprintf(&str, "%" PRIu64, (uint64_t)item->value.ul); break; =20 case VIR_TYPED_PARAM_DOUBLE: @@ -143,7 +144,7 @@ int main(int argc, char **argv) if (!(timestr =3D exampleGetTimeStr(virAdmClientGetTimestamp(clnt)))) goto cleanup; =20 - printf("%-15s: %llu\n", "id", virAdmClientGetID(clnt)); + printf("%-15s: %" PRIu64 "\n", "id", (uint64_t)virAdmClientGetID(clnt)= ); printf("%-15s: %s\n", "connection_time", timestr); printf("%-15s: %s\n", "transport", exampleTransportToString(virAdmClientGetTransport(clnt))); diff --git a/examples/admin/list_clients.c b/examples/admin/list_clients.c index 5cf8e4c2a6..2876637d42 100644 --- a/examples/admin/list_clients.c +++ b/examples/admin/list_clients.c @@ -1,6 +1,7 @@ #include #include #include +#include #include =20 static const char * @@ -96,7 +97,7 @@ int main(int argc, char **argv) exampleGetTimeStr(virAdmClientGetTimestamp(client)))) goto cleanup; =20 - printf(" %-5llu %-15s %-15s\n", id, + printf(" %-5" PRIu64 " %-15s %-15s\n", (uint64_t)id, exampleTransportToString(transport), timestr); free(timestr); } diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c index 008065c651..e1e7fbff8b 100644 --- a/examples/domtop/domtop.c +++ b/examples/domtop/domtop.c @@ -29,6 +29,7 @@ #include #include #include +#include =20 static bool debug; static bool run_top; @@ -226,8 +227,11 @@ print_cpu_usage(const char *dom_name, return; } =20 - DEBUG("now_params=3D%llu then_params=3D%llu now=3D%llu then=3D%llu= ", - now_params[pos].value.ul, then_params[pos].value.ul, now, th= en); + DEBUG("now_params=3D%" PRIu64 " then_params=3D%" PRIu64 + " now=3D%" PRIu64 " then=3D%" PRIu64, + (uint64_t)now_params[pos].value.ul, + (uint64_t)then_params[pos].value.ul, + (uint64_t)now, (uint64_t)then); =20 /* @now_params and @then_params are in nanoseconds, @now and @then= are * in microseconds. In ideal world, we would translate them both i= nto --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 23:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554199358285605.1673495539482; Tue, 2 Apr 2019 03:02:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 815CF307EAA0; Tue, 2 Apr 2019 10:02:36 +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 56C2B1758C; Tue, 2 Apr 2019 10:02:36 +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 100FF180338C; Tue, 2 Apr 2019 10:02:36 +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 x32A2JbH009892 for ; Tue, 2 Apr 2019 06:02:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id A793757A9; Tue, 2 Apr 2019 10:02:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 660A46FBBA; Tue, 2 Apr 2019 10:02:18 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 11:02:08 +0100 Message-Id: <20190402100211.2252-3-berrange@redhat.com> In-Reply-To: <20190402100211.2252-1-berrange@redhat.com> References: <20190402100211.2252-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] examples: avoid goto jump over initialization of variable 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 02 Apr 2019 10:02:37 +0000 (UTC) Jumping over the declaration and initialization of a variable is bad as it means the jump target sees a potentially non-initialized variable. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- examples/admin/client_limits.c | 2 +- examples/admin/threadpool_params.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c index 69b931682c..fb29ee6cbf 100644 --- a/examples/admin/client_limits.c +++ b/examples/admin/client_limits.c @@ -9,6 +9,7 @@ int main(int argc, char **argv) virAdmServerPtr srv =3D NULL; /* which server to work with */ virTypedParameterPtr params =3D NULL; int nparams =3D 0; + int maxparams =3D 0; ssize_t i; =20 if (argc !=3D 2) { @@ -39,7 +40,6 @@ int main(int argc, char **argv) nparams =3D 0; =20 /* set nclients_max to 100 and nclients_unauth_max to 20 */ - int maxparams =3D 0; if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_SERVER_CLIENTS_MAX, 100) < 0 || virTypedParamsAddUInt(¶ms, &nparams, &maxparams, diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool= _params.c index be833c2ea3..8e6354576f 100644 --- a/examples/admin/threadpool_params.c +++ b/examples/admin/threadpool_params.c @@ -9,6 +9,7 @@ int main(int argc, char **argv) virAdmServerPtr srv =3D NULL; /* which server to work with */ virTypedParameterPtr params =3D NULL; int nparams =3D 0; + int maxparams =3D 0; ssize_t i; =20 if (argc !=3D 2) { @@ -39,7 +40,6 @@ int main(int argc, char **argv) nparams =3D 0; =20 /* let's set minWorkers to 10, maxWorkers to 15 and prioWorkers to 10 = */ - int maxparams =3D 0; if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_THREADPOOL_WORKERS_MIN, 10) < 0 || virTypedParamsAddUInt(¶ms, &nparams, &maxparams, --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 23:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554199344165587.2910286423281; Tue, 2 Apr 2019 03:02:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A1D8B30609B0; Tue, 2 Apr 2019 10:02:22 +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 7697C64033; Tue, 2 Apr 2019 10:02:22 +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 309794EA78; Tue, 2 Apr 2019 10:02:22 +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 x32A2L3q009901 for ; Tue, 2 Apr 2019 06:02:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34EEF6FB9D; Tue, 2 Apr 2019 10:02:21 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D84C57A9; Tue, 2 Apr 2019 10:02:19 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 11:02:09 +0100 Message-Id: <20190402100211.2252-4-berrange@redhat.com> In-Reply-To: <20190402100211.2252-1-berrange@redhat.com> References: <20190402100211.2252-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] domtop: remove unused domain name parameter 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 02 Apr 2019 10:02:23 +0000 (UTC) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- examples/domtop/domtop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c index e1e7fbff8b..c9b51aed51 100644 --- a/examples/domtop/domtop.c +++ b/examples/domtop/domtop.c @@ -186,8 +186,7 @@ fetch_domains(virConnectPtr conn) } =20 static void -print_cpu_usage(const char *dom_name, - size_t cpu, +print_cpu_usage(size_t cpu, size_t ncpus, unsigned long long then, virTypedParameterPtr then_params, @@ -333,7 +332,7 @@ do_top(virConnectPtr conn, goto cleanup; } =20 - print_cpu_usage(dom_name, 0, max_id, + print_cpu_usage(0, max_id, then.tv_sec * 1000000 + then.tv_usec, then_params, then_nparams, now.tv_sec * 1000000 + now.tv_usec, --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 23:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554199362042346.4799319691343; Tue, 2 Apr 2019 03:02:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69AA030198AB; Tue, 2 Apr 2019 10:02:40 +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 21C567F2C8; Tue, 2 Apr 2019 10:02:40 +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 CA6474ED3A; Tue, 2 Apr 2019 10:02:39 +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 x32A2MIi009913 for ; Tue, 2 Apr 2019 06:02:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED75C7F2C8; Tue, 2 Apr 2019 10:02:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id A69A657A9; Tue, 2 Apr 2019 10:02:21 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 11:02:10 +0100 Message-Id: <20190402100211.2252-5-berrange@redhat.com> In-Reply-To: <20190402100211.2252-1-berrange@redhat.com> References: <20190402100211.2252-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] dominfo: make example more useful 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 02 Apr 2019 10:02:41 +0000 (UTC) The example currently assumes that a NULL URI will open Xen and thus also assumes that a domain with ID 0 exists. Change it to require the URI and a domain name as command line arguments. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- examples/dominfo/info1.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/dominfo/info1.c b/examples/dominfo/info1.c index 09f20358f1..f0ea9b9f08 100644 --- a/examples/dominfo/info1.c +++ b/examples/dominfo/info1.c @@ -13,40 +13,39 @@ =20 /** * getDomainInfo: - * @id: the id of the domain + * @name: the name of the domain * * extract the domain 0 information */ static void -getDomainInfo(int id) +getDomainInfo(const char *uri, const char *name) { virConnectPtr conn =3D NULL; /* the hypervisor connection */ virDomainPtr dom =3D NULL; /* the domain being checked */ virDomainInfo info; /* the information being fetched */ int ret; =20 - /* NULL means connect to local Xen hypervisor */ - conn =3D virConnectOpenReadOnly(NULL); + conn =3D virConnectOpenReadOnly(uri); if (conn =3D=3D NULL) { fprintf(stderr, "Failed to connect to hypervisor\n"); goto error; } =20 - /* Find the domain of the given id */ - dom =3D virDomainLookupByID(conn, id); + /* Find the domain of the given name */ + dom =3D virDomainLookupByName(conn, name); if (dom =3D=3D NULL) { - fprintf(stderr, "Failed to find Domain %d\n", id); + fprintf(stderr, "Failed to find Domain %s\n", name); goto error; } =20 /* Get the information */ ret =3D virDomainGetInfo(dom, &info); if (ret < 0) { - fprintf(stderr, "Failed to get information for Domain %d\n", id); + fprintf(stderr, "Failed to get information for Domain %s\n", name); goto error; } =20 - printf("Domains %d: %d CPUs\n", id, info.nrVirtCpu); + printf("Domain %s: %d CPUs\n", name, info.nrVirtCpu); =20 error: if (dom !=3D NULL) @@ -55,9 +54,13 @@ getDomainInfo(int id) virConnectClose(conn); } =20 -int main() +int main(int argc, char **argv) { - getDomainInfo(0); + if (argc !=3D 3) { + fprintf(stderr, "syntax: %s: URI NAME\n", argv[0]); + return 1; + } + getDomainInfo(argv[1], argv[2]); =20 return 0; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 23:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554199357901569.0960522758896; Tue, 2 Apr 2019 03:02:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83AEB3001564; Tue, 2 Apr 2019 10:02:36 +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 550A1848C7; Tue, 2 Apr 2019 10:02:36 +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 0E9E04ED24; Tue, 2 Apr 2019 10:02:36 +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 x32A2Oej009918 for ; Tue, 2 Apr 2019 06:02:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30FA06FBBA; Tue, 2 Apr 2019 10:02:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 540C67F2CC; Tue, 2 Apr 2019 10:02:23 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 11:02:11 +0100 Message-Id: <20190402100211.2252-6-berrange@redhat.com> In-Reply-To: <20190402100211.2252-1-berrange@redhat.com> References: <20190402100211.2252-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] examples: enable all compiler warnings 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 02 Apr 2019 10:02:37 +0000 (UTC) Now that all the examples are warning free, keep it that way by enabling all the normal compiler warning flags. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- examples/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index b590a148ce..ee7d3e6b2c 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -28,7 +28,8 @@ EXTRA_DIST =3D \ =20 =20 AM_CPPFLAGS =3D \ - -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) + -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \ + $(WARN_CFLAGS) LDADD =3D $(STATIC_BINARIES) $(WARN_CFLAGS) \ $(top_builddir)/src/libvirt.la \ $(top_builddir)/src/libvirt-admin.la --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list