3 ms·
No, sendfile takes a file descriptor and forwards the contents to a socket. It wouldn't have to mmap the file because the user code never touches the file data
by loewenskind 16y ago
No, sendfile takes a file descriptor and forwards the contents to a socket. It wouldn't have to mmap the file because the user code never touches the file data. This is probably why other OSes that support sendfile don't have this restriction.
>If you don't allow mmap the system will certainly have to copy between kernel and user memory
Why? All the kernel has to do is set the DMA location for the drive to be a kernel buffer and follow any inodes when the file is split up on the disk. The NIC driver can just be told to load the data from those locations directly so no kernel copying at all, much less into user space.
- acqq 16y ago> Why? I wrote about mmap in the context of separate write and read calls (i.e. no senddata call exists), not in the context of senddata.