Re: [PATCHv3 02/13] xread: poll on non blocking fds
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 22, 2015, 19:45 UTC
- Message-ID
- <xmqqy4fy2q6o.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CA+P7+xozmsT4mZsBdvSQkGx4Wk-bOE1h-vAbRG_LAL5A-MAwTw@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> writes:
Show 6 quoted lines
> I don't think this patch actually changes behavior as it stands now. I > think Junio's suggestion does. Personally, I'd prefer some sort of > warning when you use xread and get EAGAIN or EWOULDBLOCK. I'd rather > see it somehow warn so that we can find the bug (since we really > really shouldn't be calling xread with a blocking socket, especially > if we have xread_noblock or similar as in this series.
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.