On Tue, 13 Nov 2001, Paul Davis wrote: > >> i wish there was a way force certain things to happen when a process > >> dies on SIGKILL, though. we can't call shmctl(id,IPC_RMID) on shm > >> segments until we know that no more clients will attempt to connect - > >> i.e. the server is exiting (because a "marked-destroyed" segment > >> cannot be accessed by a new task). thus, i defer this via > >> on_exit(). alas, these are not called if it dies with SIGKILL, and we > >> end up with "persistent" shm segments. sigh. at least i can handle all > >> other signals properly. > > > >Well, its easy to do this. Just have the server do a fork() early at > >startup time, have the new process be the server and the parent just > >waiting on the server and doing necessary cleanup. Just like X does > >with Xwrapper. > > sounds great. except that also means defining some IPC protocol so > that the server can tell the wrapper about shm resources and files > that need to be released, right? they're not in the same address > space.
Well, either allocate all resources before fork() (if possible), or have a resource list in a shm region allocated before fork(). Something along this should be the simplest (rather than setting up another comm via sockets or the like). Richard. -- Richard Guenther <[EMAIL PROTECTED]> WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/ The GLAME Project: http://www.glame.de/
