Commit graph

26 commits

Author SHA1 Message Date
Paul Smith
fd1dd7c398 [SV 44555] Use vfork() instead of fork() where available.
Testing has shown that vfork() is actually significantly
more efficient on systems where it's supported, even for
copy-on-write implementations.  If make is big enough,
duplicating the page tables is significant overhead.

* configure.ac: Check for fork/vfork.
* makeint.h: Include vfork.h and set up #define for it.
* os.h, posixos.c (get_bad_stdin): For children who can't use
the normal stdin file descriptor, get a broken one.
* job.c (start_job_command): Avoid so many ifdefs and simplify
the invocation of child_execute_job()
(child_execute_job): move the fork operation here so it can
return early for the parent process.  Switch to use vfork().
* function.c (func_shell_base): Use new child_execute_job() and
simplify ifdefs.
* job.h, main.c, remote-cstms.c, vmsjobs.c, w32os.c: Update
declarations and calls.
2016-03-13 01:12:07 -05:00
Paul Smith
798ebd241b Update Copyright statements for the new year. 2016-02-28 12:55:20 -05:00
John Malmberg
e4ac28e830 Fix bs-nl handling, exit and Environment for VMS.
This fix required a complete rewrite of the command parser vmsjobs.c
child_execute_job.  The old parser had too many incorrect assumptions
about DCL commands and could not be repaired to extended.

The parser now more closely parses VMS commands and handles quoted
commands and redirection.  Command File mode has been improved, but can
not fully support bs-nl syntax.

VMS Unix shell simulation has been improved.

* commands.c: vms_comma_separator is now a run-time setting.
* function.c: vms_comma_separator is now a run-time setting.
* function.c(func_basename_dir) now reports "[]" or "./" based on
  VMS crtl runtime setting.
* job.c(start_job_command): VMS Handle empty commands propery.
* main.c: Add VMS environment variables for run-time settings.
  * vms_legacy_behavior - Force older behavior.
  * vms_comma_separator - Commas or spaces for separators.
  * vms_unix_simulation - Enhanced Posix shell simulation features.
  * Detect if VMS CRTL is set to report Unix paths instead of VMS.
  * ':' and '>' are also MAP_DIRSEP on VMS.
* makeint.h: Add VMS run-time option variables.
* readme.vms: Update to current behavior.
* variable.c(define_variable_in_set): Fix VMS Environment variable
  lookup.
* variable.c(define_automatic_variables): Remove some VMS specific
  automatic variables and use the Unix ones instead.
* vms_export_symbol.c: Set max symbol size correctly.
* vmsjobs.c: child_execute_job() complete rewrite of VMS comand
  parsing.
* vmsjobs.c(build_vms_cmd): VMS commmand building with shell simulation.

