|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 02/11] libxl: react correctly to bootloader pty master POLLHUP
On Wed, 2012-08-01 at 17:24 +0100, Ian Jackson wrote:
> Receive POLLHUP on the bootloader master pty is not an error.
> Hopefully it means that the bootloader has exited and therefore the
> pty slave side has no process group any more. (At least NetBSD
> indicates POLLHUP on the master in this case.)
>
> So send the bootloader SIGTERM; if it has already exited then this has
> no effect (except that on some versions of NetBSD it erroneously
> returns ESRCH and we print a harmless warning) and we will then
> collect the bootloader's exit status and be satisfied.
>
> However, we remember that we have done this so that if we got POLLHUP
> for some other reason than that the bootloader exited we report
> something resembling a useful message.
>
> In order to implement this we need to provide a way for users of
> datacopier to handle POLLHUP rather than treating it as fatal.
>
> We rename bootloader_abort to bootloader_stop since it now no longer
> only applies to error situations.
>
> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
>
> -
> Changes in v4:
> * Track whether we sent SIGTERM due to POLLHUP so we can report
> messages properly.
>
> Changes in v3:
> * datacopier provides new interface for handling POLLHUP
> * Do not ignore errors on the xenconsole pty
> * Rename bootloader_abort.
> ---
> tools/libxl/libxl_aoutils.c | 23 +++++++++++++++++++++++
> tools/libxl/libxl_bootloader.c | 39 +++++++++++++++++++++++++++++----------
> tools/libxl/libxl_internal.h | 7 +++++--
> 3 files changed, 57 insertions(+), 12 deletions(-)
>
> diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c
> index 99972a2..4bd5484 100644
> --- a/tools/libxl/libxl_aoutils.c
> +++ b/tools/libxl/libxl_aoutils.c
> @@ -97,11 +97,31 @@ void libxl__datacopier_prefixdata(libxl__egc *egc,
> libxl__datacopier_state *dc,
> LIBXL_TAILQ_INSERT_TAIL(&dc->bufs, buf, entry);
> }
>
> +static int datacopier_pollhup_handled(libxl__egc *egc,
> + libxl__datacopier_state *dc,
> + short revents, int onwrite)
> +{
> + STATE_AO_GC(dc->ao);
> +
> + if (dc->callback_pollhup && (revents & POLLHUP)) {
> + LOG(DEBUG, "received POLLHUP on %s during copy of %s",
> + onwrite ? dc->writewhat : dc->readwhat,
> + dc->copywhat);
> + libxl__datacopier_kill(dc);
> + dc->callback(egc, dc, onwrite, -1);
You've forgotten to make this ->callback_pollhup as discussed last time.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |