This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updated handling of signal names and signals for VMS
authorCraig A. Berry <craigberry@mac.com>
Thu, 29 Jun 2006 14:21:35 +0000 (14:21 +0000)
committerCraig A. Berry <craigberry@mac.com>
Thu, 29 Jun 2006 14:21:35 +0000 (14:21 +0000)
p4raw-id: //depot/perl@28448

configure.com
vms/vms.c

index d0a08c5..9b4f08b 100644 (file)
@@ -5110,37 +5110,41 @@ $   d_truncate="define"
 $   d_wait4="define"
 $   d_index="define"
 $   pidtype="pid_t"
-$   sig_name1="ZERO HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM "
-$   sig_name2="TERM ABRT USR1 USR2 SPARE18 SPARE19 CHLD CONT STOP TSTP TTIN TTOU "
-$   sig_name3="DEBUG SPARE27 SPARE28 SPARE29 SPARE30 SPARE31 SPARE32 "
-$   sig_name4="WINCH "
-$   sig_namert="RTMIN RTMAX"
-$   psnwc1="""ZERO"",""HUP"",""INT"",""QUIT"",""ILL"",""TRAP"",""IOT"",""EMT"",""FPE"",""KILL"",""BUS"",""SEGV"",""SYS"","
-$   psnwc2="""PIPE"",""ALRM"",""TERM"",""ABRT"",""USR1"",""USR2"",""SPARE18"",""SPARE19"",""CHLD"",""CONT"",""STOP"",""TSTP"","
-$   psnwc3="""TTIN"",""TTOU"",""DEBUG"",""SPARE27"",""SPARE28"",""SPARE29"",""SPARE30"",""SPARE31"",""SPARE32"","
-$   psnwc4_v7_3="""WINCH"","
-$   psnwcrt="""RTMIN"",""RTMAX"",0"
-$   sig_num1="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 "
-$   sig_num_v7_3="28 "
-$   sig_numrt="33 64"
-$   sig_num_init1="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,6,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,"
-$   sig_num_init_v7_3="28,"
-$   sig_num_initrt="33,64,0"
-$   if (vms_ver .GES. "7.3")
-$   then
-$      sig_name = sig_name1 + sig_name2 + sig_name3 + sig_name4 + sig_namert
-$       sig_name_init = psnwc1 + psnwc2 + psnwc3 + psnwc4_v7_3 + psnwcrt
-$      sig_num = sig_num1 + sig_num_v7_3 + sig_numrt
-$      sig_num_init = sig_num_init1 + sig_num_v7_3 + sig_num_initrt
-$      sig_size="37"
-$   else
-$      sig_name = sig_name1 + sig_name2 + sig_name3 + sig_namert
-$       sig_name_init = psnwc1 + psnwc2 + psnwc3 + psnwcrt
-$      sig_num = sig_num1 + sig_numrt
-$      sig_num_init = sig_num_init1 + sig_num_initrt
-$      sig_size="36"
-$   endif
-$   sig_count="64"
+$   sig_name1="ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE"
+$   sig_name2=" ALRM TERM USR1 USR2 NUM18 NUM19 CHLD CONT STOP TSTP TTIN TTOU DEBUG"
+$   IF (vms_ver .GES. "7.3")
+$   THEN
+$     sig_name2 = sig_name2 + " NUM27 WINCH"
+$   ENDIF
+$!* signal.h defines SIGRTMIN as 33 and SIGRTMAX as 64, but there is no 
+$!* sigqueue function or other apparent means to do realtime signalling,
+$!* so let's not try to include the realtime range for now.
+$!* sig_name3=" NUM29 NUM30 NUM31 NUM32 RTMIN NUM34 NUM35 NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43"
+$!* sig_name4=" NUM44 NUM45 NUM46 NUM47 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58"
+$!* sig_name5=" NUM59 NUM60 NUM61 NUMT62 NUM63 RTMAX"
+$   sig_name = sig_name1 + sig_name2
+$   sig_num = ""
+$   sig_num_init = ""
+$   sig_name_init = ""
+$   sig_index = 0
+$!
+$ PARSE_SIG_NAME_LOOP:
+$!
+$   tmp = F$ELEMENT(sig_index, " ", sig_name)
+$   IF F$LENGTH(F$EDIT(tmp,"TRIM")) .eq. 0 THEN GOTO END_SIG_NAME_LOOP
+$   sig_name_init = sig_name_init + """''tmp'"","
+$   sig_num = sig_num + "''sig_index' "
+$   sig_num_init = sig_num_init + "''sig_index',"
+$   sig_index = sig_index + 1
+$   GOTO PARSE_SIG_NAME_LOOP
+$!
+$ END_SIG_NAME_LOOP:
+$!
+$   sig_name_init = sig_name_init + "0"
+$   sig_num_init = sig_num_init + "0"
+$   sig_size = "''sig_index'"
+$   sig_index = sig_index - 1
+$   sig_count = "''sig_index'"
 $   uidtype="uid_t"
 $   d_pathconf="define"
 $   d_fpathconf="define"
