Another solution: I now believe that checking for EINTR is in fact redundant, and xioctl should be removed and replaced with ioctl throughout. Much simpler! Comments?