qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT 5f34bdf] fix asynchronous ioctls


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 5f34bdf] fix asynchronous ioctls
Date: Fri, 08 May 2009 20:53:36 -0000

From: Christoph Hellwig <address@hidden>

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 <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]