Re: {sys_,/dev/}epoll waiting timeout

From: Jamie Lokier (jamie@shareable.org)
Date: Thu Jan 23 2003 - 13:28:31 EST


Mark Mielke wrote:
> Or, fix sys_poll(). With the +1, this means that sys_poll() would have
> a 1 in 1001 chance per second of returning one jiffie too early.

Nope. Read the expression again.

> > poll(2) takes an int, but sys_poll() takes a long.
> > I think everyone is confused :)
> > The reason I suggested "long timeout" for ep_poll is because the
> > multiply in the expression:
> > jtimeout = (unsigned long)(timeout*HZ+999)/1000;
> > can overflow if you don't. If you stick with the int, you'll need to
> > write:
> > jtimeout = (((unsigned long)timeout)*HZ+999)/1000;
>
> On a 16 bit platform, perhaps... :-)

Nope. It will overflow on a _64_ bit platform, if you give it a value
of MAXINT for example.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jan 23 2003 - 22:00:32 EST