$ nv_preserves_uv_bits = tmp
$ ENDIF
$!
-$ echo4 "Checking whether your kill() uses SYS$FORCEX..."
+$ echo4 "Checking if kill() uses SYS$FORCEX or can't be called from a signal handler..."
$ kill_by_sigprc = "undef"
$ OS
$ WS "#include <stdio.h>"
$ WS "#include <signal.h>"
$ WS "#include <unistd.h>"
-$ WS "void handler(int s) { printf(""%d\n"",s); } "
+$ WS "void handler1(int s) { printf(""%d"",s); kill(getpid(),2); }"
+$ WS "void handler2(int s) { printf(""%d"",s); }"
$ WS "main(){"
$ WS " printf(""0"");"
-$ WS " signal(1,handler); kill(getpid(),1);"
+$ WS " signal(1,handler1);"
+$ WS " signal(2,handler2);"
+$ WS " kill(getpid(),1);"
+$ WS " sleep(1);"
+$ WS " printf(""\n"");"
$ WS "}"
$ CS
$ ON ERROR THEN CONTINUE
$ GOSUB compile
-$ IF tmp .NES. "01"
+$ IF tmp .NES. "012"
$ THEN
-$ echo4 "Yes, it does."
-$ echo4 "Checking whether we can use SYS$SIGPRC instead"
+$ echo4 "Yes, it has at least one of those limitations."
+$ echo4 "Checking whether we can use SYS$SIGPRC instead..."
$ OS
$ WS "#include <stdio.h>"
$ WS "#include <lib$routines.h>"
#ifdef KILL_BY_SIGPRC
#include <errnodef.h>
-/* okay, this is some BLATENT hackery ...
- we use this if the kill() in the CRTL uses sys$forcex, causing the
+/* We implement our own kill() using the undocumented system service
+ sys$sigprc for one of two reasons:
+
+ 1.) If the kill() in an older CRTL uses sys$forcex, causing the
target process to do a sys$exit, which usually can't be handled
gracefully...certainly not by Perl and the %SIG{} mechanism.
- Instead we use the (undocumented) system service sys$sigprc.
- It has the same parameters as sys$forcex, but throws an exception
+ 2.) If the kill() in the CRTL can't be called from a signal
+ handler without disappearing into the ether, i.e., the signal
+ it purportedly sends is never trapped. Still true as of VMS 7.3.
+
+ sys$sigprc has the same parameters as sys$forcex, but throws an exception
in the target process rather than calling sys$exit.
Note that distinguishing SIGSEGV from SIGBUS requires an extra arg