Re: Core dumps & restarting

Eric W. Biederman (ebiederm@cse.unl.edu)
28 Oct 1996 20:36:47 -0600


>>>>> "Eduardo" == Eduardo Diaz Comellas <miedu@ryot.excelia.org> writes:

Eduardo> -----BEGIN PGP SIGNED MESSAGE-----
Eduardo> Hi!

Eduardo> I was wandering how to stop a process, reboot the machine, and
Eduardo> restart that process. Is there a way to provoke a program to dump
Eduardo> itself, and restart it after the reboot?

Eduardo> Maybe we can define a new executable format for it to work ;-)

Eduardo> Cheers!

This is a wee bit hard to do in general because each process has some
kernel state associated with it. Open file descriptors and such.
Consider trying to restart a process that had unlinked one of it's
files, but it is still using it. Or perhaps how do you save a command
like: cat file | gzip -9 -c | uuencode name | mail... It's possilble
perhaps even desirable but it quite a bit of work to implement
_generally_.

However if you have an application that you want to do this for it
shouldn't be too much trouble (assuming you start from scratch). Just
mmap a state file, and do all you memory allocation in that file. And
take special care to remember which files you have open, and store
that information as well, so it can be restored when you restart you
application. And just write a special save state, and restore state
routines. Some X window managers encourage this kind of self state
saving.

Eric