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

Jamie Lokier (jamie@shareable.org)
Thu, 23 Jan 2003 18:28:31 +0000


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/