qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamoni


From: Ján Tomko
Subject: Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized
Date: Mon, 29 Feb 2016 09:57:11 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Feb 24, 2016 at 02:27:36PM +0100, Paolo Bonzini wrote:
> From: Dimitris Aragiorgis <address@hidden>
> 
> 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 <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  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 <sys/prctl.h>
> @@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]