linuxsocketsasynchronoussendfileaio

Is there an asynchronous version of sendfile in Linux?


The io_getevents notification mechanism looks quite capable at first glance, so I would like something I could use with it. I just couldn't find anything yet. On Windows, it's easy: There is only TransmitFile, which can work asynchronously (overlapped) and with some notification mechanism (IOCP, event) if you want that. There must be some equivalent on Linux, right? Or, to put my question in some context, how would I create an efficient file server on Linux?


Solution

  • Alas, there is nothing easy for you on Linux and nearly anything can block in the wrong circumstances (even io_submit). In answer to your questions (in the title and within the main text):

    Them's the breaks...

    Future (2020+) solutions

    There's a suggestion that some future Linux kernel (later than 5.5 as were' already up to 5.5-rc7 at the time of writing) could essentially perform an asynchronous sendfile via io_uring if io_uring gains support for splice()...