qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/2] fix asynchronous ioctls


From: Christoph Hellwig
Subject: [Qemu-devel] [PATCH 1/2] fix asynchronous ioctls
Date: Tue, 28 Apr 2009 11:57:02 +0200
User-agent: Mutt/1.3.28i

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.

[NB: this function is formatted using tabs, so the new code is too.
 Or should I convert the whole function in my patch?]


Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/posix-aio-compat.c
===================================================================
--- qemu.orig/posix-aio-compat.c        2009-04-28 11:42:33.801074561 +0200
+++ qemu/posix-aio-compat.c     2009-04-28 11:44:18.392076590 +0200
@@ -90,7 +90,16 @@ static size_t handle_aiocb_ioctl(struct 
        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]