summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorJohn Malmberg <wb8tyw@gmail.com>2009-01-04 12:42:07 -0600
committerCraig A. Berry <craigberry@mac.com>2009-01-04 21:31:36 -0600
commite08e1e1d056fc71c85ae29ec7e82ba2b6320e6e4 (patch)
tree641cec45bf6aa05d60a9cff7e6ebaba4d968c4b4 /perl.h
parentef3a38ffad701e4f5a98a0a1f84c7e2e8c3da11e (diff)
downloadperl-e08e1e1d056fc71c85ae29ec7e82ba2b6320e6e4.tar.gz
VMS posix exit fixes
perl.h and perl.c need further fixes to get VMS to return the expected POSIX exit codes when that is enabled. This fix gets the correct numbers except for the SIGTERM case, which will need some more work. It also gets the posix exit code to set an error severity on a fatal exit so that DCL and MMS/MMK or VMS native programs can easily detect a script failure. This patch does not address an issue in vms.c where the feature logicals may not be correctly read. That will follow in a future patch. The tests have been adjusted to detect when VMS is in the POSIX exit mode and perform properly. -John wb8tyw@gmail.com -- My qsl.net e-mail address is temporarily out of order.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h55
1 files changed, 28 insertions, 27 deletions
diff --git a/perl.h b/perl.h
index 13de9050e7..45d0e1d9ba 100644
--- a/perl.h
+++ b/perl.h
@@ -2933,11 +2933,11 @@ typedef pthread_key_t perl_key;
} STMT_END
/* STATUS_UNIX_EXIT_SET - Takes a UNIX/POSIX exit code and sets
- * the NATIVE error status based on it. It does not assume that
- * the UNIX/POSIX exit codes have any relationship to errno, except
- * that 0 indicates a success. When in the default mode to comply
- * with the Perl VMS documentation, any other code sets the NATIVE
- * status to a failure code of SS$_ABORT.
+ * the NATIVE error status based on it.
+ *
+ * When in the default mode to comply with the Perl VMS documentation,
+ * 0 is a success and any other code sets the NATIVE status to a failure
+ * code of SS$_ABORT.
*
* In the new POSIX EXIT mode, native status will be set so that the
* actual exit code will can be retrieved by the calling program or
@@ -2951,30 +2951,31 @@ typedef pthread_key_t perl_key;
STMT_START { \
I32 evalue = (I32)n; \
PL_statusvalue = evalue; \
- if (evalue != -1) { \
- if (evalue <= 0xFF00) { \
- if (evalue > 0xFF) \
- evalue = (evalue >> child_offset_bits) & 0xFF; \
- if (evalue == 0) \
- PL_statusvalue_vms == SS$_NORMAL; \
- else \
- if (MY_POSIX_EXIT) \
- PL_statusvalue_vms = \
- (C_FAC_POSIX | (evalue << 3 ) | \
- ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \
- else \
- PL_statusvalue_vms = SS$_ABORT; \
- } else { /* forgive them Perl, for they have sinned */ \
- if (evalue != EVMSERR) PL_statusvalue_vms = evalue; \
- else PL_statusvalue_vms = vaxc$errno; \
- /* And obviously used a VMS status value instead of UNIX */ \
- PL_statusvalue = EVMSERR; \
- } \
- } \
- else PL_statusvalue_vms = SS$_ABORT; \
- set_vaxc_errno(PL_statusvalue_vms); \
+ if (MY_POSIX_EXIT) { \
+ if (evalue <= 0xFF00) { \
+ if (evalue > 0xFF) \
+ evalue = (evalue >> child_offset_bits) & 0xFF; \
+ PL_statusvalue_vms = \
+ (C_FAC_POSIX | (evalue << 3 ) | \
+ ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \
+ } else /* forgive them Perl, for they have sinned */ \
+ PL_statusvalue_vms = evalue; \
+ } else { \
+ if (evalue == 0) \
+ PL_statusvalue_vms = SS$_NORMAL; \
+ else if (evalue <= 0xFF00) \
+ PL_statusvalue_vms = SS$_ABORT; \
+ else { /* forgive them Perl, for they have sinned */ \
+ if (evalue != EVMSERR) PL_statusvalue_vms = evalue; \
+ else PL_statusvalue_vms = vaxc$errno; \
+ /* And obviously used a VMS status value instead of UNIX */ \
+ PL_statusvalue = EVMSERR; \
+ } \
+ set_vaxc_errno(PL_statusvalue_vms); \
+ } \
} STMT_END
+
/* STATUS_EXIT_SET - Takes a NATIVE/UNIX/POSIX exit code
* and sets the NATIVE error status based on it. This special case
* is needed to maintain compatibility with past VMS behavior.