Commit Graph

47 Commits

Author SHA1 Message Date
sommerfeld 46608f023e bin/12734: fix SIGTSTP/SIGCONT handling.
- install SIGCONT handler which reestablishes SIGTSTP handler and then calls
JobRestartJobs() to restart all the suspended jobs.
 - when SIGTSTP is handled, call JobCatchChildren() so *** Suspended messages
get printed before make stops rather than after.
2001-05-01 03:27:50 +00:00
christos bda102d681 PR/11800: Chris Demetriou: Add -W flag to exit on parse warnings.
While I am here, s/make:.*"/%s:\1", progname/
2001-01-10 15:54:00 +00:00
sommerfeld 3274266e5f Delete forceSerial; just use compatMake for that.
Add -N flag to *really* not execute any commands (useful when using
the -d flags to debug usr/src/Makefile)
Document -N
Update documentation of -n to mention that it still executes commands
for targets marked .MAKE so that the -N/-n distinction is clear.
2001-01-01 15:47:37 +00:00
sommerfeld 1ef47ae656 Include token counts in trace output.
Don't let tokensFree go negative.
2000-12-30 16:38:22 +00:00
sommerfeld dd9c50102d Fix token accounting for .BEGIN/.END jobs 2000-12-30 15:58:34 +00:00
sommerfeld 663ff035b1 Avoid token leaks when aborting after an error. 2000-12-30 14:21:22 +00:00
sommerfeld 9984263e63 Do lazy token release - don't return tokens to the pipe unless we're
waiting for something or we're done.
2000-12-30 02:51:21 +00:00
sommerfeld a804073cac Add a token-passing scheme to allow a recursive make to successfully
use -j; all make's in a recursive build cooperate to limit the total
number of jobs, using a token-passing scheme.

The current token passing algorithm is similar to the one implemented
by gmake; there is a single pipe which is inherited through the entire
process hierarchy; tokens are obtained by reading a byte from the
"read end" of the pipe, and are returned by writing them to the "write
end".  This exact algorithm is likely to change in the future.

Implementation details:
 - Use the new trace facility to allow measurement of the
effectiveness of different token-passing schemes
 - Get a token in MakeStartJobs(), return it in Make_Update()
 - Eliminate Job_Full() and the jobFull global since they are
redundant with token system.
 - Add an "internal" -J option (to pass the token pipe fd's down to
submakes) and a -T option for tracing.
 - Change how compatMake is forced so that -j means something when
inherited by submakes.
 - When waiting for a token, poll the token-passing pipe as well as
the output pipes of existing jobs.
2000-12-30 02:05:20 +00:00
mycroft b91d3efb9a Make the fds[] realloc O(n). Also make the rethreading a lot simpler. 2000-12-05 21:57:20 +00:00
sommerfeld e3f68e5130 Make clearfd() take O(1) time instead of O(N) by moving only the last
job in the arrays to the hole made by the now-dead job.  No
measureable performance difference for -j4, but the code is simpler
this way.
2000-12-05 15:28:55 +00:00
sommerfeld b5e2403ec9 correct performance regression of recent change from select() to
poll() for parallel make:
 - Make the poll() code behave more like the select() code: sleep for
a bit waiting for output rather than busy-wait (eww).
 - Install a no-op SIGCHLD handler so that poll/select wake up early
(with -1/EINTR) when a child exits.
 - Change the default sleep time from 500ms to 5 seconds since we now
wake up promptly when a child exits.
2000-12-05 15:20:10 +00:00
christos 8ba1720b96 mycroft did not like my O(n^2) lookup algorithm, so I made things much
more complicated.
2000-12-04 17:45:17 +00:00
christos 105cc20925 1. switch to using poll by default; can be overriden by compiling with
-DUSE_SELECT
2. make sure that we don't overrun our allocated fd_set if USE_SELECT is defined
2000-12-03 02:19:32 +00:00
christos 9a19da76d7 1. the tfile patch was incorrect. If we are doing multiple jobs, we
try to open tfile many times, passing bad strings to mkstemp
2. remove extra semicolon after the MESSAGE macro
3. more error checking
4. be more careful about setting things to NULL after freeing.
5. fix a comment that does not apply anymore
2000-12-03 01:27:03 +00:00
sjg 0828d668af Changes to make MAKEOBJDIRPREFIX useful.
Firstly, we ignore getenv("PWD") if MAKEOBJDIRPREFIX is set so that we always
get the same value for .CURDIR regardless of how make was invoked.

Second, when executing a command we check if it is ${.MAKE} or ${.MAKE:T}
without a preceeding chdir, if so we insert a chdir(${.CURDIR}) so that
the Makefile will be found by the child make.  Note that this behaviour is
dissabled if MAKEOBJDIRPREFIX is not set or if NOCHECKMAKECHDIR is set.
See the comments in main.c for more detail.

