From patchwork Sun Sep 23 10:00:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 186191 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 934FE2C0096 for ; Sun, 23 Sep 2012 20:01:10 +1000 (EST) Received: from localhost ([::1]:44816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizs-0004a6-OZ for incoming@patchwork.ozlabs.org; Sun, 23 Sep 2012 06:01:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizV-0004JS-3f for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFizT-0007eE-PK for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:44 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:56749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizT-0007Xh-H6 for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:43 -0400 Received: by mail-we0-f173.google.com with SMTP id t11so2574474wey.4 for ; Sun, 23 Sep 2012 03:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=X9+XJQQCl0YXCNfqzsGL23663NFMdk8Ee0CRDIwwktI=; b=sk8RDiHtKrOrVEc3OUlL7SDWMJTZ5YOHEGwPxMuIQ4jSWCoEGgVoKnJYuooBpV18OE 4D3l+uQpgK3KBIltiyJWUP4l1c3IXVA39CynT6GOec6zRlG2QO3jodCqDDh8FTNAu4Jt l69vb1+HGboLNFy6pLVQTpOEjyQbgkz+yTpwdgNkMoIsPv7cY3iHVqDES6N4GIkRrmMy IoEmewVUBGVNQb6EG5BRXx7HP4ODsktcMqkiFDyrafk7mVXd2Jg2KbYn2YPqIJDvLX1a eXtZwcJvqrTAQY2YN9HghdzqbyqFdfZRZrV3EiL9zLsfsPHlyUYnJWb17vI4jbU31Q8B jKjQ== Received: by 10.216.143.31 with SMTP id k31mr1249780wej.115.1348394443038; Sun, 23 Sep 2012 03:00:43 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id q7sm9500638wiy.11.2012.09.23.03.00.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 03:00:42 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Sun, 23 Sep 2012 11:00:15 +0100 Message-Id: <1348394420-28298-10-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348394420-28298-1-git-send-email-stefanha@gmail.com> References: <1348394420-28298-1-git-send-email-stefanha@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.173 Cc: Stefan Hajnoczi , Andrzej Zaborowski , Hitoshi Mitake , qemu-devel@nongnu.org, Michael Roth Subject: [Qemu-devel] [PATCH 09/14] curses: don't initialize curses when qemu is daemonized X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hitoshi Mitake Current qemu initializes curses even if -daemonize option is passed. This cause problem because shell prompt appears without calling endwin(). This patch adds new function, is_daemonized(), to OS dependent code. With this function, curses_display_init() can check that qemu is daemonized or not. If daemonized, curses_display_init() isn't called and the problem is avoided. Of course, -daemonize && -curses doesn't make sense. Users shouldn't pass the arguments at the same time. But the problem is very painful because Ctrl-C cannot be delivered to the terminal. Cc: Andrzej Zaborowski Cc: Stefan Hajnoczi Cc: Anthony Liguori Cc: Michael Roth Signed-off-by: Hitoshi Mitake Signed-off-by: Stefan Hajnoczi --- os-posix.c | 5 +++++ qemu-os-posix.h | 2 ++ qemu-os-win32.h | 5 +++++ vl.c | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/os-posix.c b/os-posix.c index 79fa228..eabccb8 100644 --- a/os-posix.c +++ b/os-posix.c @@ -360,3 +360,8 @@ int qemu_create_pidfile(const char *filename) /* keep pidfile open & locked forever */ return 0; } + +bool is_daemonized(void) +{ + return daemonize; +} diff --git a/qemu-os-posix.h b/qemu-os-posix.h index 8e1149d..7f198e4 100644 --- a/qemu-os-posix.h +++ b/qemu-os-posix.h @@ -46,4 +46,6 @@ typedef struct timeval qemu_timeval; typedef struct timespec qemu_timespec; int qemu_utimens(const char *path, const qemu_timespec *times); +bool is_daemonized(void); + #endif diff --git a/qemu-os-win32.h b/qemu-os-win32.h index 753679b..b3e451b 100644 --- a/qemu-os-win32.h +++ b/qemu-os-win32.h @@ -86,4 +86,9 @@ typedef struct { } qemu_timeval; int qemu_gettimeofday(qemu_timeval *tp); +static inline bool is_daemonized(void) +{ + return false; +} + #endif diff --git a/vl.c b/vl.c index 7c577fa..48049ef 100644 --- a/vl.c +++ b/vl.c @@ -3657,7 +3657,9 @@ int main(int argc, char **argv, char **envp) break; #if defined(CONFIG_CURSES) case DT_CURSES: - curses_display_init(ds, full_screen); + if (!is_daemonized()) { + curses_display_init(ds, full_screen); + } break; #endif #if defined(CONFIG_SDL)