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 refers to a pipe, in which case writes of up to PIPE_MAX will be 
atomic.

Also, I just noticed another problem. What if the fd does not refer to an 
actual file, but a non-seekable file system object (named pipe, domain socket, 
...). Will the lseek work on that? I have no idea. But, I think you're 
implementing a broken API to save a couple of lines of code.

(btw, you may want to know that pwrite() on O_APPEND descriptors basically 
ignores the offset argument, and always does an append).


https://reviews.llvm.org/D25783



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to