]> xenbits.xensource.com Git - people/pauldu/xen.git/commit
tools/libxl: Adjust datacopiers POLLHUP handling when the fd is also readable
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 16 Mar 2015 13:29:54 +0000 (13:29 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 18 Mar 2015 11:31:58 +0000 (11:31 +0000)
commit7e9ec50b0535bf2630da9d279a060775817d136d
treedf1601df1a106b961ac69d75a1e02de29ccf76f5
parent6d896e1357ff89d4e3f85e2ccba377eda302063d
tools/libxl: Adjust datacopiers POLLHUP handling when the fd is also readable

POLLHUP|POLLIN is a valid revent to receive when there is readable data in a
pipe, but the writable fd has been closed.  This occurs in migration v2 when
the legacy conversion process (which transforms the data inline) completes and
exits successfully.

In the case that there is data to read, suppress the POLLHUP.  POSIX states
that the hangup state is latched[1], which means it will reoccur on subsequent
poll() calls.  The datacopier is thus provided the opportunity to read until
EOF, if possible.

A POLLHUP on its own is treated exactly as before, indicating a different
error with the fd.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_aoutils.c