Implementing aio_* and lio_* (async i/o) on Cygwin

Mark Geisert mark@maxrnd.com
Tue Mar 20 05:53:00 GMT 2018


Corinna Vinschen wrote (a while back):
> However, using async IO, the only change necessary would be to change
> prw_open to open an async handle, and pread/pwrite to wait for the
> result if the current I/O is NOT async.  It may be necessary to add a
> parameter or two to the pread/pwrite fhandler methods, but all the rest
> of the functionality could be in the callers.

I see what you're suggesting; seems sly in a nice way :).

A small part I'm missing is in interfacing to the layer above this.  Are the 
aio_* functions supposed to be implemented as "real" syscalls (in syscalls.cc)? 
Or should they be implemented in their own aio.cc (which is where I have them 
ATM) and call pread()/pwrite() to do their dirty work?  I'm unsure how "central" 
a syscall has to be to merit syscalls.cc location.

Regardless of which file the code is in, I was thinking I should copy 
syscalls.cc's pread() contents into aio_read(), for example, to start with. 
Then add extra param(s) as needed to the fhandler method call as you suggested.

The problem with having aio_read() call pread() directly is how to tell pread() 
we want an async read.  That's why I was suggesting O_ASYNC previously, though I 
now understand that's the wrong direction to go.  What is the correct direction?
Thanks much,

..mark



More information about the Cygwin-developers mailing list