On 09.09.2005 [19:36:21 -0700], Andrew Morton wrote:
> Nishanth Aravamudan <[email protected]> wrote:
> >
> > + /*
> > + * We compare HZ with 1000 to work out which side of the
> > + * expression needs conversion. Because we want to avoid
> > + * converting any value to a numerically higher value, which
> > + * could overflow.
> > + */
> > +#if HZ > 1000
> > + overflow = timeout_msecs >= jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT);
> > +#else
> > + overflow = msecs_to_jiffies(timeout_msecs) >= MAX_SCHEDULE_TIMEOUT;
> > +#endif
> > +
> > + /*
> > + * If we would overflow in the conversion or a negative timeout
> > + * is requested, sleep indefinitely.
> > + */
> > + if (overflow || timeout_msecs < 0)
> > + timeout_jiffies = MAX_SCHEDULE_TIMEOUT;
>
> Do we need to test (timeout_msecs < 0) here? If we make timeout_msecs
> unsigned long then I think `overflow' will always be correct.
Even though poll is explicitly allowed to take negative values, as per
my man-page:
"#include <sys/poll.h>
int poll(struct pollfd *ufds, unsigned int nfds, int timeout);
...
A negative value means infinite timeout."
Would we have a local variable to store timeout_msecs as well? Or do we
want to make a userspace-visible change like this? I don't have a
preference, I just want to make sure I understand.
Thanks,
Nish
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|