On Mon, 2012-12-17 at 23:02 +0100, Svante Signell wrote: > On Mon, 2012-12-17 at 20:58 +0100, Richard Braun wrote: > > On Mon, Dec 17, 2012 at 03:12:10AM +0100, Svante Signell wrote: > > > Richards patch "if (!err && got == 0 && firstfd != -1 && (firstfd != > > > lastfd))" does not work, apt-get update (select-based) fails. So there > > > will be other means to avoid the double delay bug. > > > > Please don't mention work I haven't released to explain bugs in your own > > work ... This was untested code which was later replaced. See [1]. > > Sorry, but the stuff above was not my invention. I adopted it before it > was confirmed by you to work properly, sorry again. Still, there are > problems for the poll case by setting the timeout to zero in the > __io_select call. One example is ntpdate (it is now available, see the > debian-devel ML).
As a follow-up the attached patch combines Richards zero timeout for select()-based calls to hurdselect to also work with poll(). One example is ntpdate. The timeout also seems to be OK, maybe further testing needed?. This is a workaround until the split into three cases are ready, and until the poll code is updated. Thanks, Svante
--- a/eglibc-2.13/hurd/hurdselect.c 2012-10-21 22:55:26.000000000 +0200 +++ b/eglibc-2.13/hurd/hurdselect.c 2012-12-18 11:09:58.000000000 +0100 @@ -239,10 +239,10 @@ _hurd_select (int nfds, { int type = d[i].type; d[i].reply_port = __mach_reply_port (); - err = __io_select (d[i].io_port, d[i].reply_port, - /* Poll only if there's a single descriptor. */ - (firstfd == lastfd) ? to : 0, - &type); + if (pollfds) + err = __io_select (d[i].io_port, d[i].reply_port, firstfd == lastfd ? to : 0, &type); + else + err = __io_select (d[i].io_port, d[i].reply_port, 0, &type); switch (err) { case MACH_RCV_TIMED_OUT: @@ -337,6 +337,8 @@ _hurd_select (int nfds, } msg; mach_msg_option_t options = (timeout == NULL ? 0 : MACH_RCV_TIMEOUT); error_t msgerr; + if (pollfds) + to = ((firstfd == lastfd) ? 0 : to); while ((msgerr = __mach_msg (&msg.head, MACH_RCV_MSG | options, 0, sizeof msg, portset, to,