Can sendfile() linux syscall be used to send part of file from one mmaped file to other mmaped file?
Asked
Active
Viewed 840 times
1 Answers
3
From sendfile(2)
:
Presently (Linux 2.6.9): in_fd, must correspond to a file which supports mmap()-like operations (i.e., it cannot be a socket); and out_fd must refer to a socket.
So it looks like the answer is no.
Edit
I think I understand what you are looking for now. Check out splice(2)
.

Nikolai Fetissov
- 82,306
- 11
- 110
- 171
-
But what with more recent kernels? mans in linux are maintained very bad (comparing with any commercial unix, line solaris, hpux, etc) – osgx Mar 29 '10 at 15:05
-
I don't think that has changed, have to look into the source, but the question I forgot to ask - what are you trying to do? Can't you solve this with shared memory? Or was it just curiosity? – Nikolai Fetissov Mar 29 '10 at 15:37
-
1I want to do zerocopy. memcpy is too slow. – osgx Mar 29 '10 at 15:51
-
If this is on the same box, just work with shared pages from multiple processes. Something has to write to memory and then something has to read from it in any case. – Nikolai Fetissov Mar 29 '10 at 16:06