How do you catch a signal without terminating the process ?
der Mouse
mouse at thunder.mcrcim.mcgill.edu
Sat Jun 8 00:51:02 AEST 1991
In article <1991Jun5.215644.20581 at csl.dl.nec.com>, manohar at csl.dl.nec.com (mun o her) writes:
> Server1 = Original Server ( something similar to inetd)
> Server2 = Effective current Server.
> Assume that we are writing a program to implement a concurrent
> server. Assume that Server1 spawns a Server2 when the client wants
> the connection and Server1 goes back to the accept state. When the
> Server2 terminates as a result of the termination of client. The
> Server1 must be notified of its death so that it can execute wait( to
> get rid of zombie of Server2). If Signal Handler is used to catch
> SIGCHLD the accept (Server1) is interrupted
This is normal, or at least not abnormal, depending on your system.
> and the PROBLEM is that the 'whole program' dies.
This is a bug in the server.
> The intention is to resume accept state of Server1. The question is
> How do you PREVENT Server1 from [dying] and resume accept state.
Fix the bug.
There is nothing about SIGCHLD that should kill off the server. I
assume you have set up a handler for SIGCHLD; the handler should wait
for the dead child. (The details of this differ from system to system,
and you don't say what your system is, so I can't elaborate.)
Most likely the code assumes that any error return from accept() should
be fatal. This is the bug; if accept() returns with errno indicating
EINTR, you should simply go back and retry the accept().
If that's not it I'd need more information.
der Mouse
old: mcgill-vision!mouse
new: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.unix.wizards
mailing list