[Lldb-commits] [PATCH] D25783: [Host] handle short reads and writes
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 19 15:04:38 PDT 2016
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).
More information about the lldb-commits