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

Re: [libvirt] [PATCH 5/6] Add an an internal API for emergency dump of debug buffer



On Fri, Mar 04, 2011 at 06:30:56PM +0800, Daniel Veillard wrote:
> 
> virLogEmergencyDumpAll() allows to dump the content of the
> debug buffer from within a signal handler. It saves to all
> log file or stderr if none is found
> * src/util/logging.h src/util/logging.c: add the new API
>   and cleanup the old virLogDump code
> * src/libvirt_private.syms: exports it as a private symbol
> 
> Signed-off-by: Daniel Veillard <veillard redhat com>
> ---
>  src/libvirt_private.syms |    1 +
>  src/util/logging.c       |   87 +++++++++++++++++++++++++++------------------
>  src/util/logging.h       |    2 +-
>  3 files changed, 54 insertions(+), 36 deletions(-)

ACK with one small fix....

> +static void virLogDumpAllFD(const char *msg, int len) {
> +    int i, found = 0;
> +
> +    for (i = 0; i < virLogNbOutputs;i++) {
> +        if (virLogOutputs[i].f == virLogOutputToFd) {
> +            int fd = (long) virLogOutputs[i].data;
> +
> +            if (fd >= 0)
> +                ignore_value (safewrite(fd, msg, len));

Need to be:

            if (fd >= 0) {
                ignore_value (safewrite(fd, msg, len));
                found = 1;
            }

> +        }
> +    }
> +    if (!found)
> +        ignore_value (safewrite(STDERR_FILENO, msg, len));
> +}

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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