[comp.unix.questions] Passing SIGWINCH on from a signal handler

noren@dinl.uucp (Charles Noren) (02/16/90)

We wrote a signal handler to catch the SIGWINCH signal on
a Sun 3 with SunOS 4.0.3.
When we installed it, we found that signal() returns
a NULL the first time it is invoked.  
We were hoping to get the default signal handler for
SIGWINCH so we could use it to have the SunOS do its
normal window processing.
We were wondering if there is a way to pass the
signal on to the SunOS default signal handler after we
process the signal ourselves.
-- 
Chuck Noren
NET:     ncar!dinl!noren
US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260,
         Denver, CO 80201-1260
Phone:   (303) 971-7930

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/16/90)

In article <1525@dinl.mmc.UUCP> noren@dinl.UUCP (Chuck Noren) writes:
: We wrote a signal handler to catch the SIGWINCH signal on
: a Sun 3 with SunOS 4.0.3.
: When we installed it, we found that signal() returns
: a NULL the first time it is invoked.  
: We were hoping to get the default signal handler for
: SIGWINCH so we could use it to have the SunOS do its
: normal window processing.
: We were wondering if there is a way to pass the
: signal on to the SunOS default signal handler after we
: process the signal ourselves.

Sorry, your only option is to admit that you can't handle things
and kill yourself.

Badump-bump.            :-)

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov

gwyn@smoke.BRL.MIL (Doug Gwyn) (02/17/90)

In article <1525@dinl.mmc.UUCP> noren@dinl.UUCP (Chuck Noren) writes:
>When we installed it, we found that signal() returns
>a NULL the first time it is invoked.  

No, you get SIG_DFL.

>We were hoping to get the default signal handler for
>SIGWINCH so we could use it to have the SunOS do its
>normal window processing.

You cannot use the address of kernel code in your process address space.
Besides, it is unlikely that the kernel even establishes a signal handler
function like you're thinking of for the process; much more probably it
handles default actions for signals with special-purpose in-line code.

>We were wondering if there is a way to pass the
>signal on to the SunOS default signal handler after we
>process the signal ourselves.

#include <signal.h>
void application_signal_handler(int sig) {
	...
	// following system call not necessary if the signal state was
	// reset to SIG_DFL upon entry to this function, as required by
	// standards but unlike 4BSD:
	signal(sig, SIG_DFL);
	// repost the signal for this process:
	kill(getpid(), sig);
}