With these two changes, one can successfully build usr/src using MAKEOBJDIRPREFIX
allowing the src to be mounted from a CD-ROM.
2000-04-20 11:23:25 +00:00
mycroft f5d7100e26 Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.
2000-01-21 17:08:33 +00:00
christos 4cd25afac7 Create temporary files carefully, to avoid security problems. Idea borrowed
from the botched FreeBSD implementation...
2000-01-19 23:39:37 +00:00
mycroft dd291116bc Don't bother iterating through all the data structures to free(3) everything
right before exiting.
(The code is still present, `#ifdef CLEANUP', in case someone needs it...)
1999-09-15 08:43:21 +00:00
christos 7057287c54 PR/8259: Chris Demetriou: Fix stack overflow bugs exposed by the glibc-2.1.1
Makefile. Use snprintf everywhere.
1999-09-04 04:21:28 +00:00
christos 10e7b7f04d Fix extreme brokeness with job control that appeared when we set USE_PGRP. 1999-07-16 05:38:20 +00:00
christos 80d9d7d175 Regular bourne shells don't have the -q option (from Chuck Cranor) 1999-07-06 14:02:56 +00:00
christos 130a3bae01 killpg(pgrp, sig) == kill(-pgrp, sig) in the sysv case. 1999-05-03 09:49:55 +00:00
cjs d5ce180dc0 When giving the -v option to /bin/sh, also give the new -q option so that
the execution of $ENV isn't printed with every job that's started.
1999-02-04 00:40:55 +00:00
christos 889ce7db6e - full prototypes
- more conservative printf
- char -> unsigned char
1998-11-06 23:31:09 +00:00
itohy 6aeb72f23f Reduced memory leaks.
I found some more leaks, but are not in inside of iterations.
1998-11-01 03:07:33 +00:00
christos f46f2d693e PR/5210: Hauke Fath: make core dumps with .SHELL
Unfortunately this revealed a deeper problem with the brk_string code.
To fix it:
	- remove sharing of the buffer between brk_string invocations
	- change the semantics of brk_string so that the argument array
	  starts with 0, and return the buffer where the strings are
	  stored
1998-03-26 19:20:36 +00:00
lukem 2ba9e97765 wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP 1997-09-28 03:30:58 +00:00
kleink 66105c37fc Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
1997-08-25 19:31:43 +00:00
christos 254d64f064 Add WARNS=1
RCSID police
1997-07-01 21:17:00 +00:00
mycroft 755bc65362 Make sure `-n' is actually disabled for targets with the .MAKE attribute. 1997-05-06 23:51:29 +00:00
mycroft 0997556292 Don't touch .PHONY targets. 1997-05-06 20:57:47 +00:00
christos aa49881371 - Merge in FreeBSD and Lite2 changes.
- Fix bug where a non-archive target with a .a suffix would always
  be considered to be out of date, since it does not have a TOC.
1996-11-06 17:58:58 +00:00
christos 62be8b7e25 Fix bug where make will always exit with 0, even when one or more parallel
jobs failed. (Only affects parallel make code)
1996-05-29 15:28:05 +00:00
christos 8862d696fa fix pr/1421 and pr/1997 1996-02-04 22:20:27 +00:00
christos 6611cb1d0d Updates for POSIX/SVR4 compiling:
arch.c:		 Don't require ranlib stuff. Not everybody has it.
dir.c:		 SunOS-4 != Solaris; change #ifdef sun to #if sun && !__svr4__
job.c, compat.c: Don't use 'union wait', use int and the W*() macros.
main.c: 	 Check for uname() == -1; some unames return > 0...
util.c, job.c:	 Add signal() with BSD semantics for svr4, don't use bsd
		 sigmask and friends.
1995-11-22 17:39:53 +00:00
christos 61067003d8 Minor:
- ${.PREFIX} should never contain a full pathname
    - Fixed gcc -Wall warnings
Major:
    - compatMake is now FALSE. This means that we are now running in
      full pmake mode:
	  * rules on dependency lines can be executed in parallel and or
	    out of sequence:

	    foo: bar baz

	    can fire the rule for baz before the rule for bar is fired.
	    To enforce bar to be fired before baz, another rule needs to be
	    added. [bar: baz]
	  * adjacent shell commands in a target are now executed by a single
	    invocation of the shell, not one invocation of the shell per line
      (compatMake can be turned off using the -B flag)
    - The -j flag now works... I.e. make -j 4 will fork up to four jobs in
      parallel when it can. The target name is printed before each burst
      of output caused by the target execution as '--- target ---', when j > 1
    - I have changed all the Makefiles so that they work with make -j N, and
      I have tested the whole netbsd by:
	  'make -j 4 cleandir; make -j 4 depend; make -j 4; make -j 4 install'
    - I have not compiled or tested this version of make with -DREMOTE.
1995-11-02 23:54:35 +00:00
jtc 95c465e08b Update lseek() constants:
L_SET	-> SEEK_SET
And add off_t cast to offset argument.
1995-09-27 18:44:38 +00:00
christos b5f782e810 - $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
  Posix mandates
- Added .PHONY target keyword
1995-06-14 15:18:37 +00:00
cgd 7d82c5ab5d a few casts, for peace and quiet. 1994-12-24 16:54:24 +00:00
christos 218fbce657 Don't remove targets when the -n flag is given and make is interrupted.
(From Keith Bostic)
1994-11-25 19:16:45 +00:00
jtc 9f7dde6ba0 Christos' fix for quoting variable extraction properly. 1994-06-16 18:50:04 +00:00
jtc 26a8972fd7 Fixes from Christos Zoulas, who used purify, objectcenter and testcenter
to find memory leaks and illegal memory accesses.
1994-06-06 22:45:17 +00:00
cgd 3db59563ee fixes/improvements from Christos Zoulas <christos@deshaw.com>. 1994-03-05 00:34:29 +00:00
jtc e890eb6415 Include appropriate header files to bring prototypes into scope. 1994-01-13 21:01:40 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd e541169ce2 after 0.2.2 "stable" patches applied 1993-03-21 18:04:42 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00