Re: Q: sys_futex() && timespec_valid()
From: Linus Torvalds
Date: Mon Jun 28 2010 - 11:16:28 EST
On Fri, Jun 25, 2010 at 1:04 PM, Ulrich Drepper <drepper@xxxxxxxxxx> wrote:
> The tv_sec in timespec is of type time_t and for absolute time values the same
> semantics as for naked time_t values applies. The absolute time is
> epoch + tv_sec + tv_nsec / 1000000000
> If tv_sec is negative these are values before epoch.
That's a totally bogus argument.
Ulrich - you're wrong. Go away.
According to that same argument, negative tv_nsec values (or values
above a billion) would also be ok, since that expression would also
give some random value for time. So clearly, the fact that the
expression gives some random value does _not_ in any way mean that we
should accept that random value. Your "argument" isn't an argument at
all, it's just worthless random noise.
The fact is, a negative tv_sec could indeed mean "before the epoch",
but it could equally well (and way more likely) mean "totally buggy
application" or "overflow of a very large positive value".
In the end, it's quite simple: the kernel doesn't accept invalid
timevals. And negative tv_secs are invalid. It's that simple. If
somebody gives the kernel a timeout from before the epoch, that
somebody is being a total idiot. We know it's not a valid absolute
timeout, since there's no way somebody is "waiting" for something that
happened in the sixties.
Yeah, yeah, maybe you're waiting for flower power and free sex. Good
for you. But if you are, don't ask the Linux kernel to wait with you.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/