Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 May 1997 19:41:01 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, peter@spinner.dialix.com
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-lib@FreeBSD.ORG, peter@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/gen usleep.c
Message-ID:  <199705180941.TAA32394@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> POSIX.1 seems to specify returning early from sleep() whenever a signal
>> (of any type) is caught.
>
>Yes, we violated this quite badly.. :-(  Where did the sleep(3) code come 
>from? It looks like it's from Lite-1 and that it's busted there.  Was it in 
>the net-2 code as well?

It is the same in Lite as in FreeBSD-1.1.5.  I assume it is the same in
FreeBSD-1.1.5 as in Net/2.

We must be doing something wrong to require more complications than
glibc.  There are two major versions of sleep() in glibc:

- the Linux version of sleep() just calls nanosleep().  It isn't as
chummy with the implementation as ours - it returns 0 when nanosleep()
returns 0 - the remaining time is not documented to be set in this case.
Both versions are broken when nanosleep() returns EFAULT - the remaining
time is garbage in this case.  Both versions are broken for invalid and
large sleep intervals - nanotime() returns EINVAL and the remaining time
is garbage.

- the POSIX version of sleep() uses alarm().  It returns after sigsuspend()
in all cases (it uses the POSIX sigsuspend() instead of the crufty sigpause()).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705180941.TAA32394>