Subject: Re: The right place for doshutdownhooks()
To: None <perry@piermont.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 11/20/1995 09:58:02
On Mon, 20 Nov 1995 10:17:29 -0500 
 "Perry E. Metzger" <perry@piermont.com> wrote:

 > Now I'm utterly convinced. The console has to be special cased in the
 > shutdown hook architecture, assuming it is ever necessary to halt
 > it. It cannot be done as part of the ordinary shutdown handlers simply
 > because they have no ordering constraints. It must be done as a
 > separate step.

The console is a tricky item.  By it's very nature, it has to be the 
first device initialized, and the very last to be disabled, if ever.  We 
already special case the console at boot - otherwise we'd never see the 
results of "printf(copyright);".  Systems like Suns have it a little 
easier - they can use PROM routines to print to the console until they 
can determine what the console is, and they get told what the console is 
by the PROM.  However, systems like the hp300 and i386 don't have this 
luxury.  (Well, the hp300 _sort_ of does, but it has to know about all 
devices before consinit(), which is somewhat less than optimal.  But at 
least there's a hardware mechanism, the remote bit on serial ports, to 
determine the console priority.)

 > > In what circumstance is it useful to have a shutdown hook disable
 > > the console?
 > 
 > In theoretical circumstances :-)
 > 
 > However, I understand Greg's desire to have the architecture be
 > clean should it ever come up.

If we're going to have a shutdown hook for the console, then it basically 
has to be a special case, just like consinit() (maybe consdeinit()?).  
For port that need to use it, they can certainly do it _after_ all 
messges that need to be displayed have been displayed.  (i.e. right 
before the infinite loop, or right before the cpu gets reset, etc.)

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939