Received: from eggs.gnu.org ([208.118.235.92]:36932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGThk-0000oi-FQ for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:53:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGThd-0001xV-PO for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:53:32 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:35544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGThd-0001xK-Hs for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:53:25 -0400 Message-ID: <50619B33.7030903@msgid.tls.msk.ru> Date: Tue, 25 Sep 2012 15:53:23 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <1348569817-11178-1-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] stop using stdio for monitor/serial/etc with -daemonize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Stefan Hajnoczi , qemu-devel@nongnu.org On 25.09.2012 15:23, Peter Maydell wrote: > On 25 September 2012 11:43, Michael Tokarev wrote: >> --- a/vl.c >> +++ b/vl.c >> @@ -3395,17 +3395,26 @@ int main(int argc, char **argv, char **envp) >> if (display_type == DT_NOGRAPHIC) { >> if (default_parallel) >> add_device_config(DEV_PARALLEL, "null"); >> - if (default_serial && default_monitor) { >> - add_device_config(DEV_SERIAL, "mon:stdio"); >> - } else if (default_virtcon && default_monitor) { >> - add_device_config(DEV_VIRTCON, "mon:stdio"); >> + if (!is_daemonized()) { >> + if (default_serial && default_monitor) { >> + add_device_config(DEV_SERIAL, "mon:stdio"); >> + } else if (default_virtcon && default_monitor) { >> + add_device_config(DEV_VIRTCON, "mon:stdio"); >> + } else { >> + if (default_serial) >> + add_device_config(DEV_SERIAL, "stdio"); >> + if (default_virtcon) >> + add_device_config(DEV_VIRTCON, "stdio"); >> + if (default_monitor) >> + monitor_parse("stdio", "readline"); >> + } > > Braces :-) That's the original code. N/p, can add braces. It will make the code unnecessary bigger but who cares. >> - monitor_parse("stdio", "readline"); >> + monitor_parse("stdio", "null"); > > monitor_parse()'s second argument is the mode, which I think can > only be "readline" or "control" -- should this be "null", "readline" > instead? Actually it is a typo -- I corrected it in my working tree but forgot to commit before git-format-patch. > Would it be possible to condense this chain of ifs down a bit > by having a variable which gets appropriately set to > "stdio", "null" or "vc:80Cx24C" and then used in a single > set of add_device_config() calls? I think it can be, yes. Will try again :) /mjt