@@ -5515,20 +5519,12 @@ $   THEN
 $       echo4 "Yep, we can."
 $       kill_by_sigprc = "define"
 $!
-$!      since SIGBUS and SIGSEGV indistinguishable, make them the same here.
-$!      sigusr1 and sigusr2 show up in VMS6.2 and later
+$!     Use the same list of signals the CRTL does for recent systems, but cook our own for very old systems.
+$!     Note that the list controls what signals can be caught by name as well as what can be raised via kill().
 $!
-$       if  vms_ver .GES. "6.2"
-$       then
-$           sig_name="ZERO HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM ABRT USR1 USR2"
-$           psnwc1="""ZERO"",""HUP"",""INT"",""QUIT"",""ILL"",""TRAP"",""IOT"",""EMT"",""FPE"",""KILL"",""BUS"",""SEGV"",""SYS"","
-$           psnwc2="""PIPE"",""ALRM"",""TERM"",""ABRT"",""USR1"",""USR2"",0"
-$           sig_name_init = psnwc1 + psnwc2
-$           sig_num="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 16 17"
-$           sig_num_init="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,6,16,17,0"
-$           sig_size="19"
-$          sig_count="17"
-$       else
+$       if  vms_ver .LT. "6.2"
+$      then
+$!          since SIGBUS and SIGSEGV indistinguishable, make them the same here.
 $           sig_name="ZERO HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM ABRT"
 $           psnwc1="""ZERO"",""HUP"",""INT"",""QUIT"",""ILL"",""TRAP"",""IOT"",""EMT"",""FPE"",""KILL"",""BUS"",""SEGV"",""SYS"","
 $           psnwc2="""PIPE"",""ALRM"",""TERM"",""ABRT"",0"
@@ -6280,8 +6276,15 @@ $ WC "sh='MCR'"
 $ WC "shmattype='" + " '"
 $ WC "shortsize='" + shortsize + "'"
 $ WC "shrplib='define'"
-$ WC "sig_name='" + sig_name + "'"
-$ IF (f$length(sig_name_init) .GE. 1024)
+$ IF (f$length(sig_name) .GE. 244)
+$ THEN
+$     tmp = "sig_name='" + sig_name + "'"
+$     WC/symbol tmp
+$     DELETE/SYMBOL tmp
+$ ELSE
+$     WC "sig_name='" + sig_name + "'"
+$ ENDIF
+$ IF (f$length(sig_name_init) .GE. 244)
 $ THEN
 $     tmp = "sig_name_init='" + sig_name_init + "'"
 $     WC/symbol tmp
index 62b17a0..dc97685 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -2163,7 +2163,7 @@ Perl_my_sigaction (pTHX_ int sig, const struct sigaction* act,
    than signalling with an unrecognized (and unhandled by CRTL) code.
 */
 
-#define _MY_SIG_MAX 17
+#define _MY_SIG_MAX 28
 
 static unsigned int
 Perl_sig_to_vmscondition_int(int sig)
@@ -2191,7 +2191,18 @@ Perl_sig_to_vmscondition_int(int sig)
         SS$_ASTFLT,         /* 14 SIGALRM  */
         4,                  /* 15 SIGTERM  */
         0,                  /* 16 SIGUSR1  */
-        0                   /* 17 SIGUSR2  */
+        0,                  /* 17 SIGUSR2  */
+        0,                  /* 18 */
+        0,                  /* 19 */
+        0,                  /* 20 SIGCHLD  */
+        0,                  /* 21 SIGCONT  */
+        0,                  /* 22 SIGSTOP  */
+        0,                  /* 23 SIGTSTP  */
+        0,                  /* 24 SIGTTIN  */
+        0,                  /* 25 SIGTTOU  */
+        0,                  /* 26 */
+        0,                  /* 27 */
+        0                   /* 28 SIGWINCH  */
     };
 
 #if __VMS_VER >= 60200000
@@ -2200,6 +2211,12 @@ Perl_sig_to_vmscondition_int(int sig)
         initted = 1;
         sig_code[16] = C$_SIGUSR1;
         sig_code[17] = C$_SIGUSR2;
+#if __CRTL_VER >= 70000000
+        sig_code[20] = C$_SIGCHLD;
+#endif
+#if __CRTL_VER >= 70300000
+        sig_code[28] = C$_SIGWINCH;
+#endif
     }
 #endif