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: 46332 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n898D0p5017260 for ; Wed, 9 Sep 2009 08:13:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752747AbZIIIMy (ORCPT ); Wed, 9 Sep 2009 04:12:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752662AbZIIIMy (ORCPT ); Wed, 9 Sep 2009 04:12:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46569 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684AbZIIIMw (ORCPT ); Wed, 9 Sep 2009 04:12:52 -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 Cc: Amit Shah Subject: [PATCH 4/5] vnc: add a is_vnc_active() helper 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 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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",