Polling for deferred signals under System Vr2

Jim Rosenberg jr at oglvee.UUCP
Wed Dec 7 05:22:02 AEST 1988


I have a program in which I would like to be immune from signals during
certain critical regions, but I would like to be able to poll periodically to
see if any of a set of signals has come in at any time, including time spent
in the critical region.  Since signal catching is not safe under Vr2 I can't
catch any signals.  It seems to me the following scheme will work and is
perfectly safe:

1.  Set all of the relevant signals for SIG_IGN.

2.  Fork a child.  The child will set all of the relevant signals for SIG_DFL,
then do nothing but sleep until it receives SIGTERM from the parent.

3.  When I wish to poll for whether a signal has arrived I simply kill the
child with signal 0.  This will tell me whether the child is still alive.  If
the child has died for any reason then I will assume a signal has arrived and
take appropriate action, otherwise I will continue what I'm doing.

Note that I don't in any way need to differentiate among signals; all I care
about is whether any of the signals may have arrived.  The program in question
has security implications, so bullet-proofing under the worst signal noise
possible is important.  Obviously this won't allow the parent to detect a
signal "deliberately aimed" directly at it alone, but it should let me detect
the things I'm looking for, e.g. keyboard interrupt, operator SIGTERM, etc.

Comments?  Will this work?
-- 
Jim Rosenberg                        pitt
Oglevee Computer Systems                 >--!amanue!oglvee!jr
151 Oglevee Lane                      cgh
Connellsville, PA 15425                                #include <disclaimer.h>



More information about the Comp.unix.wizards mailing list