4

I want to send data from one file descriptor to another via linux-aio without buffering and without transferring data to and from user space. Is such a sendfile64() funktion possible with linux-aio?

I looked at some linux-aio examples (in C/C++) and simple file-copy programs. All these examples do reading -> buffer -> writing.

regards, philip

  • 1
    If you want to use `sendfile` in the background, why not do it in a separate thread or process? – Some programmer dude Jul 04 '13 at 10:37
  • 1
    yes I can use sendfile from multiple posix threads, but I want something like a async sendfile. – Philip Schneider Jul 04 '13 at 11:07
  • 1
    How does the asynchronous behaviour of the `aio` api differ from calling a thread? – alk Jul 04 '13 at 11:10
  • 1
    Create a thread/process, call `sendfile`, from new thread/process send signal to parent thread/process. Ta da, asynchronous `sendfile`! :) – Some programmer dude Jul 04 '13 at 11:15
  • 1
    yes, I also could use sendfile nonblocking and balance the operation in chunks over multiple threads but the IO operation inside the kernel is still "normal IO", the filesystem IO is still sync and the operation can block inside the kernel. https://lwn.net/Kernel/Index/#Asynchronous_IO – Philip Schneider Jul 04 '13 at 12:50

1 Answers1

0

It's possible if you mmap the file, then you can make a aio sendfile. It's faster then sendfile via do_splice and should not sync at i_mutex. Look at the lighttp linux_aio module.

scheiflo
  • 130
  • 1
  • 5