[Lldb-commits] [PATCH] D25783: [Host] handle short reads and writes

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 19 13:47:24 PDT 2016

zturner added a comment.

In https://reviews.llvm.org/D25783#574699, @labath wrote:

> In https://reviews.llvm.org/D25783#574684, @zturner wrote:
> > There are many other problems with this code if we want to deal with atomicity.  For example, the whole point of this patch was to handle short reads and writes.  Well, if you have a short read or a write, then reading and writing a subsequent chunk is not atomic.
> I am willing abandon the atomicity if someone tries to write more than 2GB of data - I think he has bigger problems than that.

Writing more than 2GB of data is not the only reason to get a short read or write.  You can be interrupted by a signal after some of the data has been written but not all.  This can happen with any number of bytes and at any time.  `write`, `read`, and all other related functions will return a non-negative value indicating the number of bytes successfully read/written, which will be less than the number requested.


More information about the lldb-commits mailing list