On Tue, Sep 22, 2015 at 05:14:42PM -0700, Stefan Beller wrote:
> We should not care if the call to poll failed, as we're in an infinite loop
> and
> can only get out with the correct read(..). So maybe an implementation like
> this
> would already suffice:
>
> ssize_t xread(int fd, void *buf, s
Stefan Beller writes:
> We should not care if the call to poll failed, as we're in an infinite loop
> and
> can only get out with the correct read(..).
I think I agree with that reasoning. The only thing we want out of
this call to poll(2) is to delay calling read(2) again when we know
we woul
On Tue, Sep 22, 2015 at 1:00 PM, Junio C Hamano wrote:
> Jeff King 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 f
Jeff King 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
On Tue, Sep 22, 2015 at 12:45:51PM -0700, Junio C Hamano wrote:
> Jacob Keller writes:
>
> > 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.
Jacob Keller writes:
> 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 rea
On Tue, Sep 22, 2015 at 11:21 AM, Junio C Hamano wrote:
> Stefan Beller writes:
>
>> On Tue, Sep 22, 2015 at 8:58 AM, Junio C Hamano wrote:
>>> Eric Sunshine writes:
>>>
> while (1) {
> nr = read(fd, buf, len);
> - if ((nr < 0) && (errno == EAGA
On 22.09.15 08:23, Jacob Keller wrote:
> On Mon, Sep 21, 2015 at 9:55 PM, Torsten Bögershausen wrote:
>> But in any case I suggest to xread() as it is, and not to change the
>> functionality
>> behind the back of the users.
>>
>>
>
> I don't think this patch actually changes behavior as it stand
Stefan Beller writes:
> On Tue, Sep 22, 2015 at 8:58 AM, Junio C Hamano wrote:
>> Eric Sunshine writes:
>>
while (1) {
nr = read(fd, buf, len);
- if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
- continue;
On Tue, Sep 22, 2015 at 8:58 AM, Junio C Hamano wrote:
> Eric Sunshine writes:
>
>>> while (1) {
>>> nr = read(fd, buf, len);
>>> - if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
>>> - continue;
>>> + if (nr < 0) {
>>
Eric Sunshine writes:
>> while (1) {
>> nr = read(fd, buf, len);
>> - if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
>> - continue;
>> + if (nr < 0) {
>> + if (errno == EINTR)
>> +
On Mon, Sep 21, 2015 at 9:55 PM, Torsten Bögershausen wrote:
> But in any case I suggest to xread() as it is, and not to change the
> functionality
> behind the back of the users.
>
>
I don't think this patch actually changes behavior as it stands now. I
think Junio's suggestion does. Personally
On 09/22/2015 01:55 AM, Junio C Hamano wrote:
Stefan Beller writes:
So if we get an EAGAIN or EWOULDBLOCK error the fd must be nonblocking.
As the intend of xread is to read as much as possible either until the
fd is EOF or an actual error occurs, we can ease the feeder of the fd
by not spinni
On Mon, Sep 21, 2015 at 6:39 PM, Stefan Beller wrote:
> From the man page:
> [...]
> So if we get an EAGAIN or EWOULDBLOCK error the fd must be nonblocking.
s/So/&,/
s/error/&,/
> As the intend of xread is to read as much as possible either until the
s/intend/intent/
> fd is EOF or an actual e
Stefan Beller writes:
> So if we get an EAGAIN or EWOULDBLOCK error the fd must be nonblocking.
> As the intend of xread is to read as much as possible either until the
> fd is EOF or an actual error occurs, we can ease the feeder of the fd
> by not spinning the whole time, but rather wait for it
>From the man page:
EAGAIN The file descriptor fd refers to a file other than a socket
and has been marked nonblocking (O_NONBLOCK), and the read
would block.
EAGAIN or EWOULDBLOCK
The file descriptor fd refers to a socket and has been marked
nonblocking (O_NONBLOCK), a
16 matches
Mail list logo