From patchwork Mon Jul 27 18:04:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 37592 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 n6RI50qX004471 for ; Mon, 27 Jul 2009 18:05:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbZG0SE6 (ORCPT ); Mon, 27 Jul 2009 14:04:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751426AbZG0SE6 (ORCPT ); Mon, 27 Jul 2009 14:04:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60487 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbZG0SE4 (ORCPT ); Mon, 27 Jul 2009 14:04:56 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6RI4s4x031396; Mon, 27 Jul 2009 14:04:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6RI4riT017725; Mon, 27 Jul 2009 14:04:53 -0400 Received: from localhost (vpn-13-206.rdu.redhat.com [10.11.13.206]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6RI4pVJ028004; Mon, 27 Jul 2009 14:04:52 -0400 From: Amit Shah To: virtualization@lists.linux-foundation.org Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Amit Shah Subject: [PATCH 2/3] vnc: add a is_vnc_active() helper Date: Mon, 27 Jul 2009 23:34:35 +0530 Message-Id: <1248717876-17630-4-git-send-email-amit.shah@redhat.com> In-Reply-To: <1248717876-17630-3-git-send-email-amit.shah@redhat.com> References: <1248717876-17630-1-git-send-email-amit.shah@redhat.com> <1248717876-17630-2-git-send-email-amit.shah@redhat.com> <1248717876-17630-3-git-send-email-amit.shah@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 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 +++++++++- vnc.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vnc.c b/vnc.c index de0ff87..e4e78dc 100644 --- a/vnc.c +++ b/vnc.c @@ -176,9 +176,17 @@ static void do_info_vnc_client(Monitor *mon, VncState *client) #endif } -void do_info_vnc(Monitor *mon) +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", diff --git a/vnc.h b/vnc.h index 3ae95f3..9739c35 100644 --- a/vnc.h +++ b/vnc.h @@ -313,7 +313,7 @@ void buffer_append(Buffer *buffer, const void *data, size_t len); /* Misc helpers */ +int is_vnc_active(void); char *vnc_socket_local_addr(const char *format, int fd); char *vnc_socket_remote_addr(const char *format, int fd); - #endif /* __QEMU_VNC_H */