> The OS support I am talking about: > a) the fork behavior on an open file should be available > *without* forking. dup() doesn't cut it (both fds share > the same offset on the underlying file). I'd call the new > syscall fdfork(). That is, if I do > > int newfd = fdfork(oldfd); > > reading N bytes each from newfd and oldfd will return > identical data.
i can't think of a way to do this correctly. buffering in the kernel would only work if each process issued exactly the same set of reads. there is no requirement that the data from 2 reads of 100 bytes each be the same as the data return with 1 200 byte read. before you bother with "but that's a wierd case", remember that the success of unix and plan 9 has been built on the fact that there aren't syscalls that fail in "wierd" cases. - erik