From owner-cvs-lib Sun May 18 02:51:12 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA22584 for cvs-lib-outgoing; Sun, 18 May 1997 02:51:12 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA22572; Sun, 18 May 1997 02:50:52 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id TAA32394; Sun, 18 May 1997 19:41:01 +1000 Date: Sun, 18 May 1997 19:41:01 +1000 From: Bruce Evans Message-Id: <199705180941.TAA32394@godzilla.zeta.org.au> To: bde@zeta.org.au, peter@spinner.dialix.com Subject: Re: cvs commit: src/lib/libc/gen usleep.c Cc: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-lib@FreeBSD.ORG, peter@FreeBSD.ORG Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> 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