On Mon, Dec 14, 2015 at 6:03 PM, Eric Sunshine <ericsunsh...@gmail.com> wrote:
> On Mon, Dec 14, 2015 at 2:37 PM, Stefan Beller <sbel...@google.com> wrote:
>> Provide a wrapper to read(), similar to xread(), that restarts on
>> EINTR but not EAGAIN (or EWOULDBLOCK). This enables the caller to
>> handle polling itself, possibly polling multiple sockets or performing
>> some other action.
>>
>> Signed-off-by: Stefan Beller <sbel...@google.com>
>> ---
>> diff --git a/wrapper.c b/wrapper.c
>> @@ -252,6 +252,28 @@ ssize_t xread(int fd, void *buf, size_t len)
>> + * xread_nonblock() is the same a read(), but it automatically restarts 
>> read()
>> + * interrupted operations (EINTR). xread_nonblock() DOES NOT GUARANTEE that
>> + * "len" bytes is read. EWOULDBLOCK is turned into EAGAIN.
>
> The last sentence is confusing. From the commit message, we learn that
> this function doesn't care about EAGAIN or EWOULDBLOCK, yet the above
> comment seems to imply that it does. What it really ought to be saying
> is that "as a convenience, errno is transformed from EWOULDBLOCK to
> EAGAIN so that the caller only has to check for EAGAIN".

I forgot to mention that the mutation of EWOULDBLOCK into EAGAIN is
something that should be described in the header rather than here at
the source. In fact, the entire comment block above this function is
more suitable in the header file.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to