Messages in this thread | | | Date | Sun, 28 Jun 1998 10:10:33 -0500 (CDT) | From | Oliver Xymoron <> | Subject | Re: sendfile(2) idea (was: Thread implementations) |
| |
On Thu, 25 Jun 1998, Linus Torvalds wrote:
> 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.
Is it possible to optimize the "mmap()+write()" combination instead and avoid adding a new scheme? Since the problem with the mmap scheme seems to be the time penalty of changing the VM, perhaps mmap() could be rewritten to be "lazy" so that it "marked a region as mapped" but didn't actually do the MM work until the first fault on the area occurred? write() could then check whether its buffer was mapped and go straight to the underlying object without ever having to do the VM mapping. Probably innumerable complications to work around in a scheme like this and the more I think about it, the better the above sendfile looks.
-- "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |