[comp.os.msdos.programmer] SIGNAL Inconsistancy Question

johnv@metaware.metaware.com (John Vinopal) (07/25/90)

	I'm playing with signal() on several systems.  Anyone have
	a quick answer why TC++ 1.0 chooses to define SIGABRT as 22
	while most other systems use 6?  And why does Microsoft and
	Turbo reset the signal handler after one call?  

					johnv@metaware.com

imp@dancer.Solbourne.COM (Warner Losh) (07/25/90)

: And why does Microsoft and
: Turbo reset the signal handler after one call?  

Everybody does this.  If you want to reenable your handler, you must do
it yourself in the handler routine.

Warner
--
Warner Losh		imp@Solbourne.COM
Boycott Lotus.		#include <std/disclaimer>

shurr@cbnews.att.com (Larry A. Shurr) (07/26/90)

In article <548@metaware.metaware.com> johnv@metaware.UUCP (John Vinopal) writes:
>	I'm playing with signal() on several systems.  Anyone have
>	a quick answer why TC++ 1.0 chooses to define SIGABRT as 22
>	while most other systems use 6?  And why does Microsoft and
>	Turbo reset the signal handler after one call?  

OK, I don't speak for Borland, these are my speculations, but...

SIGABRT may be defined as other-than-6 in an effort to avoid conflict with 
the signal number assignments used in UNIX as they (Borland) understood them.
The other signals they define in signal.h match their Unix counterparts
whereas SIGABRT does not.  However, SIGABRT is new.  My not-necessarily-up-
to-date Programmer's Reference Manual shows no SIGABRT definition, but does
show that SIGIOT is defined with the value 6.  iHowever, a quick peek at
/usr/include/sys/signal.h shows both SIGIOT and SIGABRT defined as 6 with
a comment for SIGABRT of "/* used by abort, replace SIGIOT in the future */."

So Borland may have thought they were avoiding conflicting with "the stan-
dard."  If so, we know they failed, but they failed not once, but twice 
because 22 is the value of SIGPOLL, supported by the relatively new STREAMS 
device driver interface to signal STREAMS I/O events pending... oops.

As for your second question, MSoft and Borland are almost certainly emulating
the signal(2) interface as defined in Unix.  If a signal handler is set by 
using signal(), the signal action reverts to SIG_DFL when the handler is
called.  In order to have your signal handler remain as the selected action 
instead of being reset, you must use the newer (Release 3) sigset(2) 
interface.

regards, Larry
-- 
Larry A. Shurr (cbnmva!las@att.ATT.COM or att!cbnmva!las)
The end of the world has been delayed due to a shortage of trumpet players.
(The above reflects my opinions, not those of AGS or AT&T, but you knew that.)