On Wed, Mar 23, 2011 at 05:48:13PM -0600, Eric Blake wrote:
Sometimes, an asynchronous helper is started (such as a compressor
or iohelper program), but a later error means that we want to
abort that child. Make this easier.
Note that since daemons and virCommandRunAsync can't mix, the only
time virCommandFree can reap a process is if someone did
virCommandRunAsync for a non-daemon and didn't stash the pid.
* src/util/command.h (virCommandAbort): New prototype.
* src/util/command.c (_virCommand): Add new field.
(virCommandRunAsync, virCommandWait): Track whether pid was used.
(virCommandFree): Reap child if caller did not request pid.
(virCommandAbort): New function.
* src/libvirt_private.syms (command.h): Export it.
* tests/commandtest.c (test19): New test.
---
v2: no change, but by adding patch 2, it should make it clear
that this patch is doing the right thing about not reaping
a long-running daemon.
src/libvirt_private.syms | 1 +
src/util/command.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/command.h | 12 +++++++-
tests/commandtest.c | 37 +++++++++++++++++++++++++
4 files changed, 115 insertions(+), 1 deletions(-)
ACK, including the followup patch to tests/commandtest.c,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/