1/* Definitions for managing subprocesses in GNU Make.
2Copyright (C) 1992, 1993, 1996, 1999 Free Software Foundation, Inc.
3This file is part of GNU Make.
4
5GNU Make is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2, or (at your option)
8any later version.
9
10GNU Make is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with GNU Make; see the file COPYING.  If not, write to
17the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18Boston, MA 02111-1307, USA.  */
19
20#ifndef SEEN_JOB_H
21#define SEEN_JOB_H
22
23/* Structure describing a running or dead child process.  */
24
25struct child
26  {
27    struct child *next;		/* Link in the chain.  */
28
29    struct file *file;		/* File being remade.  */
30
31    char **environment;		/* Environment for commands.  */
32
33    char **command_lines;	/* Array of variable-expanded cmd lines.  */
34    unsigned int command_line;	/* Index into above.  */
35    char *command_ptr;		/* Ptr into command_lines[command_line].  */
36
37    pid_t pid;			/* Child process's ID number.  */
38#ifdef VMS
39    int efn;			/* Completion event flag number */
40    int cstatus;		/* Completion status */
41#endif
42    char *sh_batch_file;        /* Script file for shell commands */
43    unsigned int remote:1;	/* Nonzero if executing remotely.  */
44
45    unsigned int noerror:1;	/* Nonzero if commands contained a `-'.  */
46
47    unsigned int good_stdin:1;	/* Nonzero if this child has a good stdin.  */
48    unsigned int deleted:1;	/* Nonzero if targets have been deleted.  */
49  };
50
51extern struct child *children;
52
53extern void new_job PARAMS ((struct file *file));
54extern void reap_children PARAMS ((int block, int err));
55extern void start_waiting_jobs PARAMS ((void));
56
57extern char **construct_command_argv PARAMS ((char *line, char **restp, struct file *file, char** batch_file));
58#ifdef VMS
59extern int child_execute_job PARAMS ((char *argv, struct child *child));
60#else
61extern void child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp));
62#endif
63#ifdef _AMIGA
64extern void exec_command PARAMS ((char **argv));
65#else
66extern void exec_command PARAMS ((char **argv, char **envp));
67#endif
68
69extern unsigned int job_slots_used;
70
71extern void block_sigs PARAMS ((void));
72#ifdef POSIX
73extern void unblock_sigs PARAMS ((void));
74#else
75#ifdef	HAVE_SIGSETMASK
76extern int fatal_signal_mask;
77#define	unblock_sigs()	sigsetmask (0)
78#else
79#define	unblock_sigs()
80#endif
81#endif
82
83#endif /* SEEN_JOB_H */
84