From patchwork Sat Oct 27 13:11:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 194617 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 EA28B2C009B for ; Sun, 28 Oct 2012 00:11:54 +1100 (EST) Received: from localhost ([::1]:35262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS6B5-0005U1-T8 for incoming@patchwork.ozlabs.org; Sat, 27 Oct 2012 09:11:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS6Az-0005Tm-NY for qemu-devel@nongnu.org; Sat, 27 Oct 2012 09:11:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TS6Ay-0003ql-Oa for qemu-devel@nongnu.org; Sat, 27 Oct 2012 09:11:45 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:47927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS6Ay-0003qh-HE for qemu-devel@nongnu.org; Sat, 27 Oct 2012 09:11:44 -0400 Received: from [192.168.88.2] (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 611AEA1F32; Sat, 27 Oct 2012 17:11:42 +0400 (MSK) Message-ID: <508BDD8D.60402@msgid.tls.msk.ru> Date: Sat, 27 Oct 2012 17:11:41 +0400 From: Michael Tokarev Organization: Telecom Service, JSC User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.9) Gecko/20121015 Icedove/10.0.9 MIME-Version: 1.0 To: Blue Swirl References: <1348584532-21914-1-git-send-email-mjt@msgid.tls.msk.ru> <876271ol4w.fsf@codemonkey.ws> <5062AA0C.60303@msgid.tls.msk.ru> <5062BA23.705@msgid.tls.msk.ru> <87ehloj3rr.fsf@codemonkey.ws> <50631789.8040209@msgid.tls.msk.ru> <508BC420.8000202@msgid.tls.msk.ru> <508BD064.9080505@msgid.tls.msk.ru> <508BD9CA.2050508@msgid.tls.msk.ru> In-Reply-To: <508BD9CA.2050508@msgid.tls.msk.ru> X-Enigmail-Version: 1.4.1 OpenPGP: id=804465C5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 86.62.121.231 Cc: Peter Maydell , Hitoshi Mitake , qemu-devel@nongnu.org, Anthony Liguori , Stefan Hajnoczi Subject: Re: [Qemu-devel] [PATCH v2] stop using stdio for monitor/serial/etc with -daemonize 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 On 27.10.2012 16:55, Michael Tokarev wrote: > On 27.10.2012 16:48, Blue Swirl wrote: > [] >>> I'd rather have -nographic work with -daemonize, since the >>> alternative - shown in the patch comment - is rather long and >>> it is easy to forget to "nullify" some option, while -nographic >>> can do that easy and it is convinient, but if people dislikes >>> such natural and easy-for-the-user solutions, I wont insist. >> >> Instead of checking just for -nographic or -curses, can we forbid use >> of any stdio chardev? > > I think that'll be quite a bit more difficult. Sure, say, > > -serial stdio -daemonize > > now has the same problem as original > > -nographic -daemonize. > > It is just now after you mentioned it I realized this omission. > And it is exactly the same thing actually - we initialize > stdio for the serial port, in both cases, and it switches > the tty to raw mode. > > So this patch is insufficient indeed, we still have the > same issue, and once -nographic -daemonize is disallowed, > we've much better chances to hit this issue using -serial. > Oh well. > > Hmm. Maybe init stdio chardev for something "else" in case > of -nographic? This, together with my previous patch, appears to work fine: (there's no need to add this to windows version, since we don't daemonize on windows). Thanks, /mjt --- a/qemu-char.c +++ b/qemu-char.c @@ -772,6 +772,10 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return NULL; } + if (is_daemonized()) { + error_report("cannot use stdio with -daemonize"); + return NULL; + } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty);