1994-03-23 14:12:55 +00:00
|
|
|
/* Definitions for managing subprocesses in GNU Make.
|
2017-07-10 01:52:28 +00:00
|
|
|
Copyright (C) 1992-2017 Free Software Foundation, Inc.
|
1992-04-21 07:16:26 +00:00
|
|
|
This file is part of GNU Make.
|
|
|
|
|
2006-02-11 19:02:21 +00:00
|
|
|
GNU Make is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
2007-07-04 19:35:15 +00:00
|
|
|
Foundation; either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
1992-04-21 07:16:26 +00:00
|
|
|
|
2006-02-11 19:02:21 +00:00
|
|
|
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
1992-04-21 07:16:26 +00:00
|
|
|
|
2006-02-11 19:02:21 +00:00
|
|
|
You should have received a copy of the GNU General Public License along with
|
2007-07-04 19:35:15 +00:00
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
1992-04-21 07:16:26 +00:00
|
|
|
|
2013-09-12 08:07:52 +00:00
|
|
|
#include "output.h"
|
1996-03-20 14:57:41 +00:00
|
|
|
|
1991-03-23 14:10:48 +00:00
|
|
|
/* Structure describing a running or dead child process. */
|
|
|
|
|
|
|
|
struct child
|
|
|
|
{
|
2013-05-17 06:29:46 +00:00
|
|
|
struct child *next; /* Link in the chain. */
|
1991-03-23 14:10:48 +00:00
|
|
|
|
2013-05-17 06:29:46 +00:00
|
|
|
struct file *file; /* File being remade. */
|
1991-03-23 14:10:48 +00:00
|
|
|
|
2013-05-17 06:29:46 +00:00
|
|
|
char **environment; /* Environment for commands. */
|
2012-10-28 14:57:49 +00:00
|
|
|
char *sh_batch_file; /* Script file for shell commands */
|
2013-05-17 06:29:46 +00:00
|
|
|
char **command_lines; /* Array of variable-expanded cmd lines. */
|
|
|
|
char *command_ptr; /* Ptr into command_lines[command_line]. */
|
1991-03-23 14:10:48 +00:00
|
|
|
|
1996-03-20 14:57:41 +00:00
|
|
|
#ifdef VMS
|
2012-10-28 14:57:49 +00:00
|
|
|
char *comname; /* Temporary command file name */
|
2013-05-17 06:29:46 +00:00
|
|
|
int efn; /* Completion event flag number */
|
|
|
|
int cstatus; /* Completion status */
|
2014-09-14 01:20:22 +00:00
|
|
|
int vms_launch_status; /* non-zero if lib$spawn, etc failed */
|
1996-03-20 14:57:41 +00:00
|
|
|
#endif
|
1991-03-23 14:10:48 +00:00
|
|
|
|
2013-09-12 08:07:52 +00:00
|
|
|
unsigned int command_line; /* Index into command_lines. */
|
|
|
|
struct output output; /* Output for this child. */
|
|
|
|
pid_t pid; /* Child process's ID number. */
|
|
|
|
unsigned int remote:1; /* Nonzero if executing remotely. */
|
|
|
|
unsigned int noerror:1; /* Nonzero if commands contained a '-'. */
|
|
|
|
unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
|
|
|
|
unsigned int deleted:1; /* Nonzero if targets have been deleted. */
|
2016-02-29 01:20:18 +00:00
|
|
|
unsigned int recursive:1; /* Nonzero for recursive command ('+' etc.) */
|
2013-09-12 08:07:52 +00:00
|
|
|
unsigned int dontcare:1; /* Saved dontcare flag. */
|
1991-03-23 14:10:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct child *children;
|
|
|
|
|
Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-06 18:29:43 +00:00
|
|
|
/* A signal handler for SIGCHLD, if needed. */
|
|
|
|
RETSIGTYPE child_handler (int sig);
|
2010-07-12 05:23:19 +00:00
|
|
|
int is_bourne_compatible_shell(const char *path);
|
2006-04-07 01:43:44 +00:00
|
|
|
void new_job (struct file *file);
|
|
|
|
void reap_children (int block, int err);
|
|
|
|
void start_waiting_jobs (void);
|
1991-03-23 14:10:48 +00:00
|
|
|
|
2007-10-10 13:22:21 +00:00
|
|
|
char **construct_command_argv (char *line, char **restp, struct file *file,
|
|
|
|
int cmd_flags, char** batch_file);
|
2016-03-13 06:12:07 +00:00
|
|
|
|
1996-03-20 14:57:41 +00:00
|
|
|
#ifdef VMS
|
2016-03-13 06:12:07 +00:00
|
|
|
int child_execute_job (struct child *child, char *argv);
|
1996-03-20 14:57:41 +00:00
|
|
|
#else
|
2016-03-13 06:12:07 +00:00
|
|
|
int child_execute_job (struct output *out, int good_stdin, char **argv, char **envp);
|
1996-03-20 14:57:41 +00:00
|
|
|
#endif
|
2016-03-13 06:12:07 +00:00
|
|
|
|
1996-05-13 18:40:22 +00:00
|
|
|
#ifdef _AMIGA
|
2013-07-14 23:18:46 +00:00
|
|
|
void exec_command (char **argv) __attribute__ ((noreturn));
|
2003-03-24 23:14:15 +00:00
|
|
|
#elif defined(__EMX__)
|
2006-04-07 01:43:44 +00:00
|
|
|
int exec_command (char **argv, char **envp);
|
1996-05-13 18:40:22 +00:00
|
|
|
#else
|
2013-07-14 23:18:46 +00:00
|
|
|
void exec_command (char **argv, char **envp) __attribute__ ((noreturn));
|
1996-05-13 18:40:22 +00:00
|
|
|
#endif
|
1991-03-23 14:10:48 +00:00
|
|
|
|
2017-07-09 22:44:17 +00:00
|
|
|
void unblock_all_sigs (void);
|
1996-03-20 14:57:41 +00:00
|
|
|
|
2017-07-09 22:44:17 +00:00
|
|
|
extern unsigned int job_slots_used;
|
2005-05-03 13:57:20 +00:00
|
|
|
extern unsigned int jobserver_tokens;
|