Signed-off-by: Paul Smith <psmith@gnu.org>
2015-01-27 21:43:16 -05:00
John Malmberg
894ee7f6c8 [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.
2014-10-20 01:28:46 -04:00
Hartmut Becker
b11bef0bea * job.c: fix make action continuation lines.
* vmsjobs.c: fix writing DCL command files when trimming (white
  spaces and $ signs) especially after a split (command continuation).
2014-09-30 08:12:46 -04:00
Hartmut Becker
dcca1b5b0e Enhance VMS exporting make environment variables.
* config.h-vms.template: add feature macro USE_DCL_COM_FILE to always
write a DCL command file, enabled by default.
* vmsjobs.c: with USE_DCL_COM_FILE enabled write make variables as DCL
symbol assignments into the command file.  This enables printing
directory and make level info for recursive use of make. This also
enables forced DCL symbol substitution in the actions.
2014-09-07 18:10:11 -04:00
Hartmut Becker
98de32a681 Enhance/fix VMS ONESHELL implementation and command execution
* job.c, vmsjobs.c: fix some double quote and new line handling;
implement ONESHELL with writing multiple lines into one DCL command
procedure; in ONESHELL allow VMS/make internal redirection only on the
first line; fix the created DCL command procedure, which didn't abort
on errors; return correct exit status from the DCL command procedure;
preserve current procedure verification; make the generated command
procedure more robust.
2014-09-07 18:01:35 -04:00
Hartmut Becker
8de07f3e4a Enhance/fix VMS exit code handling.
* commands.c, function.c, hash.c, job.c, main.c, output.c:
use MAKE exit codes.
* makeint.h: encode make exit codes so that they are VMS compatible.
* job.c: check child exit code for VMS style exit codes.
* vmsjobs.c: save and return VMS style exit code.
2014-09-07 17:41:59 -04:00
Hartmut Becker
f970315766 Enhance/fix VMS multi-line support.
* job.c: split the command line at a newline.
* default.c, vmsjobs.c: change ECHO variable to a pseudo builtin,
which ensures that the VMS/DCL ECHO ("write sys$output") is used
and is correctly quoted.
* vmsjobs.c: remove unused builtin 'rm'.
2014-09-07 17:40:28 -04:00
Paul Smith
757849cd93 [SV 40361] Don't use vsnprintf(), which is an ISO C99 function.
* output.c (error, fatal, message): Take an extra argument specifying
how many bytes are used by the formatted arguments.
(get_buffer): New function that allocates the requested buffer size.
Remove msc_vsnprintf(), vfmtconcat(), and fmtconcat() as unneeded.
* makeint.h: Declare various helper macros for generating output.
* *.c: Change all error(), fatal(), message() calls to use the macros,
or pass the extra length argument directly.
2013-11-23 22:23:52 -05:00
Paul Smith
c5bfa40044 Support the -Orecurse option properly.
In this mode we still collect all the output from a given target and
dump it at once.  However we don't treat recursive lines any differently
from non-recursive lines.  Also we don't print enter/leave messages
after every dump.  However we do ensure that we always print them once
to stdout, so the parent make will collect it properly.
2013-09-14 01:04:04 -04:00
Paul Smith
4b81f5ca92 Modify the update_status field in struct file to be an enum.
Makes the code a little clearer/cleaner, and solves a problem on systems
where a char is unsigned by default.
2013-07-14 19:18:21 -04:00
Paul Smith
e8f5d322cf Porting to VMS, from Hartmut Becker. 2013-05-27 13:01:48 -04:00
Paul Smith
5370238316 Update copyright for changes in 2013. 2013-05-17 01:47:42 -04:00
Paul Smith
adb50bd4c9 Simplify copyrights using ranges of years.
The new GNU Maintainer's Manual allows the use of year ranges in certain
situations; take advantage of this simplification.
2012-03-05 14:10:39 +00:00
Paul Smith
23c2b99e9d Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.
Fixes Savannah bug #34530.
2012-03-04 00:24:20 +00:00
Paul Smith
3f6bb04e75 Update copyright notices. 2012-01-16 02:29:20 +00:00
Paul Smith
9903cda2a7 Update copyrights for 2010. 2010-07-13 01:20:10 +00:00
Paul Smith
b6f45ddc53 Add VMS enhancements from Hartmut Becker. 2009-11-16 02:31:23 +00:00
Paul Smith
5f188b39a4 Update copyright years. 2009-10-25 18:56:44 +00:00
Paul Smith
891ebd4d97 * Update to GPLv3
* Update copyright to 2007
* Fix download URL for translation files (thanks to Thiemo Seufer)
2007-07-04 19:35:15 +00:00
Paul Smith
f222b19158 Code cleanup: Remove all references to PARAMS() & ansi2knr. 2006-04-07 01:43:44 +00:00
Paul Smith
a6bdc58385 Last of the copyright updates. 2006-02-11 22:16:04 +00:00
Paul Smith
586daef9bc Update copyright and license notices on all files.
Added new file strcache.c to various non-UNIX makefiles and build scripts.
2006-02-11 19:02:21 +00:00
Paul Smith
974d14ac4f Fixes for VMS from Hartmut Becker. 2005-06-10 20:16:28 +00:00
Paul Smith
9d5b5bd2f5 Fix problems with losing tokens in the jobserver, reported by Grant
Taylor.  There are two forms of this: first, it was possible to lose
tokens when using -j and -l at the same time, because waiting jobs were
not checked when determining whether any jobs were outstanding.  Second,
if you had an exported recursive variable that contained a $(shell ...)
function there is a possibility to lose tokens, since a token was taken
but the child list was not updated until after the shell function was
complete.

To resolve this I introduced a new variable that counted the number of
tokens we have obtained, rather than checking whether there were any
children on the list.  I also added some sanity checks to make sure we
weren't writing back too many or not enough tokens.  And, the master
make will drain the token pipe before exiting and compare the count of
tokens at the end to what was written there at the beginning.

Also:
  * Ensure a bug in the environment (missing "=") doesn't cause make to core.
  * Rename the .DEFAULT_TARGET variable to .DEFAULT_GOAL, to match the
    terminology in the documentation and other variables like MAKECMDGOALS.
  * Add documentation of the .DEFAULT_GOAL special variable.

Still need to document the secondary expansion stuff...
2005-05-03 13:57:20 +00:00