summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-04-28 11:57:02 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-08 15:51:19 -0500
commite7d54ae83c4ffb63a2481d17f136110ab421afc5 (patch)
tree5f34bdff519f062441f1eb9b7c0911b63a77483a
parente8a6aec9b5e062ca8d14ae0e14efda17ae9685d8 (diff)
downloadhqemu-e7d54ae83c4ffb63a2481d17f136110ab421afc5.zip
hqemu-e7d54ae83c4ffb63a2481d17f136110ab421afc5.tar.gz
fix asynchronous ioctls
posix_aio_read expect aio requests to return the number of bytes requests to be successfull, so we need to fake this up for ioctls. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--posix-aio-compat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index c7fdac7..e9fc9fa 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -90,7 +90,16 @@ static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);
if (ret == -1)
return -errno;
- return ret;
+
+ /*
+ * This looks weird, but the aio code only consideres a request
+ * successfull if it has written the number full number of bytes.
+ *
+ * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,
+ * so in fact we return the ioctl command here to make posix_aio_read()
+ * happy..
+ */
+ return aiocb->aio_nbytes;
}
#ifdef HAVE_PREADV
OpenPOWER on IntegriCloud