Changeset 3140 in kBuild for trunk/src/kmk/job.h
- Timestamp:
- Mar 14, 2018 9:28:10 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
-
Property svn:mergeinfo
set to
/vendor/gnumake/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/src/kmk/job.h
r2591 r3140 1 1 /* Definitions for managing subprocesses in GNU Make. 2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 4 Foundation, Inc. 2 Copyright (C) 1992-2016 Free Software Foundation, Inc. 5 3 This file is part of GNU Make. 6 4 … … 17 15 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 16 19 #ifndef SEEN_JOB_H 20 #define SEEN_JOB_H 17 #include "output.h" 21 18 22 19 #ifdef HAVE_FCNTL_H … … 28 25 /* How to set close-on-exec for a file descriptor. */ 29 26 30 #if !defined F_SETFD 31 # define CLOSE_ON_EXEC(_d) 27 #if !defined(F_SETFD) || !defined(F_GETFD) 28 # ifdef WINDOWS32 29 # define CLOSE_ON_EXEC(_d) process_noinherit(_d) 30 # else 31 # define CLOSE_ON_EXEC(_d) 32 # endif 32 33 #else 33 34 # ifndef FD_CLOEXEC … … 37 38 #endif 38 39 40 #ifdef NO_OUTPUT_SYNC 41 # define RECORD_SYNC_MUTEX(m) \ 42 O (error, NILF, \ 43 _("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build.")); 44 #else 45 # ifdef WINDOWS32 46 /* For emulations in w32/compat/posixfcn.c. */ 47 # define F_GETFD 1 48 # define F_SETLKW 2 49 /* Implementation note: None of the values of l_type below can be zero 50 -- they are compared with a static instance of the struct, so zero 51 means unknown/invalid, see w32/compat/posixfcn.c. */ 52 # define F_WRLCK 1 53 # define F_UNLCK 2 54 55 struct flock 56 { 57 short l_type; 58 short l_whence; 59 off_t l_start; 60 off_t l_len; 61 pid_t l_pid; 62 }; 63 64 /* This type is actually a HANDLE, but we want to avoid including 65 windows.h as much as possible. */ 66 typedef intptr_t sync_handle_t; 67 68 /* Public functions emulated/provided in posixfcn.c. */ 69 int fcntl (intptr_t fd, int cmd, ...); 70 intptr_t create_mutex (void); 71 int same_stream (FILE *f1, FILE *f2); 72 73 # define RECORD_SYNC_MUTEX(m) record_sync_mutex(m) 74 void record_sync_mutex (const char *str); 75 void prepare_mutex_handle_string (intptr_t hdl); 76 # else /* !WINDOWS32 */ 77 78 typedef int sync_handle_t; /* file descriptor */ 79 80 # define RECORD_SYNC_MUTEX(m) (void)(m) 81 82 # endif 83 #endif /* !NO_OUTPUT_SYNC */ 84 39 85 /* Structure describing a running or dead child process. */ 40 86 41 87 struct child 42 88 { 43 struct child *next; /* Link in the chain. */89 struct child *next; /* Link in the chain. */ 44 90 45 struct file *file; /* File being remade. */91 struct file *file; /* File being remade. */ 46 92 47 char **environment; /* Environment for commands. */ 93 char **environment; /* Environment for commands. */ 94 char *sh_batch_file; /* Script file for shell commands */ 95 char **command_lines; /* Array of variable-expanded cmd lines. */ 96 char *command_ptr; /* Ptr into command_lines[command_line]. */ 48 97 49 char **command_lines; /* Array of variable-expanded cmd lines. */ 50 unsigned int command_line; /* Index into above. */ 51 char *command_ptr; /* Ptr into command_lines[command_line]. */ 98 #ifdef VMS 99 char *comname; /* Temporary command file name */ 100 int efn; /* Completion event flag number */ 101 int cstatus; /* Completion status */ 102 int vms_launch_status; /* non-zero if lib$spawn, etc failed */ 103 #endif 52 104 53 pid_t pid; /* Child process's ID number. */ 54 #ifdef VMS 55 int efn; /* Completion event flag number */ 56 int cstatus; /* Completion status */ 57 char *comname; /* Temporary command file name */ 105 unsigned int command_line; /* Index into command_lines. */ 106 struct output output; /* Output for this child. */ 107 pid_t pid; /* Child process's ID number. */ 108 unsigned int remote:1; /* Nonzero if executing remotely. */ 109 unsigned int noerror:1; /* Nonzero if commands contained a '-'. */ 110 unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */ 111 unsigned int deleted:1; /* Nonzero if targets have been deleted. */ 112 unsigned int recursive:1; /* Nonzero for recursive command ('+' etc.) */ 113 unsigned int dontcare:1; /* Saved dontcare flag. */ 114 115 #ifdef CONFIG_WITH_KMK_BUILTIN 116 unsigned int has_status:1; /* Nonzero if status is available. */ 117 int status; /* Status of the job. */ 58 118 #endif 59 char *sh_batch_file; /* Script file for shell commands */60 #ifdef CONFIG_WITH_KMK_BUILTIN61 int status; /* Status of the job. */62 unsigned int has_status:1; /* Nonzero if status is available. */63 #endif64 unsigned int remote:1; /* Nonzero if executing remotely. */65 66 unsigned int noerror:1; /* Nonzero if commands contained a `-'. */67 68 unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */69 unsigned int deleted:1; /* Nonzero if targets have been deleted. */70 unsigned int dontcare:1; /* Saved dontcare flag. */71 119 #ifdef CONFIG_WITH_PRINT_TIME_SWITCH 72 120 big_int start_ts; /* nano_timestamp of the first command. */ … … 76 124 extern struct child *children; 77 125 126 /* A signal handler for SIGCHLD, if needed. */ 127 RETSIGTYPE child_handler (int sig); 78 128 int is_bourne_compatible_shell(const char *path); 79 129 void new_job (struct file *file); … … 83 133 char **construct_command_argv (char *line, char **restp, struct file *file, 84 134 int cmd_flags, char** batch_file); 135 85 136 #ifdef VMS 86 int child_execute_job (char *argv, struct child *child); 87 #elif defined(__EMX__) 88 int child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp); 137 int child_execute_job (struct child *child, char *argv); 89 138 #else 90 void child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp); 139 # define FD_STDIN (fileno (stdin)) 140 # define FD_STDOUT (fileno (stdout)) 141 # define FD_STDERR (fileno (stderr)) 142 int child_execute_job (struct output *out, int good_stdin, char **argv, char **envp); 91 143 #endif 144 92 145 #ifdef _AMIGA 93 void exec_command (char **argv) ;146 void exec_command (char **argv) __attribute__ ((noreturn)); 94 147 #elif defined(__EMX__) 95 148 int exec_command (char **argv, char **envp); 96 149 #else 97 void exec_command (char **argv, char **envp) ;150 void exec_command (char **argv, char **envp) __attribute__ ((noreturn)); 98 151 #endif 99 152 … … 104 157 void unblock_sigs (void); 105 158 #else 106 #ifdef HAVE_SIGSETMASK159 #ifdef HAVE_SIGSETMASK 107 160 extern int fatal_signal_mask; 108 #define unblock_sigs()sigsetmask (0)161 #define unblock_sigs() sigsetmask (0) 109 162 #else 110 #define unblock_sigs()163 #define unblock_sigs() 111 164 #endif 112 165 #endif 113 166 114 167 extern unsigned int jobserver_tokens; 115 116 #endif /* SEEN_JOB_H */
Note:
See TracChangeset
for help on using the changeset viewer.

