From owner-freebsd-current Tue Aug 12 13:13:48 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id NAA16564 for current-outgoing; Tue, 12 Aug 1997 13:13:48 -0700 (PDT) Received: from lsd.relcom.eu.net (ache@lsd.relcom.eu.net [193.124.23.23]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA16551 for ; Tue, 12 Aug 1997 13:13:45 -0700 (PDT) Received: (from ache@localhost) by lsd.relcom.eu.net (8.8.7/8.8.7) id AAA27653; Wed, 13 Aug 1997 00:13:38 +0400 (MSD) Date: Wed, 13 Aug 1997 00:13:36 +0400 (MSD) From: =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= X-Sender: ache@lsd.relcom.eu.net To: =?KOI8-R?Q?S=F8ren_Schmidt?= cc: current@FreeBSD.ORG Subject: Re: Error in sleep ! In-Reply-To: <199708121948.VAA01292@sos.freebsd.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=KOI8-R Content-Transfer-Encoding: 8BIT Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 12 Aug 1997, Søren Schmidt wrote: > Well to quote sleep(1): > The sleep command suspends execution for a minimum of seconds. sleep is > used to schedule the execution of other commands (see EXAMPLES below). > > The sleep utility exits with one of the following values: > > 0 On successful completion, or if the signal SIGALRM was received. > > >0 An error occurred. > > This is not how our sleep(1) functions!, it'll exit on the first signal > it gets, because of the change in sleep(3)'s behavior.... Your quote says nothing about /bin/sleep signals handling, only about exit codes. When signal != SIGALRM comes sleep exit with exit code >=0 (An error occured) Here is quote from Solaris manpage (their manpages usually better than ours :-) SunOS 5.5.1 Last change: 1 Feb 1995 1 NOTES If the sleep utility receives a SIGALRM signal, one of the following actions will be taken: +o Terminate normally with a zero exit status. +o Effectively ignore the signal. The sleep utility will take the standard action for all other signals. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Now one has to encapsulte sleep(3) in a while loop to get it to > actually sleep the specified time, thats plain an simple stupid, > and also poses a risk for busy looping, a complete no-no i an > *IX system... You can complain to POSIX commetee. BTW, it is strange for me 1) Why sleep must be different than, say, cat which exits on signal coming... 2) Why you send signals to sleep, if you want to sleep specified time. Even if you do such nasty things, use 'trap' to block signals before sleep. -- Andrey A. Chernov http://www.nagual.pp.ru/~ache/