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

2016-10-20 Thread Pavel Labath via lldb-commits
labath added a comment. In https://reviews.llvm.org/D25783#574873, @zturner wrote: > In https://reviews.llvm.org/D25783#574860, @labath wrote: > > > > This can happen with any number of bytes and at any time. `write`, > > > `read`, and all other related functions will return a non-negative valu

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

2016-10-19 Thread Zachary Turner via lldb-commits
Actually ignore that last comment , the behavior is the same as before, but linux will still behave differently than other platforms On Wed, Oct 19, 2016 at 3:17 PM Zachary Turner wrote: > zturner added a comment. > > Incidentally, this patch actually makes all platforms behave consistently > whe

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added a comment. Incidentally, this patch actually makes all platforms behave consistently when the `Write` overload with offset is used with `O_APPEND`, so there's probably some value in having that consistency. https://reviews.llvm.org/D25783 __

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added a comment. In https://reviews.llvm.org/D25783#574860, @labath wrote: > > 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, w

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

2016-10-19 Thread Pavel Labath via lldb-commits
labath added a comment. > 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. Except if fd refe

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

2016-10-19 Thread Greg Clayton via lldb-commits
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Ok, the lseek calls make sense then. https://reviews.llvm.org/D25783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.l

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added inline comments. Comment at: source/Host/common/File.cpp:405 -if (bytes_read == 0) { - if (::feof(m_stream)) -error.SetErrorString("feof"); - else if (::ferror(m_stream)) -error.SetErrorString("ferror"); - num_bytes = 0; -} e

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added a comment. Also you are right that I misspoke about the append case. But still, I just think that if writing to the same file from multiple processes is something we care about, we should support it "for real" instead of just pretending to. That means some kind of cross-process

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

2016-10-19 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. Just a few questions on why we are calling lseek in the read and write functions. See inlined comments. Comment at: source/Host/common/File.cpp:405 -if (

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

2016-10-19 Thread Zachary Turner via lldb-commits
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 shor

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

2016-10-19 Thread Pavel Labath via lldb-commits
labath added a comment. 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,

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added a comment. Also, for the record, if you specify the threadsafe logging option, it already does put this in a mutex, so there should be no issue. https://reviews.llvm.org/D25783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner added a comment. In https://reviews.llvm.org/D25783#574679, @labath wrote: > I am not sure the "append" thing is actually a "fix". I consider it more like > a feature of the append mode. It's also nice that it guarantees atomicity of > writes even if two processes are writing to the sam

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

2016-10-19 Thread Pavel Labath via lldb-commits
labath added a comment. I am not sure the "append" thing is actually a "fix". I consider it more like a feature of the append mode. It's also nice that it guarantees atomicity of writes even if two processes are writing to the same file (very useful for logging, although I'm not sure if that go

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

2016-10-19 Thread Zachary Turner via lldb-commits
zturner created this revision. zturner added reviewers: clayborg, beanz, EugeneBi. zturner added a subscriber: lldb-commits. The original motivation for this came from https://reviews.llvm.org/D25712, in which Eugene pointed out that `File::Read()` does not correctly handle short reads. However