1 /* Definitions for managing subprocesses in GNU Make.
2 Copyright (C) 1992, 1993, 1996, 1999 Free Software Foundation, Inc.
3 This file is part of GNU Make.
5 GNU Make is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
26 # include <sys/file.h>
29 /* How to set close-on-exec for a file descriptor. */
32 # define CLOSE_ON_EXEC(_d)
37 # define CLOSE_ON_EXEC(_d) (void) fcntl ((_d), F_SETFD, FD_CLOEXEC)
40 /* Structure describing a running or dead child process. */
44 struct child
*next
; /* Link in the chain. */
46 struct file
*file
; /* File being remade. */
48 char **environment
; /* Environment for commands. */
50 char **command_lines
; /* Array of variable-expanded cmd lines. */
51 unsigned int command_line
; /* Index into above. */
52 char *command_ptr
; /* Ptr into command_lines[command_line]. */
54 pid_t pid
; /* Child process's ID number. */
56 int efn
; /* Completion event flag number */
57 int cstatus
; /* Completion status */
59 char *sh_batch_file
; /* Script file for shell commands */
60 unsigned int remote
:1; /* Nonzero if executing remotely. */
62 unsigned int noerror
:1; /* Nonzero if commands contained a `-'. */
64 unsigned int good_stdin
:1; /* Nonzero if this child has a good stdin. */
65 unsigned int deleted
:1; /* Nonzero if targets have been deleted. */
68 extern struct child
*children
;
70 extern void new_job
PARAMS ((struct file
*file
));
71 extern void reap_children
PARAMS ((int block
, int err
));
72 extern void start_waiting_jobs
PARAMS ((void));
74 extern char **construct_command_argv
PARAMS ((char *line
, char **restp
, struct file
*file
, char** batch_file
));
76 extern int child_execute_job
PARAMS ((char *argv
, struct child
*child
));
77 #elif defined(__EMX__)
78 extern int child_execute_job
PARAMS ((int stdin_fd
, int stdout_fd
, char **argv
, char **envp
));
80 extern void child_execute_job
PARAMS ((int stdin_fd
, int stdout_fd
, char **argv
, char **envp
));
83 extern void exec_command
PARAMS ((char **argv
));
84 #elif defined(__EMX__)
85 extern int exec_command
PARAMS ((char **argv
, char **envp
));
87 extern void exec_command
PARAMS ((char **argv
, char **envp
));
90 extern unsigned int job_slots_used
;
92 extern void block_sigs
PARAMS ((void));
94 extern void unblock_sigs
PARAMS ((void));
96 #ifdef HAVE_SIGSETMASK
97 extern int fatal_signal_mask
;
98 #define unblock_sigs() sigsetmask (0)
100 #define unblock_sigs()
104 #endif /* SEEN_JOB_H */