libxl: ao abort: Handle SIGTERM in save/restore helper
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 10 Feb 2015 19:05:06 +0000 (19:05 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 26 Jun 2015 15:53:51 +0000 (16:53 +0100)
commitb6ac9b7fc6bb18057a1aa114296b32f59b40e187
treeda6bac3907efb0e5ff72db15c4a1fbc30d0bb35f
parent60d6c96bd93b074bc346dc15ab27bd59907d1667
libxl: ao abort: Handle SIGTERM in save/restore helper

During startup of the save/restore helper, set the disposition of
SIGTERM appropriately.

For restore, we can simply die immediately - there is no point trying
to do any kind of cleanup on what is now going to be a trashed domain.

For save, we want to arrange that libxc's cleanup code (eg turning off
logdirty) takes place.  So our signal handler replaces the fd with one
on which writes will fail, causing libxc's own loop to fail next time
it actually tries to do a write.

Currently this has only a minor beneficial effect: we don't send the
helper a SIGTERM ourselves, and if someone else contrives to send our
helper a SIGTERM they have probably sent one to libxl too in which
case things are going to be a bit messy anyway.

But in the next patch libxl itself is going to use SIGTERM to
implement ao abort requests.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: New in this version of the series.
tools/libxl/libxl_save_helper.c