From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MVUZM-0007I0-PH for qemu-devel@nongnu.org; Mon, 27 Jul 2009 14:05:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MVUZG-0007Em-BB for qemu-devel@nongnu.org; Mon, 27 Jul 2009 14:05:03 -0400 Received: from [199.232.76.173] (port=51914 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MVUZF-0007ET-Ii for qemu-devel@nongnu.org; Mon, 27 Jul 2009 14:04:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:44275) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MVUZE-0004eC-KW for qemu-devel@nongnu.org; Mon, 27 Jul 2009 14:04:57 -0400 From: Amit Shah 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> Subject: [Qemu-devel] [PATCH 2/3] vnc: add a is_vnc_active() helper List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: virtualization@lists.linux-foundation.org Cc: Amit Shah , qemu-devel@nongnu.org, 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 */ -- 1.6.2.5