Subject: Re: The right place for doshutdownhooks()
To: Greg Hudson <ghudson@MIT.EDU>
From: Perry E. Metzger <firstname.lastname@example.org>
Date: 11/20/1995 00:04:21
Greg Hudson writes:
> So, after it was expressed that doshutdownhooks() was allegedly in the
> wrong place in arch/i386/machdep.c, I took a look at the code I
> checked in. Currently, in the i386 port doshutdownhooks() is run
> after the key is pressed for "press any key to reboot" (if it's a
> halt), and after a dump (if any). In the alpha port,
> doshutdownhooks() is run after a dump (if any) but before a key is
> pressed for "press any key to reboot".
> I discussed this with mycroft, and I think the i386 port actually has
> the right idea:
> * In all cases, the shutdown handlers will actually get run,
> unless the machine's power is reset, in which case you don't
If my floppy drive has been spinning for an hour, thats clearly not
acceptable. There is no way to know how long it will take for the user
to hit a key, by which time the damage may have been long since
done. All sorts of things can have been left in bad states.
The message printed in boot.c says that the machine is down. That
means that THE MACHINE IS DOWN. Both aesthetically and for pragmatic
reasons the operating system must do nothing else after that point but
wait for a key and then call cpu_reset() -- all work must be completed
before the wait for the keypress. The shutdown hooks have to have been
run before this point so that the machine can be considered down. The
Alpha port is right. The i386 port is wrong.
> * The shutdown handlers might actually shut down the console
> driver in some circumstances, rendering it impossible for
> the user to press a key.
What would the point of shutting down the console driver only to have
the machine reboot again in a moment be? The answer to this question
is simple -- don't shut down the console driver with shutdown hooks on
ports that go into a loop in order to fake a halt.
> Disagreements? Thoughts?
I disagree in the strongest possible terms, and think that the
shutdown hooks have to be moved.