diff options
author | John Malmberg <wb8tyw@qsl.net> | 2014-09-13 20:20:22 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2014-10-20 01:28:46 -0400 |
commit | 894ee7f6c8b96ed89d4672da6cde4105c15cbf31 (patch) | |
tree | 1d10c4e86225e29358467266a4eb8b8e9a9ade1a /job.c | |
parent | e75662bc6a96571f041bdad799eb557ff580135c (diff) | |
download | gunmake-894ee7f6c8b96ed89d4672da6cde4105c15cbf31.tar.gz |
[SV 42447]: VMS simulate exporting symbols
This also includes fixing the most of the exit handling code for VMS.
Self tests:
Previously about 94 Tests in 36 categories fail.
Now about 45 tests in 22 categories fail.
Because some tests do not properly clean up, the number of tests that
fail can vary by one or two test cases between consecutive runs.
* Makefile.am: Add new VMS files.
* job.c: add prototype for vms_strsignal().
* job.c: (child_error): Remove VMS specific code as no longer needed.
* job.c: (reap_children): The VMS specific code was setting the
status to 0 instead of setting it to the proper exit status.
* job.h: Add vms_launch_status to struct child.
* main.c: (main): Use environment variables for options to use MCR
* instead of a foreign command, and to always use command files for
subprocesses.
For VMS use (set_program_name) routine which is common to ports of
other GNU packages to VMS to set the program name used internally.
Use (vms_putenv_symbol) to set up symbols to be visible in child
programs, including recursive make launched by execve()
Start of Bash shell detection code for VMS.
* makefile.com: Need nested_include=none for building on VMS search
lists. Add vms_progname, vms_exit, and vms_export_symbol.
* makefile.vms: Need nested_include=none for building on VMS search
lists. Add vms_progname, vms_exit, vms_export_symbol.
* makeint.h: Make sure non-standard "VMS" macro is defined. Add
prototypes for new VMS routines. Remove VMS-specific failure codes.
* vmsjobs.c: Add VMS POSIX exit code constants.
(_is_unixy_shell): Detect Bash shell.
(vms_strsignal): simulate strsignal() on VMS.
(vmsHandleChildTerm): fix to properly report failed LIB$SPAWN() exit
status codes. Remove code that duplicated code in job.c.
(child_execute_job): Export environment symbols before spawning a
child and restore afterward unless option to use command files for
subprocesses is set. Improve handling of UNIX null commands ":".
* vms_exit.c: Provides vms_exit() to detect if an exit code is UNIX
or VMS, and converts the UNIX code into a VMS exit code.
* vms_export_symbol.c: Routines to create DCL symbols that work like
shell aliases or exported shell symbols and clean them up on exit.
* vms_export_symbol_test.com: Unit test for vms_export_symbol.c
* vms_progname.c: New file: VMS specific replace for progname.c that
is used in some GNU projects.
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -59,9 +59,21 @@ int batch_mode_shell = 0; #elif defined (VMS) # include <descrip.h> +# include <stsdef.h> const char *default_shell = ""; int batch_mode_shell = 0; +#define strsignal vms_strsignal +char * vms_strsignal (int status); + +#ifndef C_FACILITY_NO +# define C_FACILITY_NO 0x350000 +#endif +#ifndef VMS_POSIX_EXIT_MASK +# define VMS_POSIX_EXIT_MASK (C_FACILITY_NO | 0xA000) +#endif + + #elif defined (__riscos__) const char *default_shell = ""; @@ -504,21 +516,6 @@ child_error (struct child *child, l += strlen (pre) + strlen (post); -#ifdef VMS - if ((exit_code & 1) != 0) - { - OUTPUT_UNSET (); - return; - } - /* Check for a Posix compatible VMS style exit code: - decode and print the Posix exit code */ - if ((exit_code & 0x35a000) == 0x35a000) - error(NILF, l + INTSTR_LENGTH, _("%s[%s] Error %d%s"), pre, f->name, - ((exit_code & 0x7f8) >> 3), post); - else - error(NILF, l + INTSTR_LENGTH, _("%s[%s] Error 0x%x%s"), pre, f->name, - exit_code, post); -#else if (exit_sig == 0) error (NILF, l + INTSTR_LENGTH, _("%s[%s] Error %d%s"), pre, f->name, exit_code, post); @@ -528,7 +525,6 @@ child_error (struct child *child, error (NILF, l + strlen (s) + strlen (dump), _("%s[%s] %s%s%s"), pre, f->name, s, dump, post); } -#endif /* VMS */ OUTPUT_UNSET (); } @@ -678,8 +674,17 @@ reap_children (int block, int err) if (any_local) { #ifdef VMS + /* Todo: This needs more untangling multi-process support */ + /* Just do single child process support now */ vmsWaitForChildren (&status); pid = c->pid; + + /* VMS failure status can not be fully translated */ + status = $VMS_STATUS_SUCCESS (c->cstatus) ? 0 : (1 << 8); + + /* A Posix failure can be exactly translated */ + if ((c->cstatus & VMS_POSIX_EXIT_MASK) == VMS_POSIX_EXIT_MASK) + status = (c->cstatus >> 3 & 255) << 8; #else #ifdef WAIT_NOHANG if (!block) |