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

Daniel Veillard veillard at redhat.com
Fri Mar 4 12:27:52 UTC 2011


On Fri, Mar 04, 2011 at 11:33:16AM +0000, Daniel P. Berrange wrote:
> 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 at 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;
>             }

  Oops, right :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list