Lines 24-29
Link Here
|
24 |
-- LOG |
24 |
-- LOG |
25 |
-- Use cvs log to obtain detailed change logs. |
25 |
-- Use cvs log to obtain detailed change logs. |
26 |
*/ |
26 |
*/ |
|
|
27 |
/* |
28 |
This file (runargv.c) provides all the parallel process handling routines |
29 |
for dmake on unix like operating systems. The following text briefly |
30 |
describes the process flow. |
31 |
|
32 |
Exec_commands() [make.c] builds the recipes associated to the given target. |
33 |
They are build sequentially in a loop that calls Do_cmnd() for each of them. |
34 |
|
35 |
Do_cmnd() [sysintf.c] feeds the given command or command group to runargv(). |
36 |
|
37 |
runargv() [unix/runargv] The actual child processes are started in this |
38 |
function, even in non parallel builds (MAXPROCESS==1) child processes are |
39 |
created. |
40 |
If recipes for a target are currently running attach them to the process |
41 |
queue (_procs[i]) of that target and return. |
42 |
If the maximum number of running process queues is reached |
43 |
Wait_for_child(?, -1) is used to wait for one to be available. |
44 |
New child processes are started using: |
45 |
spawn: currently disabled, see line 40. |
46 |
fork/execvp: Create a client process with fork and run the command with |
47 |
execvp. |
48 |
The parent calls _add_child() to track the child. |
49 |
|
50 |
_add_child() [unix/runargv] creates a new process queue and enters the child |
51 |
parameters. |
52 |
If Wait_for_completion (global variable) is set the function calls |
53 |
Wait_for_child to waits for the new process queue to be finished. |
54 |
|
55 |
Wait_for_child(?, pid) [unix/runargv] waits for process queues to finish. |
56 |
All finished processes are handled by calling _finished_child() for each |
57 |
of them. |
58 |
If pid = -1 wait for the next child process to finish. |
59 |
If Wait_for_completion is set handle all finished processes until the |
60 |
process with the given pid is reached. |
61 |
If Is_shell_exec (global variable) is set wait and handle only the given |
62 |
pid. |
63 |
|
64 |
_finished_child(pid, ?) [unix/runargv] removes the finished child from its |
65 |
process queue. If there are more commands in this queue start the next |
66 |
with runargv(). |
67 |
*/ |
27 |
|
68 |
|
28 |
#include <signal.h> |
69 |
#include <signal.h> |
29 |
#ifdef HAVE_WAIT_H |
70 |
#ifdef HAVE_WAIT_H |
Lines 185-191
Link Here
|
185 |
waitchild = (pid == -1)? FALSE : Wait_for_completion; |
226 |
waitchild = (pid == -1)? FALSE : Wait_for_completion; |
186 |
|
227 |
|
187 |
do { |
228 |
do { |
188 |
wid = wait(&status); |
229 |
if( Is_shell_exec ) /* For pid == -1 waitpid behaves like wait. */ |
|
|
230 |
wid = waitpid(pid, &status, 0); |
231 |
else |
232 |
wid = wait(&status); |
233 |
|
189 |
if( wid == -1 ) |
234 |
if( wid == -1 ) |
190 |
return(-1); |
235 |
return(-1); |
191 |
|
236 |
|