Does anyone have a vnews for 4.2bsd?

John Nelson john at genrad.UUCP
Sat Jan 14 00:51:53 AEST 1984


A "signal" system call is provided in the standard library for 4.2BSD
(look in section 3C - compatibility library)  The differences between
this signal and the old signal are twofold:

1.  The signal trapping routine is NOT reset to the default: each handler
    must do this explicitly if it is the desired action

2.  When the signal handler routine is invoked, the signal MASK bit is
    set for that signal (see sigblock/sigsetmask).  Additional signals
    of the same type that invoked the handler routine will be blocked
    until the handler returns (or longjmps, or explicitly resets the mask)

Neither of these incompatibilities is insurmountable if you have the
source code.  In fact, in the programs I have been converting to 4.2,
the most common problem is that of a SIGTSTP handler which resets the
terminal parameters, and then kill's itself with SIGTSTP.  The routine
below fixes the problem:

tstp_catcher() {
	/* I am called to catch tstp and fix the tty mode before stopping */
	stty(1, &old_tty_parameters);
	signal(SIGTSTP, SIG_DFL);
#ifdef BSD4_2
	/* clear SIGTSTP mask bit */
	sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1)));
#endif
	kill(0, SIGTSTP);

	/* execution resumes here on a SIGCONT */
	stty(1, &new_tty_parameters);
}



More information about the Comp.unix.wizards mailing list