bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7359: sleep 9999999999


From: Eric Blake
Subject: bug#7359: sleep 9999999999
Date: Thu, 11 Nov 2010 08:12:32 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6

On 11/11/2010 01:13 AM, Pádraig Brady wrote:
> On 11/11/10 07:21, Michal Svoboda wrote:
>> Pádraig Brady wrote:
>>>> address@hidden,d1r17733u07 | strace -e nanosleep sleep 9999999999
>>>> nanosleep({9999999999, 0}, NULL)        = 0
>>
>> Just out of curiosity, what's wrong with nanosleep({9999999999, 0} ?
>>
>> The first argument should be time_t, which should not be prone to
>> something stupid like overflowing at 2 (or 4) billion or so.
> 
> Nothing is wrong with it, except that it trips
> up that old 64 bit linux kernel.

To be more precise - that kernel has a bug with nanosleep(-1,NULL).  So
we replace it with a working nanosleep.  However, Windows machines have
a bug with nanosleep(60*60*24*50,NULL), so we replace nanosleep on that
platform as well.  It's easier to have a single nanosleep replacement
for both platforms; therefore, our nanosleep replacement repeatedly
rolls over every 49 days, due to the worst case system we are replacing,
even if the Linux replacement could go the full 9999999999 seconds
without overflow.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]