From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaJdq-0001vt-OR for qemu-devel@nongnu.org; Mon, 29 Feb 2016 03:57:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaJdl-0000tT-MJ for qemu-devel@nongnu.org; Mon, 29 Feb 2016 03:57:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaJdl-0000tF-H7 for qemu-devel@nongnu.org; Mon, 29 Feb 2016 03:57:17 -0500 Date: Mon, 29 Feb 2016 09:57:11 +0100 From: =?iso-8859-1?B?SuFu?= Tomko Message-ID: <20160229085711.GA26830@dnr.brq.redhat.com> References: <1456320461-26756-1-git-send-email-pbonzini@redhat.com> <1456320461-26756-15-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456320461-26756-15-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Dimitris Aragiorgis On Wed, Feb 24, 2016 at 02:27:36PM +0100, Paolo Bonzini wrote: > From: Dimitris Aragiorgis > > In case of daemonize, use the logfile passed with the -D option in > order to redirect stderr to it instead of /dev/null. > > Also remove some unused code in log.h. > > Signed-off-by: Dimitris Aragiorgis > Message-Id: <1455795518-19205-1-git-send-email-dimara@arrikto.com> > Signed-off-by: Paolo Bonzini > --- > include/qemu/log.h | 6 ------ > os-posix.c | 6 +++++- > util/log.c | 11 +++++++++-- > 3 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/include/qemu/log.h b/include/qemu/log.h > index 30817f7..dda65fd 100644 > --- a/include/qemu/log.h > +++ b/include/qemu/log.h > @@ -94,12 +94,6 @@ static inline void qemu_log_close(void) > } > } > > -/* Set up a new log file */ > -static inline void qemu_log_set_file(FILE *f) > -{ > - qemu_logfile = f; > -} > - > /* define log items */ > typedef struct QEMULogItem { > int mask; > diff --git a/os-posix.c b/os-posix.c > index cce62ed..92fa3ba 100644 > --- a/os-posix.c > +++ b/os-posix.c > @@ -37,6 +37,7 @@ > #include "qemu-options.h" > #include "qemu/rcu.h" > #include "qemu/error-report.h" > +#include "qemu/log.h" > > #ifdef CONFIG_LINUX > #include > @@ -275,7 +276,10 @@ void os_setup_post(void) > > dup2(fd, 0); > dup2(fd, 1); > - dup2(fd, 2); > + /* In case -D is given do not redirect stderr to /dev/null */ > + if (!qemu_logfile) { > + dup2(fd, 2); > + } > This hunk broke qemu usage in libvirt. When libvirtd runs qemu for capability probing, it just hangs. There is no -D on the command line: qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize Jan