From owner-freebsd-current Tue Aug 12 14:05:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id OAA20214 for current-outgoing; Tue, 12 Aug 1997 14:05:20 -0700 (PDT) Received: from sos.freebsd.dk (sos.freebsd.dk [195.8.129.33]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id OAA20195 for ; Tue, 12 Aug 1997 14:04:57 -0700 (PDT) Received: (from sos@localhost) by sos.freebsd.dk (8.8.7/8.7.3) id XAA01981; Tue, 12 Aug 1997 23:05:08 +0200 (MEST) From: Søren Schmidt Message-Id: <199708122105.XAA01981@sos.freebsd.dk> Subject: Re: Error in sleep ! In-Reply-To: from "[______ ______]" at "Aug 13, 97 00:13:36 am" To: ache@nagual.pp.ru (=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=) Date: Tue, 12 Aug 1997 23:05:08 +0200 (MEST) Cc: current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL30 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk In reply to [______ ______] who wrote: [Charset KOI8-R unsupported, filtering to ASCII...] > 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) Yes but thats not documented anywhere... > > 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. ARG! my gripe was with sleep(_3_), if my process hangs in a sleep (for good reason), and a signal to the process comes along, I want the handler called, and then the sleep should continue. With the new functionality this fails, and I have to put the sleep call in a loop where it gets reiterated until the sleeping period actually has expired. This strikes me as illogical and not very elegant, be it posix or not... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Søren Schmidt (sos@FreeBSD.org) FreeBSD Core Team Even more code to hack -- will it ever end ..