Re: [PATCHv3 02/13] xread: poll on non blocking fds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> On Tue, Sep 22, 2015 at 12:45:51PM -0700, Junio C Hamano wrote:
>
>> One caveat is that the caller may not know in the first place.
>> 
>> The last time I checked the existing callers of xread(), there were
>> a few that read from a file descriptor they did not open themselves
>> (e.g. unpack-objects that read from standard input).  The invoker of
>> these processes is free to do O_NONBLOCK their input stream for
>> whatever reason.
>
> Yeah. I do not think this is a bug at all; the user might have their
> reasons for handing off an O_NONBLOCK pipe. If we take xread() to mean
> "try to read from fd until we get a real error, some data, or an EOF",
> then it is perfectly reasonable to replace spinning on read() (which we
> do now) with a poll() for efficiency. The caller (and the user) does not
> have to care, and should not notice; the outcome will be the same.

I think we are in agreement, and that answers the question/guidance
Stefan asked earlier in $gmane/278414, which was:

> So rather a combination of both, with the warning only spewing every
> 5 seconds or such?

and the answer obviously is "No warning, do a poll() without timeout
to block".
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]