[libvirt] [PATCHv2 3/8] Introduce new APIs for spawning processes

Daniel P. Berrange berrange at redhat.com
Thu Dec 2 14:18:53 UTC 2010


On Wed, Dec 01, 2010 at 04:39:25PM -0700, Eric Blake wrote:
> On 11/23/2010 04:49 PM, Eric Blake wrote:
> > From: Daniel P. Berrange <berrange at redhat.com>
> > 
> > This introduces a new set of APIs in src/util/command.h
> > to use for invoking commands. This is intended to replace
> > all current usage of virRun and virExec variants, with a
> > more flexible and less error prone API.
> > 
> > +/*
> > + * Call after adding all arguments and environment settings, but before
> > + * Run/RunAsync, to immediately output the environment and arguments of
> > + * cmd to logfd.  If virCommandRun cannot succeed (because of an
> > + * out-of-memory condition while building cmd), nothing will be logged.
> > + */
> > +void virCommandWriteArgLog(virCommandPtr cmd,
> > +                           int logfd);
> > +
> > +/*
> > + * Call after adding all arguments and environment settings, but before
> > + * Run/RunAsync, to return a string representation of the environment and
> > + * arguments of cmd.  If virCommandRun cannot succeed (because of an
> > + * out-of-memory condition while building cmd), NULL will be returned.
> > + * Caller is responsible for freeing the resulting string.
> > + */
> > +char *virCommandToString(virCommandPtr cmd) ATTRIBUTE_RETURN_CHECK;
> 
> Bummer.  Just realized that these functions should probably be modified
> to take another parameter that controls whether the output should be
> quoted for shell use.

I don't think this is particularly important given the usage
made of these API. It is just a nice to have addition, which
shouldn't delay the patchset.

Dnaiel




More information about the libvir-list mailing list