> On April 3, 2014, 5:57 p.m., Vinod Kone wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp, lines 52-58 > > <https://reviews.apache.org/r/19991/diff/2/?file=547563#file547563line52> > > > > I'm confused about these semantics. What is the rationale? AFAICT, > > read() doesn't operate this way. > > Benjamin Hindman wrote: > IIUC, it indeed does. From 'man 2 read': > > On success, the number of bytes read is returned (zero indicates end of > file), and the file position is advanced by this number. It is not an error > if this number is smaller than the number of bytes requested; this may happen > for example because fewer bytes are actually available right now (maybe > because we were close to end-of-file, or because we are reading from a pipe, > or from a terminal).
I thought ::read() returns the number of bytes (potentially less than requested) if EOF is encountered? Reads after an EOF will return zero. The semantics seem clear to me and match ::read(). - Ian ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/19991/#review39428 ----------------------------------------------------------- On April 3, 2014, 6:35 a.m., Benjamin Hindman wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/19991/ > ----------------------------------------------------------- > > (Updated April 3, 2014, 6:35 a.m.) > > > Review request for mesos, Ian Downes and Vinod Kone. > > > Repository: mesos-git > > > Description > ------- > > The only user of os::read(fd, size) that required the seek semantics was > protobuf::read, and it could easily be modified to do the unseeking itself. > Thus, I've cleaned this up so os::read(fd, size) can be used on things like > pipes and sockets! > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp > d6a124e0515b2de7b886d1f5837eedb497b2eb8b > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp > 939cb7238fe2210046b69573ebd2f3b5de918920 > > Diff: https://reviews.apache.org/r/19991/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Benjamin Hindman > >
