Messages in this thread | | | Date | Thu, 25 Jun 1998 10:26:54 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: sendfile(2) idea (was: Thread implementations) |
| |
On Thu, 25 Jun 1998, Matti Aarnio wrote: > > The main reasons for NOT doing sendfile() as: > sendfile(filename, startoffset, copylength, outfd, opts) > is IMO its lack of genericity -- purely send a filesystem > object out to any fd...
It wouldn't be like that. It would be something like
fd = open("file", O_RDONLY); /* maybe fseek(fd, ...); or something else here */ do { sent = sendfile(outfd, fd, bytes, flags); if (sent <= 0) break; bytes -= sent; } while (bytes); ..
so it would work more like a "read()+write()" combination rather than anything else.
The way I'd implement it at least the first cut would have the rule that you can only send from a file that can be in the page cache - so you could have a source that is ext2 or NFS for example, but you couldn't have a socket as the source because the data for a socket isn't in the page cache. Thus "sendFILE()", not "copyfd()".
The destination would be arbitrary, so you could send to sockets or to other files or whatever.
The nice thing is that I suspect I can implement this (cleanly) in a weekend if I just were to have a free weekend somewhere ;)
Linus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |