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

Re: [Xen-devel] [PATCH v4 25/32] libxl_exec: Add libxl__spawn_initiate_failure



On Fri, Jul 27, 2018 at 03:06:07PM +0100, Anthony PERARD wrote:
> This function can be use by user libxl__spawn_* when they setup a
                       ^ used and remove user
> notification other than xenstore. The parent can already called success
                                                           ^ report
> via libxl__spawn_initiate_detach(), this new function can be used for
> failure instead of waiting for the timeout.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
>  tools/libxl/libxl_exec.c     |  7 +++++++
>  tools/libxl/libxl_internal.h | 21 ++++++++++++++++++++-
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
> index 02e6c917f0..fb9621b10a 100644
> --- a/tools/libxl/libxl_exec.c
> +++ b/tools/libxl/libxl_exec.c
> @@ -373,6 +373,13 @@ void libxl__spawn_initiate_detach(libxl__gc *gc, 
> libxl__spawn_state *ss)
>      spawn_detach(gc, ss);
>  }
>  
> +void libxl__spawn_initiate_failure(libxl__gc *gc, libxl__spawn_state *ss, 
> int rc)
> +{
> +    assert(rc);
> +    ss->rc = rc;
> +    spawn_detach(gc, ss);
> +}
> +
>  static void spawn_fail(libxl__egc *egc, libxl__spawn_state *ss, int rc)
>  /* Caller must have logged.  Must be last thing in calling function,
>   * as it may make the callback.  Precondition: Attached or Detaching. */
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 110b951bbe..b94657a7f0 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -1551,7 +1551,8 @@ _hidden void libxl__spawn_init(libxl__spawn_state*);
>   *
>   * The inner child must soon exit or exec.  It must also soon exit or
>   * notify the parent of its successful startup by writing to the
> - * xenstore path xspath.
> + * xenstore path xspath OR via other mean that the parent will have
                                        ^ means
> + * to setup.
>   *
>   * The user (in the parent) will be called back (confirm_cb) every
>   * time that xenstore path is modified.
> @@ -1607,6 +1608,24 @@ _hidden int libxl__spawn_spawn(libxl__egc *egc, 
> libxl__spawn_state *spawn);
>   */
>  _hidden void libxl__spawn_initiate_detach(libxl__gc *gc, 
> libxl__spawn_state*);
>  
> +/*
> + * libxl__spawn_initiate_failure - Propagate failure from the caller to the
> + * callee.
> + *
> + * Works by killing the intermediate process from spawn_spawn.
> + * After this function returns, failures will be reported via failure_cb.
> + *
> + * This is not synchronous: there will be a further callback when
> + * the detach is complete.
> + *
> + * Logs errors.
> + *
> + * The spawn state must be Attached entry and will be Attached Failed
> + * on return.
> + */
> +_hidden void libxl__spawn_initiate_failure(libxl__gc *gc,
> +                                           libxl__spawn_state *ss, int rc);
> +
>  /*
>   * If successful, this should return 0.
>   *
> -- 
> Anthony PERARD
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.