3 ms·
> Does that mean write is atomic? Technically, yes: future reads must return the entire contents of the write, or none of it. However, write is not required to
by dfox 6y ago
> Does that mean write is atomic? Technically, yes: future reads must return the entire contents of the write, or none of it. However, write is not required to be complete, and is allowed to only transfer part of the data.
This is technically right interpretation of what POSIX says but totally ignores the fact that in such state the application will know that this happened and should handle that. Because in the first place the rest of the write request did not happen at all and it will not happen unless the application retries the write(2) with rest of the data. Most applications simply ignore this situation which is the reason that this situation is guaranteed to not happen on any even vaguely unix-derived OS (and exactly this is the number one reason for error messages of the "Error: Success" kind).
- the8472 6y agoand then there's mmap where you can observe changes at byte-level granularity.
- remexre 6y agoRight, I think the point is that you no longer have atomic semantics for the write as a whole.
- formerly_proven 6y agoWell until people's file descriptors happen to be pipes or sockets.