instance Storable AIOCB where sizeOf _ = (#const sizeof (struct aiocb))
alignment _ = 1 poke p_AIOCB (AIOCB aioFd aioLioOpcode aioReqPrio aioOffset aioBuf aioBytes aioSigevent) = do (#poke struct aiocb, aio_fildes) p_AIOCB aioFd (#poke struct aiocb, aio_lio_opcode) p_AIOCB aioLioOpcode (#poke struct aiocb, aio_reqprio) p_AIOCB aioReqPrio (#poke struct aiocb, aio_offset) p_AIOCB aioOffset (#poke struct aiocb, aio_buf) p_AIOCB aioBuf (#poke struct aiocb, aio_nbytes) p_AIOCB aioBytes (#poke struct aiocb, aio_sigevent) p_AIOCB aioSigevent peek p_AIOCB = do aioFd <- (#peek struct aiocb, aio_fildes) p_AIOCB aioLioOpcode <- (#peek struct aiocb, aio_lio_opcode) p_AIOCB aioReqPrio <- (#peek struct aiocb, aio_reqprio) p_AIOCB aioOffset <- (#peek struct aiocb, aio_offset) p_AIOCB aioBuf <- (#peek struct aiocb, aio_buf) p_AIOCB aioBytes <- (#peek struct aiocb, aio_nbytes) p_AIOCB aioSigevent <- (#peek struct aiocb, aio_sigevent) p_AIOCB return (AIOCB aioFd aioLioOpcode aioReqPrio aioOffset aioBuf aioBytes aioSigevent) On Tue, Jul 1, 2008 at 2:48 AM, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > Hello Vasili, > > Tuesday, July 1, 2008, 11:42:26 AM, you wrote: > > looks ok, show us your peek/poke code > > > > Hello, > > > I am also testing my aio support. The aio_write binding > > seems to work ok .. as well as aio_error, Aio_return is a problem > > child. I think I wrote a really simple binding. I always receive > > nbytes as 0. I have been staring at the code hoping to catch a > > stupid mistake. I put putStrLn's in the code. .....Here is the code ... > > > > aioReturn :: AIOCB -> IO (AIOCB, ByteCount) > > aioReturn aiocb = do > > allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb -> do > > poke p_aiocb aiocb > > count <- throwErrnoIfMinus1 "aioReturn" (c_aio_return p_aiocb) > > aiocb <- peek p_aiocb > > return (aiocb, fromIntegral count) > > > foreign import ccall safe "aio.h aio_return" > > c_aio_return :: Ptr AIOCB -> IO CInt > > > Maybe someone can spot something that I haven't. > > > > Thanks, Vasili > > > > > -- > Best regards, > Bulat mailto:[EMAIL PROTECTED] > >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe