From patchwork Wed Sep 9 08:12:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 33166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id EC7FDB708C for ; Wed, 9 Sep 2009 18:22:34 +1000 (EST) Received: from localhost ([127.0.0.1]:49136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlIRj-0004vk-NZ for incoming@patchwork.ozlabs.org; Wed, 09 Sep 2009 04:22:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlIIX-0002Uw-2L for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:13:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlIIR-0002T8-NA for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:59 -0400 Received: from [199.232.76.173] (port=55978 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlIIR-0002T2-GZ for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36333) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlIIQ-0003hJ-RJ for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:55 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n898Cqrw003392; Wed, 9 Sep 2009 04:12:52 -0400 Received: from localhost (vpn-11-236.rdu.redhat.com [10.11.11.236]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n898CoUx009351; Wed, 9 Sep 2009 04:12:51 -0400 From: Amit Shah To: qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Date: Wed, 9 Sep 2009 13:42:04 +0530 Message-Id: <1252483925-26336-6-git-send-email-amit.shah@redhat.com> In-Reply-To: <1252483925-26336-5-git-send-email-amit.shah@redhat.com> References: <1252483925-26336-1-git-send-email-amit.shah@redhat.com> <1252483925-26336-2-git-send-email-amit.shah@redhat.com> <1252483925-26336-3-git-send-email-amit.shah@redhat.com> <1252483925-26336-4-git-send-email-amit.shah@redhat.com> <1252483925-26336-5-git-send-email-amit.shah@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Amit Shah Subject: [Qemu-devel] [PATCH 4/5] vnc: add a is_vnc_active() helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This helper is introduced to query the status of vnc. Signed-off-by: Amit Shah --- vnc.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/vnc.c b/vnc.c index 5eaef6a..ff2d4a8 100644 --- a/vnc.c +++ b/vnc.c @@ -178,9 +178,17 @@ static void do_info_vnc_client(Monitor *mon, VncState *client) #endif } -void do_info_vnc(Monitor *mon) +static int is_vnc_active(void) { if (vnc_display == NULL || vnc_display->display == NULL) { + return 0; + } + return 1; +} + +void do_info_vnc(Monitor *mon) +{ + if (!is_vnc_active()) { monitor_printf(mon, "Server: disabled\n"); } else { char *serverAddr = vnc_socket_local_addr(" address: %s:%s\n",