From owner-cvs-lib Sat May 17 23:11:27 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id XAA12648 for cvs-lib-outgoing; Sat, 17 May 1997 23:11:27 -0700 (PDT) Received: from spinner.DIALix.COM (spinner.dialix.com [192.203.228.67]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA12637; Sat, 17 May 1997 23:11:11 -0700 (PDT) Received: from spinner.DIALix.COM (localhost.dialix.com.au [127.0.0.1]) by spinner.DIALix.COM with ESMTP id OAA04447; Sun, 18 May 1997 14:10:47 +0800 (WST) Message-Id: <199705180610.OAA04447@spinner.DIALix.COM> X-Mailer: exmh version 2.0gamma 1/27/96 To: Bruce Evans 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 In-reply-to: Your message of "Sun, 18 May 1997 13:01:28 +1000." <199705180301.NAA20270@godzilla.zeta.org.au> Date: Sun, 18 May 1997 14:10:45 +0800 From: Peter Wemm Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Bruce Evans wrote: > Modified files: > lib/libc/gen usleep.c > Log: > if nanosleep returns too early, loop. usleep() does not have a return > value, it appears as though the semantics of usleep are that it doesn't > return early. (only in the nanosleep code - the setitimer code does this > already) > > Where do those semantics appear? The old behaviour was to return > early. The man page said otherwise, but so does the BSD4.4-Lite man ^^^^^ Are you sure of that? Both sleep() and usleep() do a 'while (!ringring) sigpause(...)'.. To my reading, it won't return early ever... The sleep(3) implementation was the same, it didn't ever return early either as far as I can see. There's no way out except for a longjump from within some other signal handler. My observations of the svr4 libc suggest that it uses alarm() and a sigpause() once and doesn't sit in a while loop.. So, sleep(3) will return early. The svr4 version of usleep() (presumably based on sunos 4.x code) appears to use setitimer and do the same while (!finished) sigpause(..). > page for sleep(3). usleep.3 is a clone of sleep.3 in in BSD4.4-Lite. > Someone fixed the worst bugs in sleep.3 but didn't change usleep.3. > The actual behaviour hasn't changed since 386BSD. It seems to me that somebody cloned the usleep(3) code to replace sleep(3), presumably this was csrg, but I couldn't guess how far back. > Bruce Cheers, -Peter