> For the record, I'd like to make the read "atomic", such that you can > never get half a file before a change, and half after. But it likely > depends on what OSs can enforce here.
I think *enforcing* atomicity is difficult across all OSes. But implementations can get nearly the same effect by checking the file's last modification time at the start + end of the API call. If it has changed, the read operation can throw an exception.