From owner-svn-src-all@FreeBSD.ORG Thu Jul 10 16:08:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E2D1A28; Thu, 10 Jul 2014 16:08:13 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBF3229E5; Thu, 10 Jul 2014 16:08:12 +0000 (UTC) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s6AG87kh090356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 Jul 2014 19:08:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s6AG87kh090356 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s6AG87Xu090355; Thu, 10 Jul 2014 19:08:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 10 Jul 2014 19:08:07 +0300 From: Konstantin Belousov To: Baptiste Daroussin Subject: Re: svn commit: r268493 - head/lib/libfetch Message-ID: <20140710160807.GR93733@kib.kiev.ua> References: <201407101304.s6AD4rne079137@svn.freebsd.org> <20140710132813.GQ93733@kib.kiev.ua> <20140710135253.GA93051@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MUSEnV6akQk4QhdD" Content-Disposition: inline In-Reply-To: <20140710135253.GA93051@ivaldir.etoilebsd.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2014 16:08:13 -0000 --MUSEnV6akQk4QhdD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > > >=20 > > > Log: > > > Support EAGAIN in fetch_writev > > > =20 > > > Reviewed by: des > > > Approved by: des > > >=20 > > > Modified: > > > head/lib/libfetch/common.c > > >=20 > > > Modified: head/lib/libfetch/common.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- 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=20 > > > errno =3D 0; > > > pfd.revents =3D 0; > > > if (poll(&pfd, 1, deltams) < 0) { > > > + if (errno =3D=3D EAGAIN) > > > + continue; > > > if (errno =3D=3D EINTR && fetchRestartCalls) > > > continue; > > > return (-1); > >=20 > > How is this error possible ? poll(2) converts EAGAIN from seltdwait(9) > > to no error. >=20 > For posix compliance, libfetch is not only used on FreeBSD, reading at: > http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html I can = read: >=20 > [EAGAIN] > The allocation of internal data structures failed but a subsequent re= quest > may succeed. >=20 > 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 ? --MUSEnV6akQk4QhdD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJTvrpmAAoJEJDCuSvBvK1B+SUP/3M5M5xTFMw7g0FKFFUh4hvC 6z29rB1Lkkl07EIM24nTc0LUHg8thJLi1jNIreN70pDY1gdypp47i96DVPjbJ6go g1o2VIIDVfdDiBcFDsckmr6Iq9FjuzhXAZzclq8ojxghJ6W1aybk7YUymqdYJ14L xePc1EhjVi29+5gOuhpHmM2eAHblkswAuIQTH4GFZRmhRtbYihK2A0OgilQwrw9z SURG336OZ0RNdVHkQNICEDFfn1lNGlqAlbet6TQ4hu2HMx+qGcyuKK2WB9EoUQ2T moTjWfrpiIbhzn1G71YT4vn83qw1cayppjzltoqqOw15FVBLURKmB477IlVxv1d0 0goX6AiXgSAwgxnwuAOkkwxfvZVnNGozplQkUFF7z7RvtQCM6U4l76u/yrBz9VaS VQ8z6kmIUApMFFk1x5r2V3qgIFlnmwhK+B27eFLPgSf7WN0VHVBMRk+Qs0OJsNiO i3ILvKzrcr/kGUAFBy5KstvVO/9ZcjDppnzN2kBcsDsvw51XPtwtqKiFjhXn3UxH C03w+Az+eeWVirTR5jO/kB8L/HR2PlsSRAm0EBpSxL3UlDEec10SkQ02WoNKIz/H cPeJSnXCqAsNa/Z1eBnEqPwcSBJr/dBZS7SDGRNqhOMRecIjbh3TO5Gsnin65Gk+ iOiT2VSIsVBUOoL+rt9V =Mtc7 -----END PGP SIGNATURE----- --MUSEnV6akQk4QhdD--