svn commit: r268493 - head/lib/libfetch
Baptiste Daroussin
bapt at FreeBSD.org
Thu Jul 10 16:10:33 UTC 2014
On Thu, Jul 10, 2014 at 07:08:07PM +0300, Konstantin Belousov wrote:
> On Thu, Jul 10, 2014 at 03:52:53PM +0200, Baptiste Daroussin wrote:
> > On Thu, Jul 10, 2014 at 04:28:13PM +0300, Konstantin Belousov wrote:
> > > On Thu, Jul 10, 2014 at 01:04:53PM +0000, Baptiste Daroussin wrote:
> > > > Author: bapt
> > > > Date: Thu Jul 10 13:04:52 2014
> > > > New Revision: 268493
> > > > URL: http://svnweb.freebsd.org/changeset/base/268493
> > > >
> > > > Log:
> > > > Support EAGAIN in fetch_writev
> > > >
> > > > Reviewed by: des
> > > > Approved by: des
> > > >
> > > > Modified:
> > > > head/lib/libfetch/common.c
> > > >
> > > > Modified: head/lib/libfetch/common.c
> > > > ==============================================================================
> > > > --- head/lib/libfetch/common.c Thu Jul 10 12:41:58 2014 (r268492)
> > > > +++ head/lib/libfetch/common.c Thu Jul 10 13:04:52 2014 (r268493)
> > > > @@ -1110,6 +1110,8 @@ fetch_writev(conn_t *conn, struct iovec
> > > > errno = 0;
> > > > pfd.revents = 0;
> > > > if (poll(&pfd, 1, deltams) < 0) {
> > > > + if (errno == EAGAIN)
> > > > + continue;
> > > > if (errno == EINTR && fetchRestartCalls)
> > > > continue;
> > > > return (-1);
> > >
> > > How is this error possible ? poll(2) converts EAGAIN from seltdwait(9)
> > > to no error.
> >
> > For posix compliance, libfetch is not only used on FreeBSD, reading at:
> > http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html I can read:
> >
> > [EAGAIN]
> > The allocation of internal data structures failed but a subsequent request
> > may succeed.
> >
> > Am I missing something?
>
> At least for me, it was very surprising. I accustomed to the facts that
> poll(2) is never restarted after signal, and that you only should test
> for EINTR as the error condition.
>
> Apparently, the behaviour of converting EAGAIN to no error can be tracked
> back to at least 4.4 lite. On the other hand, just looking into the man
> page for poll(2) on STREAMS-based systems indeed mention EAGAIN.
>
> My suggestion is to add a comment, noting that FreeBSD does not return
> EAGAIN from poll(2), but SUSv4 allows it. This way, the addition would
> be not removed in some code cleanup. Does it sound reasonable ?
More that reasonable (I was thinking something like this as well) I will do it
tomorrow.
regards,
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20140710/4b6e19bf/attachment.sig>
More information about the svn-src-all
mailing list