Re: [PATCH 3/3] Remove time APIs from src/util/util.h

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

 



On Tue, Nov 29, 2011 at 02:10:20PM +0100, Jiri Denemark wrote:
> On Tue, Nov 29, 2011 at 12:38:24 +0000, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> > 
> > The virTimestamp and virTimeMs functions in src/util/util.h
> > duplicate functionality from virtime.h, in a non-async signal
> > safe manner. Remove them, and convert all code over to the new
> > APIs.
> > 
> > * src/util/util.c, src/util/util.h: Delete virTimeMs and virTimestamp
> > * src/lxc/lxc_driver.c, src/qemu/qemu_domain.c,
> >   src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
> >   src/qemu/qemu_process.c, src/util/event_poll.c: Convert to use
> >   virtime APIs
> > ---
> >  src/libvirt_private.syms  |    2 -
> >  src/lxc/lxc_driver.c      |    3 +-
> >  src/qemu/qemu_domain.c    |    5 ++-
> >  src/qemu/qemu_driver.c    |    7 +++--
> >  src/qemu/qemu_migration.c |    5 ++-
> >  src/qemu/qemu_process.c   |    9 ++++---
> >  src/util/event_poll.c     |    9 ++++---
> >  src/util/util.c           |   53 ---------------------------------------------
> >  src/util/util.h           |    4 ---
> >  9 files changed, 22 insertions(+), 75 deletions(-)
> > 
> ...
> > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > index d33d1d9..b28c734 100644> > --- a/src/qemu/qemu_domain.c
> > +++ b/src/qemu/qemu_domain.c
> > @@ -36,6 +36,7 @@
> >  #include "uuid.h"
> >  #include "virfile.h"
> >  #include "domain_event.h"
> > +#include "virtime.h"
> >  
> >  #include <sys/time.h>
> >  #include <fcntl.h>
> > @@ -728,7 +729,7 @@ qemuDomainObjBeginJobInternal(struct qemud_driver *driver,
> >  
> >      priv->jobs_queued++;
> >  
> > -    if (virTimeMs(&now) < 0)
> > +    if (virTimeMillisNow(&now) < 0)
> >          return -1;
> >      then = now + QEMU_JOB_WAIT_TIME;
> >  
> ...
> 
> This (and other similar ones in this patch) simple replacement won't work
> since virTimeMs used to report libvirt error while virTimeMillisNow doesn't do
> that. Thus in case of error (although it's not a frequent one)
> qemuDomainObjBeginJobInternal would return -1 without reporting any error.

Oh whoops. I guess I'll create a second variant (which isn't async
signal safe) which raises real errors to use in this scenario


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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]