Ok, here is what I have. I changed nano sleep to use a local 64-bit value for the target expire time in jiffies. As much as MAX-INT/2-1 will be put in the timer at any one time. It loops till the target time is met or exceeded. The changes affect (clock)nanosleep only and not timers (they still error out for large values). I now use the simple u64=(long long) a * b for the mpy so I have dropped the sc_math.h stuff (I will bring that round again :). What do you think? Oh, the code passes the tests I have, but I have not tried to test for very large sleep times. -g Linus Torvalds wrote: > On Tue, 11 Mar 2003, Felipe Alfaro Solana wrote: > >> >>why not sleep(0)? > > > I think a much more likely (and correct) usage for big sleep values is > more something like this: > > do_with_timeout(xxx, int timeout) > { > struct timespec ts; > > ... set up some async event .. > ts.tv_nsec = 0; > ts.tv_sec = timeout; > while (nanosleep(&ts, &ts)) { > if (async event happened) > return happy; > } > .. tear down the async event if it didn't happen .. > } > > and here the natural thing to do in user space is to just make the "no > timeout" case be a huge value. > > At which point it is a _bug_ in the kernel if we return early with some > random error code. > > Linus > > -- George Anzinger george@mvista.com High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml