[PATCH] D21982: WIP: Implement a per-thread inmemory log

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 00:12:19 PDT 2016


dberris marked 4 inline comments as done.

================
Comment at: lib/xray/xray_inmemory_log.cc:71
@@ +70,3 @@
+    auto Written = write(Fd, Begin, Items * sizeof(XRayRecord));
+    if (Written <= 0) {
+      if (errno == EINTR)
----------------
majnemer wrote:
> mehdi_amini wrote:
> > majnemer wrote:
> > > I don't believe `write` can actually return zero for this case.
> > When does write can actually return zero according to the spec?
> From my recollection, it should only be possible if you pass write a count of zero bytes.
Ah, that's right. I was confused by the documentation too. Fixed.

================
Comment at: lib/xray/xray_inmemory_log.cc:80
@@ +79,3 @@
+    assert(static_cast<uint64_t>(Written) <= TotalBytes);
+    assert(Written % sizeof(XRayRecord) == 0);
+    TotalBytes -= Written;
----------------
majnemer wrote:
> ISTM that this assert can fail in practice.
> 
> I'd maintain the buffer you are trying to write as just a `char *` to correctly handle this.
Good catch. Done.


http://reviews.llvm.org/D21982





More information about the llvm-commits mailing list