On Mon, Jul 21, 2008 at 01:05:48PM +1200, Richard A. O'Keefe wrote: > I think it may be time for a little clarity about aoicb's. > From the Single Unix Specification: > "The <aio.h> header shall define the aiocb structure > which shall include AT LEAST the following members: > int aio_fildes File descriptor. > off_t aio_offset File offset. > volatile void *aio_buf Location of buffer. > size_t aio_nbytes Length of transfer. > int aio_reqprio Request priority offset. struct > sigevent aio_sigevent Signal number and value. > int aio_lio_opcode Operation to be performed. > " > The "AT LEAST" here means that > - a portable program may rely on these members being present > - a portable program MUST assume that an unknown number of > additional members are also present > - a portable program may freely copy such a record, but may > only pass it to a library function if that function is > expecting to initialise it > > For asynchronous I/O, this means that > - you can allocate an aiocb object > - an aiocb passed to aio_suspend, aio_error, > aio_return, or aio_cancel should have been > filled in by aio_read or aio_write and should > be EXACTLY THE SAME object, not a copy of it.
Yes. This is pretty standard as far as what you can count on in terms of standard C structures. The method I use in the RSA.hsc module I posted is compatible with these assumptions. Generally this is pretty much exactly the thing hsc2hs was made to solve. Just a note, if you are doing manual explicit frees of the aiocb structure then you only need a 'Ptr', if you want the structure to be automatically garbage collected when all haskell references to it disappear, then you need to use 'ForeignPtr'. John -- John Meacham - ⑆repetae.net⑆john⑈ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe