Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-18 Thread Torsten Bögershausen
On 18.12.15 04:13, Jeff King wrote: > On Thu, Dec 17, 2015 at 09:42:01PM +0100, Torsten Bögershausen wrote: > >>> Or do you mean to insert another continue in here? >> I was thinking that we run into similar loop as before: >> read() returns -1; errno = EAGAIN /* No data to read */ >> poll()

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-18 Thread Jeff King
On Fri, Dec 18, 2015 at 09:50:46AM +0100, Torsten Bögershausen wrote: > >> So the code would look like this: > >> > >>if (!poll(, 1, -1)) > >> return -1; > > > > That changes the semantics of the function. The poll() is just a > > convenience to avoid spinning. If it fails, with

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Stefan Beller
On Thu, Dec 17, 2015 at 12:12 PM, Torsten Bögershausen wrote: > On 16.12.15 01:04, Stefan Beller wrote: >> The man page of read(2) says: >> >> EAGAIN The file descriptor fd refers to a file other than a socket >>and has been marked nonblocking (O_NONBLOCK), and the read

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Stefan Beller
On Thu, Dec 17, 2015 at 12:42 PM, Torsten Bögershausen wrote: > On 17.12.15 21:22, Stefan Beller wrote: >> On Thu, Dec 17, 2015 at 12:12 PM, Torsten Bögershausen wrote: >>> On 16.12.15 01:04, Stefan Beller wrote: The man page of read(2) says: EAGAIN

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Torsten Bögershausen
On 16.12.15 01:04, Stefan Beller wrote: > The man page of read(2) says: > > 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

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Torsten Bögershausen
On 17.12.15 21:22, Stefan Beller wrote: > On Thu, Dec 17, 2015 at 12:12 PM, Torsten Bögershausen wrote: >> On 16.12.15 01:04, Stefan Beller wrote: >>> The man page of read(2) says: >>> >>> EAGAIN The file descriptor fd refers to a file other than a socket >>>and has been

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Jeff King
On Tue, Dec 15, 2015 at 04:04:07PM -0800, Stefan Beller wrote: > If we get an EAGAIN or EWOULDBLOCK the fd must have set O_NONBLOCK. > As the intent 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

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Jeff King
On Thu, Dec 17, 2015 at 09:42:01PM +0100, Torsten Bögershausen wrote: > > Or do you mean to insert another continue in here? > I was thinking that we run into similar loop as before: > read() returns -1; errno = EAGAIN /* No data to read */ > poll() returns -1; errno = EAGAIN /* poll failed. If

Re: [PATCHv2 2/7] xread: poll on non blocking fds

2015-12-17 Thread Jeff King
On Thu, Dec 17, 2015 at 12:51:08PM -0800, Stefan Beller wrote: > > poll() returns -1; errno = EAGAIN /* poll failed. If the fd was OK, the > > failure may be temporaly, > > as much as poll() can see. > > But most probably we

[PATCHv2 2/7] xread: poll on non blocking fds

2015-12-15 Thread Stefan Beller
The man page of read(2) says: 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