[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Shutdown error



Peter Slegg wrote:

> On Fri, 6 Aug 2010 13:11:11 , Helmut Karlowski <helmut.karlowski@ish.de> wrote:
> >
> > Damn! I had to redo some shutdown-stuff. There's still a problem, I will
> > describe later.
> >
> > So I've uploaded a new binary ..
> >
> > Tell me if it works :)
> >
> > -Helmut
>
>
> That seems to be ok as well.

Good. So here's what happens:

1. shutdown sends SIGTERM to most processes including the one started by
mint.cnf (GEM=, INIT=). When this process exits, the loop in init.c is
terminated, and shutdown is started (again).

So I prevented shutdown to send SIGTERM to GEM, and some other processes
that could be INIT. In xaloader (and XaAES) SIGTERM is ignored, so this
is no problem. Now also the process with pid 1 is not terminated by shutdown.

A previous version used ppid==0 but this is valid for some more
processes. Another one used a flag (that's Peters version) wich also
works but pid 1 is much simpler.


2. Another issue I encountered is when shutdown calls yield (I assume to
give SIGTERMed processes time to exit) that maybe they use resources
that do not exist anymore because other processes already exited
(theory). At least a (korn-) shell started by toswin and running e.g.
top when Halt is selected would crash because it ignores the SIGTERM.

So I removed the yield() and no crash occures. I'm not 100% sure if this
is a perfect solution.

(diffs is attached - should I commit this as is to trunk?)

-Helmut


Attachment: diffs
Description: Binary data