Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | typedef int sh_job_map_func_t (JOB *, int, int, int); | - |
27 | | - |
28 | | - |
29 | extern sigset_t top_level_mask; | - |
30 | extern WORD_LIST *subst_assign_varlist; | - |
31 | | - |
32 | extern SigHandler **original_signals; | - |
33 | | - |
34 | extern void set_original_signal (int, SigHandler *); | - |
35 | | - |
36 | static struct jobstats zerojs = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0 }; | - |
37 | struct jobstats js = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0 }; | - |
38 | | - |
39 | ps_index_t pidstat_table[4096]; | - |
40 | struct bgpids bgpids = { 0, 0, 0 }; | - |
41 | | - |
42 | | - |
43 | JOB **jobs = (JOB **) | - |
44 | ((void *)0) | - |
45 | ; | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | int shell_tty = -1; | - |
54 | | - |
55 | | - |
56 | pid_t shell_pgrp = (pid_t)-1; | - |
57 | | - |
58 | | - |
59 | pid_t terminal_pgrp = (pid_t)-1; | - |
60 | | - |
61 | | - |
62 | pid_t original_pgrp = (pid_t)-1; | - |
63 | | - |
64 | | - |
65 | pid_t pipeline_pgrp = (pid_t)0; | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | int pgrp_pipe[2] = { -1, -1 }; | - |
72 | | - |
73 | | - |
74 | | - |
75 | volatile pid_t last_made_pid = (pid_t)-1; | - |
76 | | - |
77 | | - |
78 | volatile pid_t last_asynchronous_pid = (pid_t)-1; | - |
79 | | - |
80 | | - |
81 | PROCESS *the_pipeline = (PROCESS *) | - |
82 | ((void *)0) | - |
83 | ; | - |
84 | | - |
85 | | - |
86 | int job_control = 1; | - |
87 | | - |
88 | | - |
89 | int running_in_background = 0; | - |
90 | | - |
91 | | - |
92 | int already_making_children = 0; | - |
93 | | - |
94 | | - |
95 | | - |
96 | int check_window_size = 0; | - |
97 | | - |
98 | PROCESS *last_procsub_child = (PROCESS *) | - |
99 | ((void *)0) | - |
100 | ; | - |
101 | | - |
102 | | - |
103 | | - |
104 | void debug_print_pgrps (void); | - |
105 | | - |
106 | static void wait_sigint_handler (int); | - |
107 | static void sigchld_handler (int); | - |
108 | static void sigcont_sighandler (int); | - |
109 | static void sigstop_sighandler (int); | - |
110 | | - |
111 | static int waitchld (pid_t, int); | - |
112 | | - |
113 | static PROCESS *find_pipeline (pid_t, int, int *); | - |
114 | static PROCESS *find_process (pid_t, int, int *); | - |
115 | | - |
116 | static char *current_working_directory (void); | - |
117 | static char *job_working_directory (void); | - |
118 | static char *j_strsignal (int); | - |
119 | static char *printable_job_status (int, PROCESS *, int); | - |
120 | | - |
121 | static PROCESS *find_last_proc (int, int); | - |
122 | static pid_t find_last_pid (int, int); | - |
123 | | - |
124 | static int set_new_line_discipline (int); | - |
125 | static int map_over_jobs (sh_job_map_func_t *, int, int); | - |
126 | static int job_last_stopped (int); | - |
127 | static int job_last_running (int); | - |
128 | static int most_recent_job_in_state (int, JOB_STATE); | - |
129 | static int find_job (pid_t, int, PROCESS **); | - |
130 | static int print_job (JOB *, int, int, int); | - |
131 | static int process_exit_status (WAIT); | - |
132 | static int process_exit_signal (WAIT); | - |
133 | static int set_job_status_and_cleanup (int); | - |
134 | | - |
135 | static WAIT job_signal_status (int); | - |
136 | static WAIT raw_job_exit_status (int); | - |
137 | | - |
138 | static void notify_of_job_status (void); | - |
139 | static void reset_job_indices (void); | - |
140 | static void cleanup_dead_jobs (void); | - |
141 | static int processes_in_job (int); | - |
142 | static void realloc_jobs_list (void); | - |
143 | static int compact_jobs_list (int); | - |
144 | static void add_process (char *, pid_t); | - |
145 | static void print_pipeline (PROCESS *, int, int, FILE *); | - |
146 | static void pretty_print_job (int, int, FILE *); | - |
147 | static void set_current_job (int); | - |
148 | static void reset_current (void); | - |
149 | static void set_job_running (int); | - |
150 | static void setjstatus (int); | - |
151 | static int maybe_give_terminal_to (pid_t, pid_t, int); | - |
152 | static void mark_all_jobs_as_dead (void); | - |
153 | static void mark_dead_jobs_as_notified (int); | - |
154 | static void restore_sigint_handler (void); | - |
155 | | - |
156 | static void pipe_read (int *); | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
161 | static ps_index_t *pshash_getbucket (pid_t); | - |
162 | static void pshash_delindex (ps_index_t); | - |
163 | | - |
164 | | - |
165 | static struct pidstat *bgp_add (pid_t, int); | - |
166 | static int bgp_delete (pid_t); | - |
167 | static void bgp_clear (void); | - |
168 | static int bgp_search (pid_t); | - |
169 | | - |
170 | static ps_index_t bgp_getindex (void); | - |
171 | static void bgp_resize (void); | - |
172 | | - |
173 | | - |
174 | static int *pstatuses; | - |
175 | static int statsize; | - |
176 | | - |
177 | | - |
178 | | - |
179 | | - |
180 | static int sigchld; | - |
181 | static int queue_sigchld; | - |
182 | static SigHandler *old_tstp, *old_ttou, *old_ttin; | - |
183 | static SigHandler *old_cont = (SigHandler *) | - |
184 | ((__sighandler_t) 0) | - |
185 | ; | - |
186 | | - |
187 | | - |
188 | static struct pipeline_saver *saved_pipeline; | - |
189 | static int saved_already_making_children; | - |
190 | | - |
191 | | - |
192 | | - |
193 | | - |
194 | | - |
195 | static int jobs_list_frozen; | - |
196 | | - |
197 | static char retcode_name_buffer[64]; | - |
198 | void | - |
199 | init_job_stats () | - |
200 | { | - |
201 | js = zerojs; | - |
202 | }executed 15 times by 1 test: end of block | 15 |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
207 | | - |
208 | static char * | - |
209 | current_working_directory () | - |
210 | { | - |
211 | char *dir; | - |
212 | static char d[ | - |
213 | 4096 | - |
214 | ]; | - |
215 | | - |
216 | dir = get_string_value ("PWD"); | - |
217 | | - |
218 | if (dir == 0TRUE | never evaluated | FALSE | evaluated 43 times by 1 test |
&& the_current_working_directoryTRUE | never evaluated | FALSE | never evaluated |
&& no_symbolic_linksTRUE | never evaluated | FALSE | never evaluated |
) | 0-43 |
219 | dir = the_current_working_directory; never executed: dir = the_current_working_directory; | 0 |
220 | | - |
221 | if (dir == 0TRUE | never evaluated | FALSE | evaluated 43 times by 1 test |
) | 0-43 |
222 | { | - |
223 | dir = getcwd (d, sizeof(d)); | - |
224 | if (dirTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
225 | dir = d; never executed: dir = d; | 0 |
226 | } never executed: end of block | 0 |
227 | | - |
228 | returnexecuted 43 times by 1 test: return (dir == 0) ? "<unknown>" : dir; (dir == 0) ? "<unknown>" : dir;executed 43 times by 1 test: return (dir == 0) ? "<unknown>" : dir; | 43 |
229 | } | - |
230 | | - |
231 | | - |
232 | static char * | - |
233 | job_working_directory () | - |
234 | { | - |
235 | char *dir; | - |
236 | | - |
237 | dir = get_string_value ("PWD"); | - |
238 | if (dirTRUE | evaluated 42789 times by 1 test | FALSE | never evaluated |
) | 0-42789 |
239 | returnexecuted 42789 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (dir)), "jobs.c", 401), (dir))); ((char *)strcpy (sh_xmalloc((1 + strlen (dir)), "jobs.c", 401), (dir)));executed 42789 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (dir)), "jobs.c", 401), (dir))); | 42789 |
240 | | - |
241 | dir = get_working_directory ("job-working-directory"); | - |
242 | if (dirTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
243 | return never executed: return (dir); (dir);never executed: return (dir); | 0 |
244 | | - |
245 | return never executed: return ((char *)strcpy (sh_xmalloc((1 + strlen ("<unknown>")), "jobs.c", 407), ("<unknown>"))); ((char *)strcpy (sh_xmalloc((1 + strlen ("<unknown>")), "jobs.c", 407), ("<unknown>")));never executed: return ((char *)strcpy (sh_xmalloc((1 + strlen ("<unknown>")), "jobs.c", 407), ("<unknown>"))); | 0 |
246 | } | - |
247 | | - |
248 | void | - |
249 | making_children () | - |
250 | { | - |
251 | if (already_making_childrenTRUE | evaluated 13225 times by 1 test | FALSE | evaluated 3980638 times by 1 test |
) | 13225-3980638 |
252 | return;executed 13225 times by 1 test: return; | 13225 |
253 | | - |
254 | already_making_children = 1; | - |
255 | start_pipeline (); | - |
256 | }executed 3980638 times by 1 test: end of block | 3980638 |
257 | | - |
258 | void | - |
259 | stop_making_children () | - |
260 | { | - |
261 | already_making_children = 0; | - |
262 | }executed 3982674 times by 1 test: end of block | 3982674 |
263 | | - |
264 | void | - |
265 | cleanup_the_pipeline () | - |
266 | { | - |
267 | PROCESS *disposer; | - |
268 | sigset_t set, oset; | - |
269 | | - |
270 | do { sigemptyset (&set); sigaddset (&set, | - |
271 | 17 | - |
272 | ); sigemptyset (&oset); sigprocmask ( | - |
273 | 0 | - |
274 | , &set, &oset); } while (0); | - |
275 | disposer = the_pipeline; | - |
276 | the_pipeline = (PROCESS *) | - |
277 | ((void *)0) | - |
278 | ; | - |
279 | sigprocmask ( | - |
280 | 2 | - |
281 | , &oset, (sigset_t *) | - |
282 | ((void *)0) | - |
283 | ); | - |
284 | | - |
285 | if (disposerTRUE | evaluated 3253108 times by 1 test | FALSE | evaluated 6845 times by 1 test |
) | 6845-3253108 |
286 | discard_pipeline (disposer);executed 3253108 times by 1 test: discard_pipeline (disposer); | 3253108 |
287 | }executed 3259953 times by 1 test: end of block | 3259953 |
288 | | - |
289 | void | - |
290 | discard_last_procsub_child () | - |
291 | { | - |
292 | PROCESS *disposer; | - |
293 | sigset_t set, oset; | - |
294 | | - |
295 | do { sigemptyset (&set); sigaddset (&set, | - |
296 | 17 | - |
297 | ); sigemptyset (&oset); sigprocmask ( | - |
298 | 0 | - |
299 | , &set, &oset); } while (0); | - |
300 | disposer = last_procsub_child; | - |
301 | last_procsub_child = (PROCESS *) | - |
302 | ((void *)0) | - |
303 | ; | - |
304 | sigprocmask ( | - |
305 | 2 | - |
306 | , &oset, (sigset_t *) | - |
307 | ((void *)0) | - |
308 | ); | - |
309 | | - |
310 | if (disposerTRUE | evaluated 220153 times by 1 test | FALSE | never evaluated |
) | 0-220153 |
311 | discard_pipeline (disposer);executed 220153 times by 1 test: discard_pipeline (disposer); | 220153 |
312 | }executed 220153 times by 1 test: end of block | 220153 |
313 | | - |
314 | struct pipeline_saver * | - |
315 | alloc_pipeline_saver () | - |
316 | { | - |
317 | struct pipeline_saver *ret; | - |
318 | | - |
319 | ret = (struct pipeline_saver *)sh_xmalloc((sizeof (struct pipeline_saver)), "jobs.c", 461); | - |
320 | ret->pipeline = 0; | - |
321 | ret->next = 0; | - |
322 | returnexecuted 681117 times by 1 test: return ret; ret;executed 681117 times by 1 test: return ret; | 681117 |
323 | } | - |
324 | | - |
325 | void | - |
326 | save_pipeline (clear) | - |
327 | int clear; | - |
328 | { | - |
329 | sigset_t set, oset; | - |
330 | struct pipeline_saver *saver; | - |
331 | | - |
332 | do { sigemptyset (&set); sigaddset (&set, | - |
333 | 17 | - |
334 | ); sigemptyset (&oset); sigprocmask ( | - |
335 | 0 | - |
336 | , &set, &oset); } while (0); | - |
337 | saver = alloc_pipeline_saver (); | - |
338 | saver->pipeline = the_pipeline; | - |
339 | saver->next = saved_pipeline; | - |
340 | saved_pipeline = saver; | - |
341 | if (clearTRUE | evaluated 681117 times by 1 test | FALSE | never evaluated |
) | 0-681117 |
342 | the_pipeline = (PROCESS *)executed 681117 times by 1 test: the_pipeline = (PROCESS *) ((void *)0) ; | 681117 |
343 | ((void *)0)executed 681117 times by 1 test: the_pipeline = (PROCESS *) ((void *)0) ; | 681117 |
344 | ;executed 681117 times by 1 test: the_pipeline = (PROCESS *) ((void *)0) ; | 681117 |
345 | saved_already_making_children = already_making_children; | - |
346 | sigprocmask ( | - |
347 | 2 | - |
348 | , &oset, (sigset_t *) | - |
349 | ((void *)0) | - |
350 | ); | - |
351 | }executed 681117 times by 1 test: end of block | 681117 |
352 | | - |
353 | PROCESS * | - |
354 | restore_pipeline (discard) | - |
355 | int discard; | - |
356 | { | - |
357 | PROCESS *old_pipeline; | - |
358 | sigset_t set, oset; | - |
359 | struct pipeline_saver *saver; | - |
360 | | - |
361 | do { sigemptyset (&set); sigaddset (&set, | - |
362 | 17 | - |
363 | ); sigemptyset (&oset); sigprocmask ( | - |
364 | 0 | - |
365 | , &set, &oset); } while (0); | - |
366 | old_pipeline = the_pipeline; | - |
367 | the_pipeline = saved_pipeline->pipeline; | - |
368 | saver = saved_pipeline; | - |
369 | saved_pipeline = saved_pipeline->next; | - |
370 | sh_xfree((saver), "jobs.c", 498); | - |
371 | already_making_children = saved_already_making_children; | - |
372 | sigprocmask ( | - |
373 | 2 | - |
374 | , &oset, (sigset_t *) | - |
375 | ((void *)0) | - |
376 | ); | - |
377 | | - |
378 | if (discardTRUE | evaluated 2073 times by 1 test | FALSE | evaluated 677660 times by 1 test |
&& old_pipelineTRUE | never evaluated | FALSE | evaluated 2073 times by 1 test |
) | 0-677660 |
379 | { | - |
380 | discard_pipeline (old_pipeline); | - |
381 | return never executed: return ((PROCESS *) ((void *)0) ); ((PROCESS *)never executed: return ((PROCESS *) ((void *)0) ); | 0 |
382 | ((void *)0) never executed: return ((PROCESS *) ((void *)0) ); | 0 |
383 | ); never executed: return ((PROCESS *) ((void *)0) ); | 0 |
384 | } | - |
385 | returnexecuted 679733 times by 1 test: return old_pipeline; old_pipeline;executed 679733 times by 1 test: return old_pipeline; | 679733 |
386 | } | - |
387 | | - |
388 | | - |
389 | void | - |
390 | start_pipeline () | - |
391 | { | - |
392 | if (the_pipelineTRUE | evaluated 3428 times by 1 test | FALSE | evaluated 3979468 times by 1 test |
) | 3428-3979468 |
393 | { | - |
394 | cleanup_the_pipeline (); | - |
395 | pipeline_pgrp = 0; | - |
396 | | - |
397 | sh_closepipe (pgrp_pipe); | - |
398 | | - |
399 | }executed 3428 times by 1 test: end of block | 3428 |
400 | | - |
401 | | - |
402 | if (job_controlTRUE | evaluated 55 times by 1 test | FALSE | evaluated 3982841 times by 1 test |
) | 55-3982841 |
403 | { | - |
404 | if (pipe (pgrp_pipe) == -1TRUE | never evaluated | FALSE | evaluated 55 times by 1 test |
) | 0-55 |
405 | sys_error ( never executed: sys_error ( dcgettext (((void *)0), "start_pipeline: pgrp pipe" , 5) ); | 0 |
406 | dcgettext (((void *)0), never executed: sys_error ( dcgettext (((void *)0), "start_pipeline: pgrp pipe" , 5) ); | 0 |
407 | "start_pipeline: pgrp pipe" never executed: sys_error ( dcgettext (((void *)0), "start_pipeline: pgrp pipe" , 5) ); | 0 |
408 | , 5) never executed: sys_error ( dcgettext (((void *)0), "start_pipeline: pgrp pipe" , 5) ); | 0 |
409 | ); never executed: sys_error ( dcgettext (((void *)0), "start_pipeline: pgrp pipe" , 5) ); | 0 |
410 | }executed 55 times by 1 test: end of block | 55 |
411 | | - |
412 | }executed 3982896 times by 1 test: end of block | 3982896 |
413 | | - |
414 | | - |
415 | | - |
416 | | - |
417 | | - |
418 | int | - |
419 | stop_pipeline (async, deferred) | - |
420 | int async; | - |
421 | COMMAND *deferred; | - |
422 | { | - |
423 | register int i, j; | - |
424 | JOB *newjob; | - |
425 | sigset_t set, oset; | - |
426 | | - |
427 | do { sigemptyset (&set); sigaddset (&set, | - |
428 | 17 | - |
429 | ); sigemptyset (&oset); sigprocmask ( | - |
430 | 0 | - |
431 | , &set, &oset); } while (0); | - |
432 | | - |
433 | | - |
434 | | - |
435 | sh_closepipe (pgrp_pipe); | - |
436 | | - |
437 | | - |
438 | cleanup_dead_jobs (); | - |
439 | | - |
440 | if (js.j_jobslots == 0TRUE | evaluated 4761 times by 1 test | FALSE | evaluated 38125 times by 1 test |
) | 4761-38125 |
441 | { | - |
442 | js.j_jobslots = 8; | - |
443 | jobs = (JOB **)sh_xmalloc((js.j_jobslots * sizeof (JOB *)), "jobs.c", 557); | - |
444 | | - |
445 | | - |
446 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 38088 times by 1 test | FALSE | evaluated 4761 times by 1 test |
; i++) | 4761-38088 |
447 | jobs[i] = (JOB *)executed 38088 times by 1 test: jobs[i] = (JOB *) ((void *)0) ; | 38088 |
448 | ((void *)0)executed 38088 times by 1 test: jobs[i] = (JOB *) ((void *)0) ; | 38088 |
449 | ;executed 38088 times by 1 test: jobs[i] = (JOB *) ((void *)0) ; | 38088 |
450 | | - |
451 | js.j_firstj = js.j_lastj = js.j_njobs = 0; | - |
452 | }executed 4761 times by 1 test: end of block | 4761 |
453 | | - |
454 | | - |
455 | | - |
456 | | - |
457 | if (interactiveTRUE | never evaluated | FALSE | evaluated 42886 times by 1 test |
) | 0-42886 |
458 | { | - |
459 | for (i = js.j_jobslots; iTRUE | never evaluated | FALSE | never evaluated |
; i--) | 0 |
460 | if (jobs[i - 1]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
461 | break; never executed: break; | 0 |
462 | } never executed: end of block | 0 |
463 | else | - |
464 | { | - |
465 | for (i = js.j_lastj ? js.j_lastj + 1 : js.j_lastj; i < js.j_jobslotsTRUE | evaluated 42959 times by 1 test | FALSE | never evaluated |
; i++) | 0-42959 |
466 | if (jobs[i] == 0TRUE | evaluated 42886 times by 1 test | FALSE | evaluated 73 times by 1 test |
) | 73-42886 |
467 | break;executed 42886 times by 1 test: break; | 42886 |
468 | | - |
469 | }executed 42886 times by 1 test: end of block | 42886 |
470 | | - |
471 | | - |
472 | | - |
473 | | - |
474 | if ((interactive_shell == 0TRUE | evaluated 42885 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| subshell_environmentTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) && i == js.j_jobslotsTRUE | never evaluated | FALSE | evaluated 42886 times by 1 test |
&& js.j_jobslots >= 128TRUE | never evaluated | FALSE | never evaluated |
) | 0-42886 |
475 | i = compact_jobs_list (0); never executed: i = compact_jobs_list (0); | 0 |
476 | | - |
477 | | - |
478 | if (i == js.j_jobslotsTRUE | never evaluated | FALSE | evaluated 42886 times by 1 test |
) | 0-42886 |
479 | { | - |
480 | js.j_jobslots += 8; | - |
481 | jobs = (JOB **)sh_xrealloc((jobs), ((js.j_jobslots * sizeof (JOB *))), "jobs.c", 606); | - |
482 | | - |
483 | for (j = i; j < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
484 | jobs[j] = (JOB *) never executed: jobs[j] = (JOB *) ((void *)0) ; | 0 |
485 | ((void *)0) never executed: jobs[j] = (JOB *) ((void *)0) ; | 0 |
486 | ; never executed: jobs[j] = (JOB *) ((void *)0) ; | 0 |
487 | } never executed: end of block | 0 |
488 | | - |
489 | | - |
490 | if (the_pipelineTRUE | evaluated 42789 times by 1 test | FALSE | evaluated 97 times by 1 test |
) | 97-42789 |
491 | { | - |
492 | register PROCESS *p; | - |
493 | int any_running, any_stopped, n; | - |
494 | | - |
495 | newjob = (JOB *)sh_xmalloc((sizeof (JOB)), "jobs.c", 618); | - |
496 | | - |
497 | for (n = 1, p = the_pipeline; p->next != the_pipelineTRUE | evaluated 12247 times by 1 test | FALSE | evaluated 42789 times by 1 test |
; n++, p = p->next) | 12247-42789 |
498 | ;executed 12247 times by 1 test: ; | 12247 |
499 | p->next = (PROCESS *) | - |
500 | ((void *)0) | - |
501 | ; | - |
502 | newjob->pipe = ((the_pipelineTRUE | evaluated 42789 times by 1 test | FALSE | never evaluated |
&& the_pipeline->nextTRUE | evaluated 11969 times by 1 test | FALSE | evaluated 30820 times by 1 test |
) ? (PROCESS *)list_reverse ((GENERIC_LIST *)the_pipeline) : (PROCESS *)(the_pipeline)); | 0-42789 |
503 | for (p = newjob->pipe; p->nextTRUE | evaluated 12247 times by 1 test | FALSE | evaluated 42789 times by 1 test |
; p = p->next) | 12247-42789 |
504 | ;executed 12247 times by 1 test: ; | 12247 |
505 | p->next = newjob->pipe; | - |
506 | | - |
507 | the_pipeline = (PROCESS *) | - |
508 | ((void *)0) | - |
509 | ; | - |
510 | newjob->pgrp = pipeline_pgrp; | - |
511 | pipeline_pgrp = 0; | - |
512 | | - |
513 | newjob->flags = 0; | - |
514 | | - |
515 | | - |
516 | if (job_controlTRUE | evaluated 45 times by 1 test | FALSE | evaluated 42744 times by 1 test |
) | 45-42744 |
517 | newjob->flags |= 0x04;executed 45 times by 1 test: newjob->flags |= 0x04; | 45 |
518 | | - |
519 | | - |
520 | p = newjob->pipe; | - |
521 | any_running = any_stopped = 0; | - |
522 | do | - |
523 | { | - |
524 | any_running |= ((p)->running == 1); | - |
525 | any_stopped |= ( | - |
526 | ((( | - |
527 | (p)->status | - |
528 | ) & 0xff) == 0x7f) | - |
529 | ); | - |
530 | p = p->next; | - |
531 | }executed 55036 times by 1 test: end of block | 55036 |
532 | while (p != newjob->pipeTRUE | evaluated 12247 times by 1 test | FALSE | evaluated 42789 times by 1 test |
); | 12247-42789 |
533 | | - |
534 | newjob->state = any_runningTRUE | evaluated 42786 times by 1 test | FALSE | evaluated 3 times by 1 test |
? JRUNNING : (any_stoppedTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
? JSTOPPED : JDEAD); | 0-42786 |
535 | newjob->wd = job_working_directory (); | - |
536 | newjob->deferred = deferred; | - |
537 | | - |
538 | newjob->j_cleanup = (sh_vptrfunc_t *) | - |
539 | ((void *)0) | - |
540 | ; | - |
541 | newjob->cleanarg = (void *) | - |
542 | ((void *)0) | - |
543 | ; | - |
544 | | - |
545 | jobs[i] = newjob; | - |
546 | if (newjob->state == JDEADTRUE | evaluated 3 times by 1 test | FALSE | evaluated 42786 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
newjob->flags & 0x01)TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-42786 |
547 | setjstatus (i); never executed: setjstatus (i); | 0 |
548 | if (newjob->state == JDEADTRUE | evaluated 3 times by 1 test | FALSE | evaluated 42786 times by 1 test |
) | 3-42786 |
549 | { | - |
550 | js.c_reaped += n; | - |
551 | js.j_ndead++; | - |
552 | }executed 3 times by 1 test: end of block | 3 |
553 | js.c_injobs += n; | - |
554 | | - |
555 | js.j_lastj = i; | - |
556 | js.j_njobs++; | - |
557 | }executed 42789 times by 1 test: end of block | 42789 |
558 | else | - |
559 | newjob = (JOB *)executed 97 times by 1 test: newjob = (JOB *) ((void *)0) ; | 97 |
560 | ((void *)0)executed 97 times by 1 test: newjob = (JOB *) ((void *)0) ; | 97 |
561 | ;executed 97 times by 1 test: newjob = (JOB *) ((void *)0) ; | 97 |
562 | | - |
563 | if (newjobTRUE | evaluated 42789 times by 1 test | FALSE | evaluated 97 times by 1 test |
) | 97-42789 |
564 | js.j_lastmade = newjob;executed 42789 times by 1 test: js.j_lastmade = newjob; | 42789 |
565 | | - |
566 | if (asyncTRUE | evaluated 217 times by 1 test | FALSE | evaluated 42669 times by 1 test |
) | 217-42669 |
567 | { | - |
568 | if (newjobTRUE | evaluated 216 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-216 |
569 | { | - |
570 | newjob->flags &= ~0x01; | - |
571 | newjob->flags |= 0x20; | - |
572 | js.j_lastasync = newjob; | - |
573 | }executed 216 times by 1 test: end of block | 216 |
574 | reset_current (); | - |
575 | }executed 217 times by 1 test: end of block | 217 |
576 | else | - |
577 | { | - |
578 | if (newjobTRUE | evaluated 42573 times by 1 test | FALSE | evaluated 96 times by 1 test |
) | 96-42573 |
579 | { | - |
580 | newjob->flags |= 0x01; | - |
581 | if (job_controlTRUE | evaluated 5 times by 1 test | FALSE | evaluated 42568 times by 1 test |
&& newjob->pgrpTRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
subshell_environment&0x01) == 0TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
&& running_in_background == 0TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-42568 |
582 | maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0); never executed: maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0); | 0 |
583 | }executed 42573 times by 1 test: end of block | 42573 |
584 | }executed 42669 times by 1 test: end of block | 42669 |
585 | | - |
586 | stop_making_children (); | - |
587 | sigprocmask ( | - |
588 | 2 | - |
589 | , &oset, (sigset_t *) | - |
590 | ((void *)0) | - |
591 | ); | - |
592 | returnexecuted 42886 times by 1 test: return (newjob ? i : js.j_current); (newjob ? i : js.j_current);executed 42886 times by 1 test: return (newjob ? i : js.j_current); | 42886 |
593 | } | - |
594 | static void | - |
595 | bgp_resize () | - |
596 | { | - |
597 | ps_index_t nsize, nsize_cur, nsize_max; | - |
598 | ps_index_t psi; | - |
599 | | - |
600 | if (bgpids.nalloc == 0TRUE | evaluated 1293 times by 1 test | FALSE | never evaluated |
) | 0-1293 |
601 | { | - |
602 | | - |
603 | for (psi = 0; psi < 4096TRUE | evaluated 5296128 times by 1 test | FALSE | evaluated 1293 times by 1 test |
; psi++) | 1293-5296128 |
604 | pidstat_table[psi] = (ps_index_t)-1;executed 5296128 times by 1 test: pidstat_table[psi] = (ps_index_t)-1; | 5296128 |
605 | nsize = 512; | - |
606 | bgpids.head = 0; | - |
607 | }executed 1293 times by 1 test: end of block | 1293 |
608 | else | - |
609 | nsize = bgpids.nalloc; never executed: nsize = bgpids.nalloc; | 0 |
610 | | - |
611 | nsize_max = ((ps_index_t) (! (! ((ps_index_t) 0 < (ps_index_t) -1)) ? (ps_index_t) -1 : ((((ps_index_t) 1 << ((sizeof (ps_index_t) * 8) - 2)) - 1) * 2 + 1))); | - |
612 | nsize_cur = (ps_index_t)js.c_childmax; | - |
613 | if (nsize_cur < 0TRUE | never evaluated | FALSE | evaluated 1293 times by 1 test |
) | 0-1293 |
614 | nsize_cur = 32768; never executed: nsize_cur = 32768; | 0 |
615 | | - |
616 | while (nsize > 0TRUE | evaluated 7758 times by 1 test | FALSE | never evaluated |
&& nsize < nsize_curTRUE | evaluated 6465 times by 1 test | FALSE | evaluated 1293 times by 1 test |
) | 0-7758 |
617 | nsize <<= 1;executed 6465 times by 1 test: nsize <<= 1; | 6465 |
618 | if (nsize > nsize_maxTRUE | never evaluated | FALSE | evaluated 1293 times by 1 test |
|| nsize <= 0TRUE | never evaluated | FALSE | evaluated 1293 times by 1 test |
) | 0-1293 |
619 | nsize = nsize_max; never executed: nsize = nsize_max; | 0 |
620 | if (nsize > 32768TRUE | never evaluated | FALSE | evaluated 1293 times by 1 test |
) | 0-1293 |
621 | nsize = nsize_max = 32768; never executed: nsize = nsize_max = 32768; | 0 |
622 | | - |
623 | if (bgpids.nalloc < nsize_curTRUE | evaluated 1293 times by 1 test | FALSE | never evaluated |
&& bgpids.nalloc < nsize_maxTRUE | evaluated 1293 times by 1 test | FALSE | never evaluated |
) | 0-1293 |
624 | { | - |
625 | bgpids.storage = (struct pidstat *)sh_xrealloc((bgpids.storage), (nsize * sizeof (struct pidstat)), "jobs.c", 767); | - |
626 | | - |
627 | for (psi = bgpids.nalloc; psi < nsizeTRUE | evaluated 21184512 times by 1 test | FALSE | evaluated 1293 times by 1 test |
; psi++) | 1293-21184512 |
628 | bgpids.storage[psi].pid = (pid_t)-1;executed 21184512 times by 1 test: bgpids.storage[psi].pid = (pid_t)-1; | 21184512 |
629 | | - |
630 | bgpids.nalloc = nsize; | - |
631 | | - |
632 | }executed 1293 times by 1 test: end of block | 1293 |
633 | else if (bgpids.head >= bgpids.nallocTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
634 | bgpids.head = 0; never executed: bgpids.head = 0; | 0 |
635 | }executed 1293 times by 1 test: end of block | 1293 |
636 | | - |
637 | static ps_index_t | - |
638 | bgp_getindex () | - |
639 | { | - |
640 | if (bgpids.nalloc < (ps_index_t)js.c_childmaxTRUE | evaluated 1293 times by 1 test | FALSE | evaluated 455793 times by 1 test |
|| bgpids.head >= bgpids.nallocTRUE | never evaluated | FALSE | evaluated 455793 times by 1 test |
) | 0-455793 |
641 | bgp_resize ();executed 1293 times by 1 test: bgp_resize (); | 1293 |
642 | | - |
643 | pshash_delindex (bgpids.head); | - |
644 | returnexecuted 457086 times by 1 test: return bgpids.head++; bgpids.head++;executed 457086 times by 1 test: return bgpids.head++; | 457086 |
645 | } | - |
646 | | - |
647 | static ps_index_t * | - |
648 | pshash_getbucket (pid) | - |
649 | pid_t pid; | - |
650 | { | - |
651 | unsigned long hash; | - |
652 | | - |
653 | hash = pid * 0x9e370001UL; | - |
654 | returnexecuted 1133627 times by 1 test: return (&pidstat_table[hash % 4096]); (&pidstat_table[hash % 4096]);executed 1133627 times by 1 test: return (&pidstat_table[hash % 4096]); | 1133627 |
655 | } | - |
656 | | - |
657 | static struct pidstat * | - |
658 | bgp_add (pid, status) | - |
659 | pid_t pid; | - |
660 | int status; | - |
661 | { | - |
662 | ps_index_t *bucket, psi; | - |
663 | struct pidstat *ps; | - |
664 | | - |
665 | | - |
666 | | - |
667 | | - |
668 | bucket = pshash_getbucket (pid); | - |
669 | psi = bgp_getindex (); | - |
670 | | - |
671 | | - |
672 | if (psi == *bucketTRUE | never evaluated | FALSE | evaluated 457086 times by 1 test |
) | 0-457086 |
673 | { | - |
674 | | - |
675 | internal_warning ("hashed pid %d (pid %d) collides with bgpids.head, skipping", psi, pid); | - |
676 | | - |
677 | bgpids.storage[psi].pid = (pid_t)-1; | - |
678 | psi = bgp_getindex (); | - |
679 | } never executed: end of block | 0 |
680 | | - |
681 | ps = &bgpids.storage[psi]; | - |
682 | | - |
683 | ps->pid = pid; | - |
684 | ps->status = status; | - |
685 | ps->bucket_next = *bucket; | - |
686 | ps->bucket_prev = (ps_index_t)-1; | - |
687 | | - |
688 | bgpids.npid++; | - |
689 | | - |
690 | | - |
691 | | - |
692 | | - |
693 | | - |
694 | | - |
695 | if (ps->bucket_next != (ps_index_t)-1TRUE | never evaluated | FALSE | evaluated 457086 times by 1 test |
) | 0-457086 |
696 | bgpids.storage[ps->bucket_next].bucket_prev = psi; never executed: bgpids.storage[ps->bucket_next].bucket_prev = psi; | 0 |
697 | | - |
698 | *bucket = psi; | - |
699 | | - |
700 | returnexecuted 457086 times by 1 test: return ps; ps;executed 457086 times by 1 test: return ps; | 457086 |
701 | } | - |
702 | | - |
703 | static void | - |
704 | pshash_delindex (psi) | - |
705 | ps_index_t psi; | - |
706 | { | - |
707 | struct pidstat *ps; | - |
708 | ps_index_t *bucket; | - |
709 | | - |
710 | ps = &bgpids.storage[psi]; | - |
711 | if (ps->pid == (pid_t)-1TRUE | evaluated 457086 times by 1 test | FALSE | never evaluated |
) | 0-457086 |
712 | return;executed 457086 times by 1 test: return; | 457086 |
713 | | - |
714 | if (ps->bucket_next != (ps_index_t)-1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
715 | bgpids.storage[ps->bucket_next].bucket_prev = ps->bucket_prev; never executed: bgpids.storage[ps->bucket_next].bucket_prev = ps->bucket_prev; | 0 |
716 | if (ps->bucket_prev != (ps_index_t)-1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
717 | bgpids.storage[ps->bucket_prev].bucket_next = ps->bucket_next; never executed: bgpids.storage[ps->bucket_prev].bucket_next = ps->bucket_next; | 0 |
718 | else | - |
719 | { | - |
720 | bucket = pshash_getbucket (ps->pid); | - |
721 | *bucket = ps->bucket_next; | - |
722 | } never executed: end of block | 0 |
723 | | - |
724 | | - |
725 | ps->pid = (pid_t)-1; | - |
726 | ps->bucket_next = ps->bucket_prev = (ps_index_t)-1; | - |
727 | } never executed: end of block | 0 |
728 | | - |
729 | static int | - |
730 | bgp_delete (pid) | - |
731 | pid_t pid; | - |
732 | { | - |
733 | ps_index_t psi, orig_psi; | - |
734 | | - |
735 | if (bgpids.storage == 0TRUE | evaluated 3310699 times by 1 test | FALSE | evaluated 676540 times by 1 test |
|| bgpids.nalloc == 0TRUE | never evaluated | FALSE | evaluated 676540 times by 1 test |
|| bgpids.npid == 0TRUE | never evaluated | FALSE | evaluated 676540 times by 1 test |
) | 0-3310699 |
736 | returnexecuted 3310699 times by 1 test: return 0; 0;executed 3310699 times by 1 test: return 0; | 3310699 |
737 | | - |
738 | | - |
739 | for (orig_psi = psi = *(pshash_getbucket (pid)); psi != (ps_index_t)-1TRUE | never evaluated | FALSE | evaluated 676540 times by 1 test |
; psi = bgpids.storage[psi].bucket_next) | 0-676540 |
740 | { | - |
741 | if (bgpids.storage[psi].pid == pidTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
742 | break; never executed: break; | 0 |
743 | if (orig_psi == bgpids.storage[psi].bucket_nextTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
744 | { | - |
745 | internal_warning ("bgp_delete: LOOP: psi (%d) == storage[psi].bucket_next", psi); | - |
746 | return never executed: return 0; 0;never executed: return 0; | 0 |
747 | } | - |
748 | } never executed: end of block | 0 |
749 | | - |
750 | if (psi == (ps_index_t)-1TRUE | evaluated 676540 times by 1 test | FALSE | never evaluated |
) | 0-676540 |
751 | returnexecuted 676540 times by 1 test: return 0; 0;executed 676540 times by 1 test: return 0; | 676540 |
752 | | - |
753 | | - |
754 | itrace("bgp_delete: deleting %d", pid); | - |
755 | | - |
756 | | - |
757 | pshash_delindex (psi); | - |
758 | | - |
759 | bgpids.npid--; | - |
760 | return never executed: return 1; 1;never executed: return 1; | 0 |
761 | } | - |
762 | | - |
763 | | - |
764 | static void | - |
765 | bgp_clear () | - |
766 | { | - |
767 | if (bgpids.storage == 0TRUE | evaluated 2258 times by 1 test | FALSE | evaluated 138 times by 1 test |
|| bgpids.nalloc == 0TRUE | never evaluated | FALSE | evaluated 138 times by 1 test |
) | 0-2258 |
768 | return;executed 2258 times by 1 test: return; | 2258 |
769 | | - |
770 | sh_xfree((bgpids.storage), "jobs.c", 912); | - |
771 | | - |
772 | bgpids.storage = 0; | - |
773 | bgpids.nalloc = 0; | - |
774 | bgpids.head = 0; | - |
775 | | - |
776 | bgpids.npid = 0; | - |
777 | }executed 138 times by 1 test: end of block | 138 |
778 | | - |
779 | | - |
780 | | - |
781 | | - |
782 | static int | - |
783 | bgp_search (pid) | - |
784 | pid_t pid; | - |
785 | { | - |
786 | ps_index_t psi, orig_psi; | - |
787 | | - |
788 | if (bgpids.storage == 0TRUE | evaluated 12 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| bgpids.nalloc == 0TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
|| bgpids.npid == 0TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-12 |
789 | returnexecuted 12 times by 1 test: return -1; -1;executed 12 times by 1 test: return -1; | 12 |
790 | | - |
791 | | - |
792 | for (orig_psi = psi = *(pshash_getbucket (pid)); psi != (ps_index_t)-1TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
; psi = bgpids.storage[psi].bucket_next) | 0-1 |
793 | { | - |
794 | if (bgpids.storage[psi].pid == pidTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1 |
795 | returnexecuted 1 time by 1 test: return (bgpids.storage[psi].status); (bgpids.storage[psi].status);executed 1 time by 1 test: return (bgpids.storage[psi].status); | 1 |
796 | if (orig_psi == bgpids.storage[psi].bucket_nextTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
797 | { | - |
798 | internal_warning ("bgp_search: LOOP: psi (%d) == storage[psi].bucket_next", psi); | - |
799 | return never executed: return -1; -1;never executed: return -1; | 0 |
800 | } | - |
801 | } never executed: end of block | 0 |
802 | | - |
803 | return never executed: return -1; -1;never executed: return -1; | 0 |
804 | } | - |
805 | static void | - |
806 | reset_job_indices () | - |
807 | { | - |
808 | int old; | - |
809 | | - |
810 | if (jobs[js.j_firstj] == 0TRUE | evaluated 101 times by 1 test | FALSE | evaluated 34 times by 1 test |
) | 34-101 |
811 | { | - |
812 | old = js.j_firstj++; | - |
813 | if (old >= js.j_jobslotsTRUE | never evaluated | FALSE | evaluated 101 times by 1 test |
) | 0-101 |
814 | old = js.j_jobslots - 1; never executed: old = js.j_jobslots - 1; | 0 |
815 | while (js.j_firstj != oldTRUE | evaluated 101 times by 1 test | FALSE | never evaluated |
) | 0-101 |
816 | { | - |
817 | if (js.j_firstj >= js.j_jobslotsTRUE | never evaluated | FALSE | evaluated 101 times by 1 test |
) | 0-101 |
818 | js.j_firstj = 0; never executed: js.j_firstj = 0; | 0 |
819 | if (jobs[js.j_firstj]TRUE | evaluated 101 times by 1 test | FALSE | never evaluated |
|| js.j_firstj == oldTRUE | never evaluated | FALSE | never evaluated |
) | 0-101 |
820 | break;executed 101 times by 1 test: break; | 101 |
821 | js.j_firstj++; | - |
822 | } never executed: end of block | 0 |
823 | if (js.j_firstj == oldTRUE | never evaluated | FALSE | evaluated 101 times by 1 test |
) | 0-101 |
824 | js.j_firstj = js.j_lastj = js.j_njobs = 0; never executed: js.j_firstj = js.j_lastj = js.j_njobs = 0; | 0 |
825 | }executed 101 times by 1 test: end of block | 101 |
826 | if (jobs[js.j_lastj] == 0TRUE | evaluated 34 times by 1 test | FALSE | evaluated 101 times by 1 test |
) | 34-101 |
827 | { | - |
828 | old = js.j_lastj--; | - |
829 | if (old < 0TRUE | never evaluated | FALSE | evaluated 34 times by 1 test |
) | 0-34 |
830 | old = 0; never executed: old = 0; | 0 |
831 | while (js.j_lastj != oldTRUE | evaluated 46 times by 1 test | FALSE | never evaluated |
) | 0-46 |
832 | { | - |
833 | if (js.j_lastj < 0TRUE | never evaluated | FALSE | evaluated 46 times by 1 test |
) | 0-46 |
834 | js.j_lastj = js.j_jobslots - 1; never executed: js.j_lastj = js.j_jobslots - 1; | 0 |
835 | if (jobs[js.j_lastj]TRUE | evaluated 34 times by 1 test | FALSE | evaluated 12 times by 1 test |
|| js.j_lastj == oldTRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
) | 0-34 |
836 | break;executed 34 times by 1 test: break; | 34 |
837 | js.j_lastj--; | - |
838 | }executed 12 times by 1 test: end of block | 12 |
839 | if (js.j_lastj == oldTRUE | never evaluated | FALSE | evaluated 34 times by 1 test |
) | 0-34 |
840 | js.j_firstj = js.j_lastj = js.j_njobs = 0; never executed: js.j_firstj = js.j_lastj = js.j_njobs = 0; | 0 |
841 | }executed 34 times by 1 test: end of block | 34 |
842 | }executed 135 times by 1 test: end of block | 135 |
843 | | - |
844 | | - |
845 | static void | - |
846 | cleanup_dead_jobs () | - |
847 | { | - |
848 | register int i; | - |
849 | int os; | - |
850 | PROCESS *discard; | - |
851 | | - |
852 | if (js.j_jobslots == 0TRUE | evaluated 250699 times by 1 test | FALSE | evaluated 20809197 times by 1 test |
|| jobs_list_frozenTRUE | evaluated 319 times by 1 test | FALSE | evaluated 20808878 times by 1 test |
) | 319-20809197 |
853 | return;executed 251018 times by 1 test: return; | 251018 |
854 | | - |
855 | (os) = sigchld, queue_sigchld++; | - |
856 | | - |
857 | | - |
858 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 166471024 times by 1 test | FALSE | evaluated 20808878 times by 1 test |
; i++) | 20808878-166471024 |
859 | { | - |
860 | | - |
861 | if (i < js.j_firstjTRUE | evaluated 210 times by 1 test | FALSE | evaluated 166470814 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 210 times by 1 test |
) | 0-166470814 |
862 | itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
863 | if (i > js.j_lastjTRUE | evaluated 145456260 times by 1 test | FALSE | evaluated 21014764 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 145456260 times by 1 test |
) | 0-145456260 |
864 | itrace("cleanup_dead_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("cleanup_dead_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
865 | | - |
866 | | - |
867 | if (jobs[i]TRUE | evaluated 454092 times by 1 test | FALSE | evaluated 166016932 times by 1 test |
&& (TRUE | evaluated 43120 times by 1 test | FALSE | evaluated 410972 times by 1 test |
jobs[(i)]->state == JDEAD)TRUE | evaluated 43120 times by 1 test | FALSE | evaluated 410972 times by 1 test |
&& ((TRUE | evaluated 42747 times by 1 test | FALSE | evaluated 373 times by 1 test |
jobs[i]->flags & 0x02) != 0)TRUE | evaluated 42747 times by 1 test | FALSE | evaluated 373 times by 1 test |
) | 373-166016932 |
868 | delete_job (i, 0);executed 42747 times by 1 test: delete_job (i, 0); | 42747 |
869 | }executed 166471024 times by 1 test: end of block | 166471024 |
870 | | - |
871 | | - |
872 | if (last_procsub_childTRUE | evaluated 1725473 times by 1 test | FALSE | evaluated 19083405 times by 1 test |
&& last_procsub_child->running == 0TRUE | evaluated 456915 times by 1 test | FALSE | evaluated 1268558 times by 1 test |
) | 456915-19083405 |
873 | { | - |
874 | bgp_add (last_procsub_child->pid, process_exit_status (last_procsub_child->status)); | - |
875 | discard = last_procsub_child; | - |
876 | last_procsub_child = (PROCESS *) | - |
877 | ((void *)0) | - |
878 | ; | - |
879 | discard_pipeline (discard); | - |
880 | }executed 456915 times by 1 test: end of block | 456915 |
881 | | - |
882 | | - |
883 | | - |
884 | coproc_reap (); | - |
885 | | - |
886 | | - |
887 | do { queue_sigchld--; if (queue_sigchld == 0TRUE | evaluated 20808878 times by 1 test | FALSE | never evaluated |
&& os != sigchldTRUE | never evaluated | FALSE | evaluated 20808878 times by 1 test |
) waitchld (-1, 0);never executed: waitchld (-1, 0); } while (0); | 0-20808878 |
888 | }executed 20808878 times by 1 test: end of block | 20808878 |
889 | | - |
890 | static int | - |
891 | processes_in_job (job) | - |
892 | int job; | - |
893 | { | - |
894 | int nproc; | - |
895 | register PROCESS *p; | - |
896 | | - |
897 | nproc = 0; | - |
898 | p = jobs[job]->pipe; | - |
899 | do | - |
900 | { | - |
901 | p = p->next; | - |
902 | nproc++; | - |
903 | }executed 148 times by 1 test: end of block | 148 |
904 | while (p != jobs[job]->pipeTRUE | evaluated 55 times by 1 test | FALSE | evaluated 93 times by 1 test |
); | 55-93 |
905 | | - |
906 | returnexecuted 93 times by 1 test: return nproc; nproc;executed 93 times by 1 test: return nproc; | 93 |
907 | } | - |
908 | | - |
909 | static void | - |
910 | delete_old_job (pid) | - |
911 | pid_t pid; | - |
912 | { | - |
913 | PROCESS *p; | - |
914 | int job; | - |
915 | | - |
916 | job = find_job (pid, 0, &p); | - |
917 | if (job != -1TRUE | never evaluated | FALSE | evaluated 3987239 times by 1 test |
) | 0-3987239 |
918 | { | - |
919 | | - |
920 | itrace ("delete_old_job: found pid %d in job %d with state %d", pid, job, jobs[job]->state); | - |
921 | | - |
922 | if ((TRUE | never evaluated | FALSE | never evaluated |
jobs[(job)]->state) == JDEADTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
923 | delete_job (job, 2); never executed: delete_job (job, 2); | 0 |
924 | else | - |
925 | { | - |
926 | | - |
927 | internal_warning ( | - |
928 | dcgettext (((void *)0), | - |
929 | "forked pid %d appears in running job %d" | - |
930 | , 5) | - |
931 | , pid, job+1); | - |
932 | | - |
933 | if (pTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
934 | p->pid = 0; never executed: p->pid = 0; | 0 |
935 | } never executed: end of block | 0 |
936 | } | - |
937 | }executed 3987239 times by 1 test: end of block | 3987239 |
938 | | - |
939 | | - |
940 | | - |
941 | | - |
942 | static void | - |
943 | realloc_jobs_list () | - |
944 | { | - |
945 | sigset_t set, oset; | - |
946 | int nsize, i, j, ncur, nprev; | - |
947 | JOB **nlist; | - |
948 | | - |
949 | ncur = nprev = -1; | - |
950 | nsize = ((js.j_njobs + 8 - 1) / 8); | - |
951 | nsize *= 8; | - |
952 | i = js.j_njobs % 8; | - |
953 | if (i == 0TRUE | never evaluated | FALSE | never evaluated |
|| i > (8 >> 1)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
954 | nsize += 8; never executed: nsize += 8; | 0 |
955 | | - |
956 | do { sigemptyset (&set); sigaddset (&set, | - |
957 | 17 | - |
958 | ); sigemptyset (&oset); sigprocmask ( | - |
959 | 0 | - |
960 | , &set, &oset); } while (0); | - |
961 | nlist = (TRUE | never evaluated | FALSE | never evaluated |
js.j_jobslots == nsize)TRUE | never evaluated | FALSE | never evaluated |
? jobs : (JOB **) sh_xmalloc((nsize * sizeof (JOB *)), "jobs.c", 1106); | 0 |
962 | | - |
963 | js.c_reaped = js.j_ndead = 0; | - |
964 | for (i = j = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
965 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
966 | { | - |
967 | if (i == js.j_currentTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
968 | ncur = j; never executed: ncur = j; | 0 |
969 | if (i == js.j_previousTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
970 | nprev = j; never executed: nprev = j; | 0 |
971 | nlist[j++] = jobs[i]; | - |
972 | if (jobs[i]->state == JDEADTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
973 | { | - |
974 | js.j_ndead++; | - |
975 | js.c_reaped += processes_in_job (i); | - |
976 | } never executed: end of block | 0 |
977 | } never executed: end of block | 0 |
978 | js.j_firstj = 0; | - |
979 | js.j_lastj = (TRUE | never evaluated | FALSE | never evaluated |
j > 0)TRUE | never evaluated | FALSE | never evaluated |
? j - 1 : 0; | 0 |
980 | js.j_njobs = j; | - |
981 | js.j_jobslots = nsize; | - |
982 | | - |
983 | | - |
984 | for ( ; j < nsizeTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
985 | nlist[j] = (JOB *) never executed: nlist[j] = (JOB *) ((void *)0) ; | 0 |
986 | ((void *)0) never executed: nlist[j] = (JOB *) ((void *)0) ; | 0 |
987 | ; never executed: nlist[j] = (JOB *) ((void *)0) ; | 0 |
988 | | - |
989 | if (jobs != nlistTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
990 | { | - |
991 | sh_xfree((jobs), "jobs.c", 1142); | - |
992 | jobs = nlist; | - |
993 | } never executed: end of block | 0 |
994 | | - |
995 | if (ncur != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
996 | js.j_current = ncur; never executed: js.j_current = ncur; | 0 |
997 | if (nprev != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
998 | js.j_previous = nprev; never executed: js.j_previous = nprev; | 0 |
999 | | - |
1000 | | - |
1001 | if (js.j_current == -1TRUE | never evaluated | FALSE | never evaluated |
|| js.j_previous == -1TRUE | never evaluated | FALSE | never evaluated |
|| js.j_current > js.j_lastjTRUE | never evaluated | FALSE | never evaluated |
|| js.j_previous > js.j_lastjTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1002 | reset_current (); never executed: reset_current (); | 0 |
1003 | | - |
1004 | | - |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | sigprocmask ( | - |
1009 | 2 | - |
1010 | , &oset, (sigset_t *) | - |
1011 | ((void *)0) | - |
1012 | ); | - |
1013 | } never executed: end of block | 0 |
1014 | | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | | - |
1019 | | - |
1020 | | - |
1021 | static int | - |
1022 | compact_jobs_list (flags) | - |
1023 | int flags; | - |
1024 | { | - |
1025 | if (js.j_jobslots == 0TRUE | never evaluated | FALSE | never evaluated |
|| jobs_list_frozenTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1026 | return never executed: return js.j_jobslots; js.j_jobslots;never executed: return js.j_jobslots; | 0 |
1027 | | - |
1028 | reap_dead_jobs (); | - |
1029 | realloc_jobs_list (); | - |
1030 | | - |
1031 | | - |
1032 | | - |
1033 | | - |
1034 | | - |
1035 | return never executed: return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0); ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);never executed: return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0); | 0 |
1036 | } | - |
1037 | | - |
1038 | | - |
1039 | | - |
1040 | void | - |
1041 | delete_job (job_index, dflags) | - |
1042 | int job_index, dflags; | - |
1043 | { | - |
1044 | register JOB *temp; | - |
1045 | PROCESS *proc; | - |
1046 | int ndel; | - |
1047 | | - |
1048 | if (js.j_jobslots == 0TRUE | never evaluated | FALSE | evaluated 42764 times by 1 test |
|| jobs_list_frozenTRUE | evaluated 3 times by 1 test | FALSE | evaluated 42761 times by 1 test |
) | 0-42764 |
1049 | return;executed 3 times by 1 test: return; | 3 |
1050 | | - |
1051 | if ((TRUE | evaluated 13 times by 1 test | FALSE | evaluated 42748 times by 1 test |
dflags & 1)TRUE | evaluated 13 times by 1 test | FALSE | evaluated 42748 times by 1 test |
&& subshell_environment == 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 12 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
jobs[(job_index)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-42748 |
1052 | internal_warning ( never executed: internal_warning ( dcgettext (((void *)0), "deleting stopped job %d with process group %ld" , 5) , job_index+1, (long)jobs[job_index]->pgrp); | 0 |
1053 | dcgettext (((void *)0), never executed: internal_warning ( dcgettext (((void *)0), "deleting stopped job %d with process group %ld" , 5) , job_index+1, (long)jobs[job_index]->pgrp); | 0 |
1054 | "deleting stopped job %d with process group %ld" never executed: internal_warning ( dcgettext (((void *)0), "deleting stopped job %d with process group %ld" , 5) , job_index+1, (long)jobs[job_index]->pgrp); | 0 |
1055 | , 5) never executed: internal_warning ( dcgettext (((void *)0), "deleting stopped job %d with process group %ld" , 5) , job_index+1, (long)jobs[job_index]->pgrp); | 0 |
1056 | , job_index+1, (long)jobs[job_index]->pgrp); never executed: internal_warning ( dcgettext (((void *)0), "deleting stopped job %d with process group %ld" , 5) , job_index+1, (long)jobs[job_index]->pgrp); | 0 |
1057 | temp = jobs[job_index]; | - |
1058 | if (temp == 0TRUE | never evaluated | FALSE | evaluated 42761 times by 1 test |
) | 0-42761 |
1059 | return; never executed: return; | 0 |
1060 | | - |
1061 | if ((TRUE | evaluated 42749 times by 1 test | FALSE | evaluated 12 times by 1 test |
dflags & 2) == 0TRUE | evaluated 42749 times by 1 test | FALSE | evaluated 12 times by 1 test |
&& (TRUE | evaluated 171 times by 1 test | FALSE | evaluated 42578 times by 1 test |
temp->flags & (0x20|0x01)) == 0x20TRUE | evaluated 171 times by 1 test | FALSE | evaluated 42578 times by 1 test |
) | 12-42749 |
1062 | { | - |
1063 | proc = find_last_proc (job_index, 0); | - |
1064 | if (procTRUE | evaluated 171 times by 1 test | FALSE | never evaluated |
) | 0-171 |
1065 | bgp_add (proc->pid, process_exit_status (proc->status));executed 171 times by 1 test: bgp_add (proc->pid, process_exit_status (proc->status)); | 171 |
1066 | }executed 171 times by 1 test: end of block | 171 |
1067 | | - |
1068 | jobs[job_index] = (JOB *) | - |
1069 | ((void *)0) | - |
1070 | ; | - |
1071 | if (temp == js.j_lastmadeTRUE | evaluated 42639 times by 1 test | FALSE | evaluated 122 times by 1 test |
) | 122-42639 |
1072 | js.j_lastmade = 0;executed 42639 times by 1 test: js.j_lastmade = 0; | 42639 |
1073 | else if (temp == js.j_lastasyncTRUE | evaluated 6 times by 1 test | FALSE | evaluated 116 times by 1 test |
) | 6-116 |
1074 | js.j_lastasync = 0;executed 6 times by 1 test: js.j_lastasync = 0; | 6 |
1075 | | - |
1076 | sh_xfree((temp->wd), "jobs.c", 1217); | - |
1077 | ndel = discard_pipeline (temp->pipe); | - |
1078 | | - |
1079 | js.c_injobs -= ndel; | - |
1080 | if (temp->state == JDEADTRUE | evaluated 42749 times by 1 test | FALSE | evaluated 12 times by 1 test |
) | 12-42749 |
1081 | { | - |
1082 | js.c_reaped -= ndel; | - |
1083 | js.j_ndead--; | - |
1084 | if (js.c_reaped < 0TRUE | never evaluated | FALSE | evaluated 42749 times by 1 test |
) | 0-42749 |
1085 | { | - |
1086 | | - |
1087 | itrace("delete_job (%d pgrp %d): js.c_reaped (%d) < 0 ndel = %d js.j_ndead = %d", job_index, temp->pgrp, js.c_reaped, ndel, js.j_ndead); | - |
1088 | | - |
1089 | js.c_reaped = 0; | - |
1090 | } never executed: end of block | 0 |
1091 | }executed 42749 times by 1 test: end of block | 42749 |
1092 | | - |
1093 | if (temp->deferredTRUE | never evaluated | FALSE | evaluated 42761 times by 1 test |
) | 0-42761 |
1094 | dispose_command (temp->deferred); never executed: dispose_command (temp->deferred); | 0 |
1095 | | - |
1096 | sh_xfree((temp), "jobs.c", 1237); | - |
1097 | | - |
1098 | js.j_njobs--; | - |
1099 | if (js.j_njobs == 0TRUE | evaluated 42613 times by 1 test | FALSE | evaluated 148 times by 1 test |
) | 148-42613 |
1100 | js.j_firstj = js.j_lastj = 0;executed 42613 times by 1 test: js.j_firstj = js.j_lastj = 0; | 42613 |
1101 | else if (jobs[js.j_firstj] == 0TRUE | evaluated 101 times by 1 test | FALSE | evaluated 47 times by 1 test |
|| jobs[js.j_lastj] == 0TRUE | evaluated 34 times by 1 test | FALSE | evaluated 13 times by 1 test |
) | 13-101 |
1102 | reset_job_indices ();executed 135 times by 1 test: reset_job_indices (); | 135 |
1103 | | - |
1104 | if (job_index == js.j_currentTRUE | evaluated 150 times by 1 test | FALSE | evaluated 42611 times by 1 test |
|| job_index == js.j_previousTRUE | evaluated 13 times by 1 test | FALSE | evaluated 42598 times by 1 test |
) | 13-42611 |
1105 | reset_current ();executed 163 times by 1 test: reset_current (); | 163 |
1106 | }executed 42761 times by 1 test: end of block | 42761 |
1107 | | - |
1108 | | - |
1109 | void | - |
1110 | nohup_job (job_index) | - |
1111 | int job_index; | - |
1112 | { | - |
1113 | register JOB *temp; | - |
1114 | | - |
1115 | if (js.j_jobslots == 0TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
1116 | return; never executed: return; | 0 |
1117 | | - |
1118 | if (temp = jobs[job_index]TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1 |
1119 | temp->flags |= 0x08;executed 1 time by 1 test: temp->flags |= 0x08; | 1 |
1120 | }executed 1 time by 1 test: end of block | 1 |
1121 | | - |
1122 | | - |
1123 | int | - |
1124 | discard_pipeline (chain) | - |
1125 | register PROCESS *chain; | - |
1126 | { | - |
1127 | register PROCESS *this, *next; | - |
1128 | int n; | - |
1129 | | - |
1130 | this = chain; | - |
1131 | n = 0; | - |
1132 | do | - |
1133 | { | - |
1134 | next = this->next; | - |
1135 | do { if (this->commandTRUE | evaluated 56105 times by 1 test | FALSE | evaluated 3929241 times by 1 test |
) sh_xfree((this->command), "jobs.c", 1276);executed 56105 times by 1 test: sh_xfree((this->command), "jobs.c", 1276); } while (0); | 56105-3929241 |
1136 | sh_xfree((this), "jobs.c", 1277); | - |
1137 | n++; | - |
1138 | this = next; | - |
1139 | }executed 3985346 times by 1 test: end of block | 3985346 |
1140 | while (this != chainTRUE | evaluated 12409 times by 1 test | FALSE | evaluated 3972937 times by 1 test |
); | 12409-3972937 |
1141 | | - |
1142 | returnexecuted 3972937 times by 1 test: return n; n;executed 3972937 times by 1 test: return n; | 3972937 |
1143 | } | - |
1144 | | - |
1145 | | - |
1146 | | - |
1147 | | - |
1148 | static void | - |
1149 | add_process (name, pid) | - |
1150 | char *name; | - |
1151 | pid_t pid; | - |
1152 | { | - |
1153 | PROCESS *t, *p; | - |
1154 | t = (PROCESS *)sh_xmalloc((sizeof (PROCESS)), "jobs.c", 1311); | - |
1155 | t->next = the_pipeline; | - |
1156 | t->pid = pid; | - |
1157 | (t->status) = 0; | - |
1158 | t->running = 1; | - |
1159 | t->command = name; | - |
1160 | the_pipeline = t; | - |
1161 | | - |
1162 | if (t->next == 0TRUE | evaluated 3974965 times by 1 test | FALSE | evaluated 12274 times by 1 test |
) | 12274-3974965 |
1163 | t->next = t;executed 3974965 times by 1 test: t->next = t; | 3974965 |
1164 | else | - |
1165 | { | - |
1166 | p = t->next; | - |
1167 | while (p->next != t->nextTRUE | evaluated 285 times by 1 test | FALSE | evaluated 12274 times by 1 test |
) | 285-12274 |
1168 | p = p->next;executed 285 times by 1 test: p = p->next; | 285 |
1169 | p->next = t; | - |
1170 | }executed 12274 times by 1 test: end of block | 12274 |
1171 | } | - |
1172 | | - |
1173 | | - |
1174 | | - |
1175 | void | - |
1176 | append_process (name, pid, status, jid) | - |
1177 | char *name; | - |
1178 | pid_t pid; | - |
1179 | int status; | - |
1180 | int jid; | - |
1181 | { | - |
1182 | PROCESS *t, *p; | - |
1183 | | - |
1184 | t = (PROCESS *)sh_xmalloc((sizeof (PROCESS)), "jobs.c", 1341); | - |
1185 | t->next = (PROCESS *) | - |
1186 | ((void *)0) | - |
1187 | ; | - |
1188 | t->pid = pid; | - |
1189 | | - |
1190 | t->status = (status & 0xff) << 8; | - |
1191 | t->running = 0; | - |
1192 | t->command = name; | - |
1193 | | - |
1194 | js.c_reaped++; | - |
1195 | | - |
1196 | for (p = jobs[jid]->pipe; p->next != jobs[jid]->pipeTRUE | evaluated 13 times by 1 test | FALSE | evaluated 136 times by 1 test |
; p = p->next) | 13-136 |
1197 | ;executed 13 times by 1 test: ; | 13 |
1198 | p->next = t; | - |
1199 | t->next = jobs[jid]->pipe; | - |
1200 | }executed 136 times by 1 test: end of block | 136 |
1201 | static int | - |
1202 | map_over_jobs (func, arg1, arg2) | - |
1203 | sh_job_map_func_t *func; | - |
1204 | int arg1, arg2; | - |
1205 | { | - |
1206 | register int i; | - |
1207 | int result; | - |
1208 | sigset_t set, oset; | - |
1209 | | - |
1210 | if (js.j_jobslots == 0TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
) | 0-14 |
1211 | return never executed: return 0; 0;never executed: return 0; | 0 |
1212 | | - |
1213 | do { sigemptyset (&set); sigaddset (&set, | - |
1214 | 17 | - |
1215 | ); sigemptyset (&oset); sigprocmask ( | - |
1216 | 0 | - |
1217 | , &set, &oset); } while (0); | - |
1218 | | - |
1219 | | - |
1220 | for (i = result = 0; i < js.j_jobslotsTRUE | evaluated 112 times by 1 test | FALSE | evaluated 14 times by 1 test |
; i++) | 14-112 |
1221 | { | - |
1222 | | - |
1223 | if (i < js.j_firstjTRUE | evaluated 5 times by 1 test | FALSE | evaluated 107 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-107 |
1224 | itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
1225 | if (i > js.j_lastjTRUE | evaluated 74 times by 1 test | FALSE | evaluated 38 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 74 times by 1 test |
) | 0-74 |
1226 | itrace("map_over_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("map_over_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
1227 | | - |
1228 | if (jobs[i]TRUE | evaluated 29 times by 1 test | FALSE | evaluated 83 times by 1 test |
) | 29-83 |
1229 | { | - |
1230 | result = (*func)(jobs[i], arg1, arg2, i); | - |
1231 | if (resultTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1232 | break; never executed: break; | 0 |
1233 | }executed 29 times by 1 test: end of block | 29 |
1234 | }executed 112 times by 1 test: end of block | 112 |
1235 | | - |
1236 | sigprocmask ( | - |
1237 | 2 | - |
1238 | , &oset, (sigset_t *) | - |
1239 | ((void *)0) | - |
1240 | ); | - |
1241 | | - |
1242 | returnexecuted 14 times by 1 test: return (result); (result);executed 14 times by 1 test: return (result); | 14 |
1243 | } | - |
1244 | | - |
1245 | | - |
1246 | void | - |
1247 | terminate_current_pipeline () | - |
1248 | { | - |
1249 | if (pipeline_pgrpTRUE | never evaluated | FALSE | never evaluated |
&& pipeline_pgrp != shell_pgrpTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1250 | { | - |
1251 | killpg (pipeline_pgrp, | - |
1252 | 15 | - |
1253 | ); | - |
1254 | killpg (pipeline_pgrp, | - |
1255 | 18 | - |
1256 | ); | - |
1257 | } never executed: end of block | 0 |
1258 | } never executed: end of block | 0 |
1259 | | - |
1260 | | - |
1261 | void | - |
1262 | terminate_stopped_jobs () | - |
1263 | { | - |
1264 | register int i; | - |
1265 | | - |
1266 | | - |
1267 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 48 times by 1 test | FALSE | evaluated 8 times by 1 test |
; i++) | 8-48 |
1268 | { | - |
1269 | if (jobs[i]TRUE | evaluated 5 times by 1 test | FALSE | evaluated 43 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
jobs[(i)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-43 |
1270 | { | - |
1271 | killpg (jobs[i]->pgrp, | - |
1272 | 15 | - |
1273 | ); | - |
1274 | killpg (jobs[i]->pgrp, | - |
1275 | 18 | - |
1276 | ); | - |
1277 | } never executed: end of block | 0 |
1278 | }executed 48 times by 1 test: end of block | 48 |
1279 | }executed 8 times by 1 test: end of block | 8 |
1280 | | - |
1281 | | - |
1282 | | - |
1283 | void | - |
1284 | hangup_all_jobs () | - |
1285 | { | - |
1286 | register int i; | - |
1287 | | - |
1288 | | - |
1289 | for (i = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
1290 | { | - |
1291 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1292 | { | - |
1293 | if (jobs[i]->flags & 0x08TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1294 | continue; never executed: continue; | 0 |
1295 | killpg (jobs[i]->pgrp, | - |
1296 | 1 | - |
1297 | ); | - |
1298 | if ((TRUE | never evaluated | FALSE | never evaluated |
jobs[(i)]->state == JSTOPPED)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1299 | killpg (jobs[i]->pgrp, never executed: killpg (jobs[i]->pgrp, 18 ); | 0 |
1300 | 18 never executed: killpg (jobs[i]->pgrp, 18 ); | 0 |
1301 | ); never executed: killpg (jobs[i]->pgrp, 18 ); | 0 |
1302 | } never executed: end of block | 0 |
1303 | } never executed: end of block | 0 |
1304 | } never executed: end of block | 0 |
1305 | | - |
1306 | void | - |
1307 | kill_current_pipeline () | - |
1308 | { | - |
1309 | stop_making_children (); | - |
1310 | start_pipeline (); | - |
1311 | } never executed: end of block | 0 |
1312 | | - |
1313 | | - |
1314 | | - |
1315 | | - |
1316 | static PROCESS * | - |
1317 | find_pipeline (pid, alive_only, jobp) | - |
1318 | pid_t pid; | - |
1319 | int alive_only; | - |
1320 | int *jobp; | - |
1321 | { | - |
1322 | int job; | - |
1323 | PROCESS *p; | - |
1324 | | - |
1325 | | - |
1326 | if (jobpTRUE | evaluated 3985838 times by 1 test | FALSE | evaluated 3528591 times by 1 test |
) | 3528591-3985838 |
1327 | *executed 3985838 times by 1 test: *jobp = -1; jobp = -1;executed 3985838 times by 1 test: *jobp = -1; | 3985838 |
1328 | if (the_pipelineTRUE | evaluated 7168474 times by 1 test | FALSE | evaluated 345955 times by 1 test |
) | 345955-7168474 |
1329 | { | - |
1330 | p = the_pipeline; | - |
1331 | do | - |
1332 | { | - |
1333 | | - |
1334 | if (p->pid == pidTRUE | evaluated 6507157 times by 1 test | FALSE | evaluated 661317 times by 1 test |
&& ((alive_only == 0TRUE | evaluated 3253577 times by 1 test | FALSE | evaluated 3253580 times by 1 test |
&& (TRUE | evaluated 3253577 times by 1 test | FALSE | never evaluated |
0) == 0TRUE | evaluated 3253577 times by 1 test | FALSE | never evaluated |
) || (((TRUE | evaluated 3253580 times by 1 test | FALSE | never evaluated |
p)->running == 1)TRUE | evaluated 3253580 times by 1 test | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
| 0-6507157 |
1335 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1336 | (p)->statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1337 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1338 | )TRUE | never evaluated | FALSE | never evaluated |
))) | 0 |
1339 | returnexecuted 6507157 times by 1 test: return (p); (p);executed 6507157 times by 1 test: return (p); | 6507157 |
1340 | | - |
1341 | p = p->next; | - |
1342 | }executed 661317 times by 1 test: end of block | 661317 |
1343 | while (p != the_pipelineTRUE | never evaluated | FALSE | evaluated 661317 times by 1 test |
); | 0-661317 |
1344 | }executed 661317 times by 1 test: end of block | 661317 |
1345 | | - |
1346 | if (last_procsub_childTRUE | evaluated 731717 times by 1 test | FALSE | evaluated 275555 times by 1 test |
) | 275555-731717 |
1347 | { | - |
1348 | p = last_procsub_child; | - |
1349 | do | - |
1350 | { | - |
1351 | | - |
1352 | if (p->pid == pidTRUE | evaluated 484793 times by 1 test | FALSE | evaluated 246924 times by 1 test |
&& ((alive_only == 0TRUE | never evaluated | FALSE | evaluated 484793 times by 1 test |
&& (TRUE | never evaluated | FALSE | never evaluated |
0) == 0TRUE | never evaluated | FALSE | never evaluated |
) || (((TRUE | evaluated 484793 times by 1 test | FALSE | never evaluated |
p)->running == 1)TRUE | evaluated 484793 times by 1 test | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
| 0-484793 |
1353 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1354 | (p)->statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1355 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1356 | )TRUE | never evaluated | FALSE | never evaluated |
))) | 0 |
1357 | returnexecuted 484793 times by 1 test: return (p); (p);executed 484793 times by 1 test: return (p); | 484793 |
1358 | | - |
1359 | p = p->next; | - |
1360 | }executed 246924 times by 1 test: end of block | 246924 |
1361 | while (p != last_procsub_childTRUE | never evaluated | FALSE | evaluated 246924 times by 1 test |
); | 0-246924 |
1362 | }executed 246924 times by 1 test: end of block | 246924 |
1363 | | - |
1364 | job = find_job (pid, alive_only, &p); | - |
1365 | if (jobpTRUE | evaluated 247465 times by 1 test | FALSE | evaluated 275014 times by 1 test |
) | 247465-275014 |
1366 | *executed 247465 times by 1 test: *jobp = job; jobp = job;executed 247465 times by 1 test: *jobp = job; | 247465 |
1367 | returnexecuted 522479 times by 1 test: return (job == -1) ? (PROCESS *) ((void *)0) : jobs[job]->pipe; (job == -1) ? (PROCESS *)executed 522479 times by 1 test: return (job == -1) ? (PROCESS *) ((void *)0) : jobs[job]->pipe; | 522479 |
1368 | ((void *)0) executed 522479 times by 1 test: return (job == -1) ? (PROCESS *) ((void *)0) : jobs[job]->pipe; | 522479 |
1369 | : jobs[job]->pipe;executed 522479 times by 1 test: return (job == -1) ? (PROCESS *) ((void *)0) : jobs[job]->pipe; | 522479 |
1370 | } | - |
1371 | | - |
1372 | | - |
1373 | | - |
1374 | | - |
1375 | static PROCESS * | - |
1376 | find_process (pid, alive_only, jobp) | - |
1377 | pid_t pid; | - |
1378 | int alive_only; | - |
1379 | int *jobp; | - |
1380 | { | - |
1381 | PROCESS *p; | - |
1382 | | - |
1383 | p = find_pipeline (pid, alive_only, jobp); | - |
1384 | while (pTRUE | evaluated 3805918 times by 1 test | FALSE | evaluated 192444 times by 1 test |
&& p->pid != pidTRUE | evaluated 12531 times by 1 test | FALSE | evaluated 3793387 times by 1 test |
) | 12531-3805918 |
1385 | p = p->next;executed 12531 times by 1 test: p = p->next; | 12531 |
1386 | returnexecuted 3985831 times by 1 test: return p; p;executed 3985831 times by 1 test: return p; | 3985831 |
1387 | } | - |
1388 | | - |
1389 | | - |
1390 | | - |
1391 | static int | - |
1392 | find_job (pid, alive_only, procp) | - |
1393 | pid_t pid; | - |
1394 | int alive_only; | - |
1395 | PROCESS **procp; | - |
1396 | { | - |
1397 | register int i; | - |
1398 | PROCESS *p; | - |
1399 | | - |
1400 | | - |
1401 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 59582729 times by 1 test | FALSE | evaluated 7433277 times by 1 test |
; i++) | 7433277-59582729 |
1402 | { | - |
1403 | | - |
1404 | if (i < js.j_firstjTRUE | evaluated 259 times by 1 test | FALSE | evaluated 59582470 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 259 times by 1 test |
) | 0-59582470 |
1405 | itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
1406 | if (i > js.j_lastjTRUE | evaluated 51628090 times by 1 test | FALSE | evaluated 7954639 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 51628090 times by 1 test |
) | 0-51628090 |
1407 | itrace("find_job: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("find_job: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
1408 | | - |
1409 | if (jobs[i]TRUE | evaluated 582475 times by 1 test | FALSE | evaluated 59000254 times by 1 test |
) | 582475-59000254 |
1410 | { | - |
1411 | p = jobs[i]->pipe; | - |
1412 | | - |
1413 | do | - |
1414 | { | - |
1415 | if (p->pid == pidTRUE | evaluated 577921 times by 1 test | FALSE | evaluated 55647 times by 1 test |
&& ((alive_only == 0TRUE | evaluated 522907 times by 1 test | FALSE | evaluated 55014 times by 1 test |
&& (TRUE | evaluated 522907 times by 1 test | FALSE | never evaluated |
0) == 0TRUE | evaluated 522907 times by 1 test | FALSE | never evaluated |
) || (((TRUE | evaluated 55013 times by 1 test | FALSE | evaluated 1 time by 1 test |
p)->running == 1)TRUE | evaluated 55013 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| (TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-577921 |
1416 | (((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1417 | (p)->statusTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1418 | ) & 0xff) == 0x7f)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1419 | )TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
))) | 0-1 |
1420 | { | - |
1421 | if (procpTRUE | evaluated 330022 times by 1 test | FALSE | evaluated 247899 times by 1 test |
) | 247899-330022 |
1422 | *executed 330022 times by 1 test: *procp = p; procp = p;executed 330022 times by 1 test: *procp = p; | 330022 |
1423 | returnexecuted 577921 times by 1 test: return (i); (i);executed 577921 times by 1 test: return (i); | 577921 |
1424 | } | - |
1425 | | - |
1426 | p = p->next; | - |
1427 | }executed 55647 times by 1 test: end of block | 55647 |
1428 | while (p != jobs[i]->pipeTRUE | evaluated 51093 times by 1 test | FALSE | evaluated 4554 times by 1 test |
); | 4554-51093 |
1429 | }executed 4554 times by 1 test: end of block | 4554 |
1430 | }executed 59004808 times by 1 test: end of block | 59004808 |
1431 | | - |
1432 | returnexecuted 7433277 times by 1 test: return (-1); (-1);executed 7433277 times by 1 test: return (-1); | 7433277 |
1433 | } | - |
1434 | | - |
1435 | | - |
1436 | | - |
1437 | int | - |
1438 | get_job_by_pid (pid, block) | - |
1439 | pid_t pid; | - |
1440 | int block; | - |
1441 | { | - |
1442 | int job; | - |
1443 | sigset_t set, oset; | - |
1444 | | - |
1445 | if (blockTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1446 | do { sigemptyset (&set); sigaddset (&set, | - |
1447 | 17 | - |
1448 | ); sigemptyset (&oset); sigprocmask ( | - |
1449 | 0 | - |
1450 | , &set, &oset); } never executed: end of block while (0); | 0 |
1451 | | - |
1452 | job = find_job (pid, 0, | - |
1453 | ((void *)0) | - |
1454 | ); | - |
1455 | | - |
1456 | if (blockTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1457 | sigprocmask ( never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
1458 | 2 never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
1459 | , &oset, (sigset_t *) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
1460 | ((void *)0) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
1461 | ); never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
1462 | | - |
1463 | return never executed: return job; job;never executed: return job; | 0 |
1464 | } | - |
1465 | | - |
1466 | | - |
1467 | void | - |
1468 | describe_pid (pid) | - |
1469 | pid_t pid; | - |
1470 | { | - |
1471 | int job; | - |
1472 | sigset_t set, oset; | - |
1473 | | - |
1474 | do { sigemptyset (&set); sigaddset (&set, | - |
1475 | 17 | - |
1476 | ); sigemptyset (&oset); sigprocmask ( | - |
1477 | 0 | - |
1478 | , &set, &oset); } while (0); | - |
1479 | | - |
1480 | job = find_job (pid, 0, | - |
1481 | ((void *)0) | - |
1482 | ); | - |
1483 | | - |
1484 | if (job != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1485 | fprintf ( never executed: fprintf ( stderr , "[%d] %ld\n", job + 1, (long)pid); | 0 |
1486 | stderr never executed: fprintf ( stderr , "[%d] %ld\n", job + 1, (long)pid); | 0 |
1487 | , "[%d] %ld\n", job + 1, (long)pid); never executed: fprintf ( stderr , "[%d] %ld\n", job + 1, (long)pid); | 0 |
1488 | else | - |
1489 | programming_error ( never executed: programming_error ( dcgettext (((void *)0), "describe_pid: %ld: no such pid" , 5) , (long)pid); | 0 |
1490 | dcgettext (((void *)0), never executed: programming_error ( dcgettext (((void *)0), "describe_pid: %ld: no such pid" , 5) , (long)pid); | 0 |
1491 | "describe_pid: %ld: no such pid" never executed: programming_error ( dcgettext (((void *)0), "describe_pid: %ld: no such pid" , 5) , (long)pid); | 0 |
1492 | , 5) never executed: programming_error ( dcgettext (((void *)0), "describe_pid: %ld: no such pid" , 5) , (long)pid); | 0 |
1493 | , (long)pid); never executed: programming_error ( dcgettext (((void *)0), "describe_pid: %ld: no such pid" , 5) , (long)pid); | 0 |
1494 | | - |
1495 | sigprocmask ( | - |
1496 | 2 | - |
1497 | , &oset, (sigset_t *) | - |
1498 | ((void *)0) | - |
1499 | ); | - |
1500 | } never executed: end of block | 0 |
1501 | | - |
1502 | static char * | - |
1503 | j_strsignal (s) | - |
1504 | int s; | - |
1505 | { | - |
1506 | char *x; | - |
1507 | | - |
1508 | x = strsignal (s); | - |
1509 | if (x == 0TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-5 |
1510 | { | - |
1511 | x = retcode_name_buffer; | - |
1512 | snprintf (x, sizeof(retcode_name_buffer), | - |
1513 | dcgettext (((void *)0), | - |
1514 | "Signal %d" | - |
1515 | , 5) | - |
1516 | , s); | - |
1517 | } never executed: end of block | 0 |
1518 | returnexecuted 5 times by 1 test: return x; x;executed 5 times by 1 test: return x; | 5 |
1519 | } | - |
1520 | | - |
1521 | static char * | - |
1522 | printable_job_status (j, p, format) | - |
1523 | int j; | - |
1524 | PROCESS *p; | - |
1525 | int format; | - |
1526 | { | - |
1527 | static char *temp; | - |
1528 | int es; | - |
1529 | | - |
1530 | temp = | - |
1531 | dcgettext (((void *)0), | - |
1532 | "Done" | - |
1533 | , 5) | - |
1534 | ; | - |
1535 | | - |
1536 | if ((TRUE | evaluated 3 times by 1 test | FALSE | evaluated 26 times by 1 test |
jobs[(j)]->state == JSTOPPED)TRUE | evaluated 3 times by 1 test | FALSE | evaluated 26 times by 1 test |
&& format == 0TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) | 0-26 |
1537 | { | - |
1538 | if (posixly_correct == 0TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
|| p == 0TRUE | never evaluated | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
| 0-3 |
1539 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1540 | p->statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1541 | ) & 0xff) == 0x7f) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1542 | == 0)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1543 | temp = executed 3 times by 1 test: temp = dcgettext (((void *)0), "Stopped" , 5) ; | 3 |
1544 | dcgettext (((void *)0), executed 3 times by 1 test: temp = dcgettext (((void *)0), "Stopped" , 5) ; | 3 |
1545 | "Stopped"executed 3 times by 1 test: temp = dcgettext (((void *)0), "Stopped" , 5) ; | 3 |
1546 | , 5)executed 3 times by 1 test: temp = dcgettext (((void *)0), "Stopped" , 5) ; | 3 |
1547 | ;executed 3 times by 1 test: temp = dcgettext (((void *)0), "Stopped" , 5) ; | 3 |
1548 | else | - |
1549 | { | - |
1550 | temp = retcode_name_buffer; | - |
1551 | snprintf (temp, sizeof(retcode_name_buffer), | - |
1552 | dcgettext (((void *)0), | - |
1553 | "Stopped(%s)" | - |
1554 | , 5) | - |
1555 | , signal_name ( | - |
1556 | ((( | - |
1557 | p->status | - |
1558 | ) & 0xff00) >> 8) | - |
1559 | )); | - |
1560 | } never executed: end of block | 0 |
1561 | } | - |
1562 | else if ((TRUE | evaluated 21 times by 1 test | FALSE | evaluated 5 times by 1 test |
jobs[(j)]->state == JRUNNING)TRUE | evaluated 21 times by 1 test | FALSE | evaluated 5 times by 1 test |
) | 5-21 |
1563 | temp = executed 21 times by 1 test: temp = dcgettext (((void *)0), "Running" , 5) ; | 21 |
1564 | dcgettext (((void *)0), executed 21 times by 1 test: temp = dcgettext (((void *)0), "Running" , 5) ; | 21 |
1565 | "Running"executed 21 times by 1 test: temp = dcgettext (((void *)0), "Running" , 5) ; | 21 |
1566 | , 5)executed 21 times by 1 test: temp = dcgettext (((void *)0), "Running" , 5) ; | 21 |
1567 | ;executed 21 times by 1 test: temp = dcgettext (((void *)0), "Running" , 5) ; | 21 |
1568 | else | - |
1569 | { | - |
1570 | if ( | - |
1571 | (((TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
| 0-5 |
1572 | p->statusTRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
| 0-5 |
1573 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
| 0-5 |
1574 | ) | - |
1575 | temp = j_strsignal ( never executed: temp = j_strsignal ( ((( p->status ) & 0xff00) >> 8) ); | 0 |
1576 | ((( never executed: temp = j_strsignal ( ((( p->status ) & 0xff00) >> 8) ); | 0 |
1577 | p->status never executed: temp = j_strsignal ( ((( p->status ) & 0xff00) >> 8) ); | 0 |
1578 | ) & 0xff00) >> 8) never executed: temp = j_strsignal ( ((( p->status ) & 0xff00) >> 8) ); | 0 |
1579 | ); never executed: temp = j_strsignal ( ((( p->status ) & 0xff00) >> 8) ); | 0 |
1580 | else if ( | - |
1581 | (((TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
signed char) (((TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1582 | p->statusTRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1583 | ) & 0x7f) + 1) >> 1) > 0)TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1584 | ) | - |
1585 | temp = j_strsignal (executed 5 times by 1 test: temp = j_strsignal ( (( p->status ) & 0x7f) ); | 5 |
1586 | ((executed 5 times by 1 test: temp = j_strsignal ( (( p->status ) & 0x7f) ); | 5 |
1587 | p->statusexecuted 5 times by 1 test: temp = j_strsignal ( (( p->status ) & 0x7f) ); | 5 |
1588 | ) & 0x7f)executed 5 times by 1 test: temp = j_strsignal ( (( p->status ) & 0x7f) ); | 5 |
1589 | );executed 5 times by 1 test: temp = j_strsignal ( (( p->status ) & 0x7f) ); | 5 |
1590 | else if ( | - |
1591 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1592 | p->statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1593 | ) & 0x7f) == 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1594 | ) | - |
1595 | { | - |
1596 | temp = retcode_name_buffer; | - |
1597 | es = | - |
1598 | ((( | - |
1599 | p->status | - |
1600 | ) & 0xff00) >> 8) | - |
1601 | ; | - |
1602 | if (es == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1603 | { | - |
1604 | | - |
1605 | __builtin_strncpy ( | - |
1606 | temp | - |
1607 | , dcgettext (((void *)0), | - |
1608 | "Done" | - |
1609 | , 5), | - |
1610 | sizeof (retcode_name_buffer) - 1 | - |
1611 | ) | - |
1612 | ; | - |
1613 | temp[sizeof (retcode_name_buffer) - 1] = '\0'; | - |
1614 | } never executed: end of block | 0 |
1615 | else if (posixly_correctTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1616 | snprintf (temp, sizeof(retcode_name_buffer), never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Done(%d)" , 5) , es); | 0 |
1617 | dcgettext (((void *)0), never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Done(%d)" , 5) , es); | 0 |
1618 | "Done(%d)" never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Done(%d)" , 5) , es); | 0 |
1619 | , 5) never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Done(%d)" , 5) , es); | 0 |
1620 | , es); never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Done(%d)" , 5) , es); | 0 |
1621 | else | - |
1622 | snprintf (temp, sizeof(retcode_name_buffer), never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Exit %d" , 5) , es); | 0 |
1623 | dcgettext (((void *)0), never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Exit %d" , 5) , es); | 0 |
1624 | "Exit %d" never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Exit %d" , 5) , es); | 0 |
1625 | , 5) never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Exit %d" , 5) , es); | 0 |
1626 | , es); never executed: snprintf (temp, sizeof(retcode_name_buffer), dcgettext (((void *)0), "Exit %d" , 5) , es); | 0 |
1627 | } | - |
1628 | else | - |
1629 | temp = never executed: temp = dcgettext (((void *)0), "Unknown status" , 5) ; | 0 |
1630 | dcgettext (((void *)0), never executed: temp = dcgettext (((void *)0), "Unknown status" , 5) ; | 0 |
1631 | "Unknown status" never executed: temp = dcgettext (((void *)0), "Unknown status" , 5) ; | 0 |
1632 | , 5) never executed: temp = dcgettext (((void *)0), "Unknown status" , 5) ; | 0 |
1633 | ; never executed: temp = dcgettext (((void *)0), "Unknown status" , 5) ; | 0 |
1634 | } | - |
1635 | | - |
1636 | returnexecuted 29 times by 1 test: return temp; temp;executed 29 times by 1 test: return temp; | 29 |
1637 | } | - |
1638 | static void | - |
1639 | print_pipeline (p, job_index, format, stream) | - |
1640 | PROCESS *p; | - |
1641 | int job_index, format; | - |
1642 | FILE *stream; | - |
1643 | { | - |
1644 | PROCESS *first, *last, *show; | - |
1645 | int es, name_padding; | - |
1646 | char *temp; | - |
1647 | | - |
1648 | if (p == 0TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1649 | return; never executed: return; | 0 |
1650 | | - |
1651 | first = last = p; | - |
1652 | while (last->next != firstTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1653 | last = last->next; never executed: last = last->next; | 0 |
1654 | | - |
1655 | for (;;) | - |
1656 | { | - |
1657 | if (p != firstTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1658 | fprintf (stream, format ? " " : " |"); never executed: fprintf (stream, format ? " " : " |"); | 0 |
1659 | | - |
1660 | if (format != 0TRUE | evaluated 5 times by 1 test | FALSE | evaluated 24 times by 1 test |
) | 5-24 |
1661 | fprintf (stream, "%5ld", (long)p->pid);executed 5 times by 1 test: fprintf (stream, "%5ld", (long)p->pid); | 5 |
1662 | | - |
1663 | fprintf (stream, " "); | - |
1664 | | - |
1665 | if (format > -1TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
&& job_index >= 0TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) | 0-29 |
1666 | { | - |
1667 | show = formatTRUE | evaluated 5 times by 1 test | FALSE | evaluated 24 times by 1 test |
? p : last; | 5-24 |
1668 | temp = printable_job_status (job_index, show, format); | - |
1669 | | - |
1670 | if (p != firstTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1671 | { | - |
1672 | if (formatTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1673 | { | - |
1674 | if (show->running == first->runningTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1675 | (TRUE | never evaluated | FALSE | never evaluated |
show->status) == (first->status)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1676 | temp = ""; never executed: temp = ""; | 0 |
1677 | } never executed: end of block | 0 |
1678 | else | - |
1679 | temp = (char *) never executed: temp = (char *) ((void *)0) ; | 0 |
1680 | ((void *)0) never executed: temp = (char *) ((void *)0) ; | 0 |
1681 | ; never executed: temp = (char *) ((void *)0) ; | 0 |
1682 | } | - |
1683 | | - |
1684 | if (tempTRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) | 0-29 |
1685 | { | - |
1686 | fprintf (stream, "%s", temp); | - |
1687 | | - |
1688 | es = (((TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
temp)TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
temp)[0]TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) ? ((TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
temp)[1]TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
? ((TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
temp)[2]TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
? strlen(temp) : 2) : 1) : 0); | 0-29 |
1689 | if (es == 0TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1690 | es = 2; never executed: es = 2; | 0 |
1691 | name_padding = 24 - es; | - |
1692 | | - |
1693 | fprintf (stream, "%*s", name_padding, ""); | - |
1694 | | - |
1695 | if ((TRUE | evaluated 26 times by 1 test | FALSE | evaluated 3 times by 1 test |
| 3-26 |
1696 | (((TRUE | evaluated 26 times by 1 test | FALSE | evaluated 3 times by 1 test |
| 3-26 |
1697 | show->statusTRUE | evaluated 26 times by 1 test | FALSE | evaluated 3 times by 1 test |
| 3-26 |
1698 | ) & 0xff) == 0x7f) TRUE | evaluated 26 times by 1 test | FALSE | evaluated 3 times by 1 test |
| 3-26 |
1699 | == 0)TRUE | evaluated 26 times by 1 test | FALSE | evaluated 3 times by 1 test |
&& | 3-26 |
1700 | (TRUE | evaluated 25 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-25 |
1701 | ((TRUE | evaluated 25 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-25 |
1702 | show->statusTRUE | evaluated 25 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-25 |
1703 | ) == 0xffff) TRUE | evaluated 25 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-25 |
1704 | == 0)TRUE | evaluated 25 times by 1 test | FALSE | evaluated 1 time by 1 test |
&& | 1-25 |
1705 | ((TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
show->status) & 0200)TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
) | 0-25 |
1706 | fprintf (stream, never executed: fprintf (stream, dcgettext (((void *)0), "(core dumped) " , 5) ); | 0 |
1707 | dcgettext (((void *)0), never executed: fprintf (stream, dcgettext (((void *)0), "(core dumped) " , 5) ); | 0 |
1708 | "(core dumped) " never executed: fprintf (stream, dcgettext (((void *)0), "(core dumped) " , 5) ); | 0 |
1709 | , 5) never executed: fprintf (stream, dcgettext (((void *)0), "(core dumped) " , 5) ); | 0 |
1710 | ); never executed: fprintf (stream, dcgettext (((void *)0), "(core dumped) " , 5) ); | 0 |
1711 | }executed 29 times by 1 test: end of block | 29 |
1712 | }executed 29 times by 1 test: end of block | 29 |
1713 | | - |
1714 | if (p != firstTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
&& formatTRUE | never evaluated | FALSE | never evaluated |
) | 0-29 |
1715 | fprintf (stream, "| "); never executed: fprintf (stream, "| "); | 0 |
1716 | | - |
1717 | if (p->commandTRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) | 0-29 |
1718 | fprintf (stream, "%s", p->command);executed 29 times by 1 test: fprintf (stream, "%s", p->command); | 29 |
1719 | | - |
1720 | if (p == lastTRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
&& job_index >= 0TRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) | 0-29 |
1721 | { | - |
1722 | temp = current_working_directory (); | - |
1723 | | - |
1724 | if ((TRUE | evaluated 21 times by 1 test | FALSE | evaluated 8 times by 1 test |
jobs[(job_index)]->state == JRUNNING)TRUE | evaluated 21 times by 1 test | FALSE | evaluated 8 times by 1 test |
&& (((TRUE | evaluated 21 times by 1 test | FALSE | never evaluated |
jobs[job_index]->flags & 0x01) != 0) == 0)TRUE | evaluated 21 times by 1 test | FALSE | never evaluated |
) | 0-21 |
1725 | fprintf (stream, " &");executed 21 times by 1 test: fprintf (stream, " &"); | 21 |
1726 | | - |
1727 | if ( | - |
1728 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1729 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1730 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1731 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1732 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1733 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1734 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1735 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1736 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1737 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1738 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1739 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1740 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1741 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1742 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1743 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1744 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1745 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1746 | , TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1747 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1748 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1749 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1750 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1751 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1752 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1753 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1754 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1755 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1756 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1757 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1758 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1759 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1760 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1761 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1762 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1763 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1764 | , TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1765 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1766 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1767 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1768 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1769 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1770 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1771 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1772 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1773 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1774 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( temp ))[3] - __s2[3]); TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1775 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( temp ))[3] - __s2[3]); | 0-29 |
1776 | ))[3] - __s2[3]);TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( temp ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1777 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1778 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1779 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1780 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1781 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1782 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1783 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1784 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1785 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1786 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1787 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1788 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1789 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1790 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1791 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1792 | , TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1793 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1794 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1795 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1796 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1797 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1798 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1799 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1800 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1801 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1802 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( jobs[job_index]->wd ))[3] - __s2[3]); TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1803 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job_index]->wd ))[3] - __s2[3]); | 0-29 |
1804 | ))[3] - __s2[3]);TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job_index]->wd ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1805 | tempTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1806 | , TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1807 | jobs[job_index]->wdTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1808 | )))); }) TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
| 0-29 |
1809 | != 0TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1810 | fprintf (stream, never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1811 | never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1812 | dcgettext (((void *)0), never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1813 | " (wd: %s)" never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1814 | , 5) never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1815 | , polite_directory_format (jobs[job_index]->wd)); never executed: fprintf (stream, dcgettext (((void *)0), " (wd: %s)" , 5) , polite_directory_format (jobs[job_index]->wd)); | 0 |
1816 | }executed 29 times by 1 test: end of block | 29 |
1817 | | - |
1818 | if (formatTRUE | evaluated 5 times by 1 test | FALSE | evaluated 24 times by 1 test |
|| (TRUE | evaluated 24 times by 1 test | FALSE | never evaluated |
p == last)TRUE | evaluated 24 times by 1 test | FALSE | never evaluated |
) | 0-24 |
1819 | { | - |
1820 | | - |
1821 | | - |
1822 | | - |
1823 | | - |
1824 | | - |
1825 | if (asynchronous_notificationTRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
&& interactiveTRUE | never evaluated | FALSE | never evaluated |
) | 0-29 |
1826 | fprintf (stream, "\r\n"); never executed: fprintf (stream, "\r\n"); | 0 |
1827 | else | - |
1828 | fprintf (stream, "\n");executed 29 times by 1 test: fprintf (stream, "\n"); | 29 |
1829 | } | - |
1830 | | - |
1831 | if (p == lastTRUE | evaluated 29 times by 1 test | FALSE | never evaluated |
) | 0-29 |
1832 | break;executed 29 times by 1 test: break; | 29 |
1833 | p = p->next; | - |
1834 | } never executed: end of block | 0 |
1835 | fflush (stream); | - |
1836 | }executed 29 times by 1 test: end of block | 29 |
1837 | | - |
1838 | | - |
1839 | | - |
1840 | static void | - |
1841 | pretty_print_job (job_index, format, stream) | - |
1842 | int job_index, format; | - |
1843 | FILE *stream; | - |
1844 | { | - |
1845 | register PROCESS *p; | - |
1846 | | - |
1847 | | - |
1848 | if (format == 2TRUE | evaluated 2 times by 1 test | FALSE | evaluated 29 times by 1 test |
) | 2-29 |
1849 | { | - |
1850 | fprintf (stream, "%ld\n", (long)jobs[job_index]->pipe->pid); | - |
1851 | return;executed 2 times by 1 test: return; | 2 |
1852 | } | - |
1853 | | - |
1854 | if (format == 3TRUE | never evaluated | FALSE | evaluated 29 times by 1 test |
) | 0-29 |
1855 | { | - |
1856 | if (((TRUE | never evaluated | FALSE | never evaluated |
jobs[job_index]->flags & 0x02) != 0)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1857 | return; never executed: return; | 0 |
1858 | format = 0; | - |
1859 | } never executed: end of block | 0 |
1860 | | - |
1861 | if (format != 4TRUE | evaluated 24 times by 1 test | FALSE | evaluated 5 times by 1 test |
) | 5-24 |
1862 | fprintf (stream, "[%d]%c ", job_index + 1,executed 24 times by 1 test: fprintf (stream, "[%d]%c ", job_index + 1, (job_index == js.j_current) ? '+': (job_index == js.j_previous) ? '-' : ' '); | 24 |
1863 | (job_index == js.j_current) ? '+':executed 24 times by 1 test: fprintf (stream, "[%d]%c ", job_index + 1, (job_index == js.j_current) ? '+': (job_index == js.j_previous) ? '-' : ' '); | 24 |
1864 | (job_index == js.j_previous) ? '-' : ' ');executed 24 times by 1 test: fprintf (stream, "[%d]%c ", job_index + 1, (job_index == js.j_current) ? '+': (job_index == js.j_previous) ? '-' : ' '); | 24 |
1865 | | - |
1866 | if (format == 4TRUE | evaluated 5 times by 1 test | FALSE | evaluated 24 times by 1 test |
) | 5-24 |
1867 | format = 1;executed 5 times by 1 test: format = 1; | 5 |
1868 | | - |
1869 | p = jobs[job_index]->pipe; | - |
1870 | | - |
1871 | print_pipeline (p, job_index, format, stream); | - |
1872 | | - |
1873 | | - |
1874 | | - |
1875 | jobs[job_index]->flags |= 0x02; | - |
1876 | }executed 29 times by 1 test: end of block | 29 |
1877 | | - |
1878 | static int | - |
1879 | print_job (job, format, state, job_index) | - |
1880 | JOB *job; | - |
1881 | int format, state, job_index; | - |
1882 | { | - |
1883 | if (state == -1TRUE | evaluated 12 times by 1 test | FALSE | evaluated 17 times by 1 test |
|| (TRUE | evaluated 10 times by 1 test | FALSE | evaluated 7 times by 1 test |
JOB_STATE)state == job->stateTRUE | evaluated 10 times by 1 test | FALSE | evaluated 7 times by 1 test |
) | 7-17 |
1884 | pretty_print_job (job_index, format, executed 22 times by 1 test: pretty_print_job (job_index, format, stdout ); | 22 |
1885 | stdoutexecuted 22 times by 1 test: pretty_print_job (job_index, format, stdout ); | 22 |
1886 | );executed 22 times by 1 test: pretty_print_job (job_index, format, stdout ); | 22 |
1887 | returnexecuted 29 times by 1 test: return (0); (0);executed 29 times by 1 test: return (0); | 29 |
1888 | } | - |
1889 | | - |
1890 | void | - |
1891 | list_one_job (job, format, ignore, job_index) | - |
1892 | JOB *job; | - |
1893 | int format, ignore, job_index; | - |
1894 | { | - |
1895 | pretty_print_job (job_index, format, | - |
1896 | stdout | - |
1897 | ); | - |
1898 | }executed 4 times by 1 test: end of block | 4 |
1899 | | - |
1900 | void | - |
1901 | list_stopped_jobs (format) | - |
1902 | int format; | - |
1903 | { | - |
1904 | cleanup_dead_jobs (); | - |
1905 | map_over_jobs (print_job, format, (int)JSTOPPED); | - |
1906 | }executed 3 times by 1 test: end of block | 3 |
1907 | | - |
1908 | void | - |
1909 | list_running_jobs (format) | - |
1910 | int format; | - |
1911 | { | - |
1912 | cleanup_dead_jobs (); | - |
1913 | map_over_jobs (print_job, format, (int)JRUNNING); | - |
1914 | }executed 4 times by 1 test: end of block | 4 |
1915 | | - |
1916 | | - |
1917 | | - |
1918 | void | - |
1919 | list_all_jobs (format) | - |
1920 | int format; | - |
1921 | { | - |
1922 | cleanup_dead_jobs (); | - |
1923 | map_over_jobs (print_job, format, -1); | - |
1924 | }executed 7 times by 1 test: end of block | 7 |
1925 | | - |
1926 | | - |
1927 | | - |
1928 | | - |
1929 | | - |
1930 | pid_t | - |
1931 | make_child (command, async_p) | - |
1932 | char *command; | - |
1933 | int async_p; | - |
1934 | { | - |
1935 | int forksleep; | - |
1936 | sigset_t set, oset; | - |
1937 | pid_t pid; | - |
1938 | | - |
1939 | | - |
1940 | | - |
1941 | sigemptyset (&set); | - |
1942 | sigaddset (&set, | - |
1943 | 17 | - |
1944 | ); | - |
1945 | sigaddset (&set, | - |
1946 | 2 | - |
1947 | ); | - |
1948 | sigemptyset (&oset); | - |
1949 | sigprocmask ( | - |
1950 | 0 | - |
1951 | , &set, &oset); | - |
1952 | | - |
1953 | making_children (); | - |
1954 | | - |
1955 | forksleep = 1; | - |
1956 | | - |
1957 | | - |
1958 | | - |
1959 | | - |
1960 | | - |
1961 | | - |
1962 | if (default_buffered_input != -1TRUE | evaluated 3984408 times by 1 test | FALSE | evaluated 9455 times by 1 test |
&& | 9455-3984408 |
1963 | (!async_pTRUE | evaluated 3305145 times by 1 test | FALSE | evaluated 679263 times by 1 test |
|| default_buffered_input > 0TRUE | evaluated 679263 times by 1 test | FALSE | never evaluated |
)) | 0-3305145 |
1964 | sync_buffered_stream (default_buffered_input);executed 3984408 times by 1 test: sync_buffered_stream (default_buffered_input); | 3984408 |
1965 | | - |
1966 | | - |
1967 | do { sigterm_received = 0; } while (0); | - |
1968 | | - |
1969 | | - |
1970 | while ((TRUE | never evaluated | FALSE | evaluated 3993863 times by 1 test |
pid = fork ()) < 0TRUE | never evaluated | FALSE | evaluated 3993863 times by 1 test |
&& | 0-3993863 |
1971 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1972 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1973 | 11TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1974 | && forksleep < 16TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1975 | { | - |
1976 | | - |
1977 | sigprocmask ( | - |
1978 | 2 | - |
1979 | , &oset, (sigset_t *) | - |
1980 | ((void *)0) | - |
1981 | ); | - |
1982 | | - |
1983 | waitchld (-1, 0); | - |
1984 | | - |
1985 | | - |
1986 | (*__errno_location ()) | - |
1987 | = | - |
1988 | 11 | - |
1989 | ; | - |
1990 | sys_error ("fork: retry"); | - |
1991 | do { sigterm_received = 0; } while (0); | - |
1992 | | - |
1993 | if (sleep (forksleep) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1994 | break; never executed: break; | 0 |
1995 | forksleep <<= 1; | - |
1996 | | - |
1997 | if (interrupt_stateTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1998 | break; never executed: break; | 0 |
1999 | sigprocmask ( | - |
2000 | 2 | - |
2001 | , &set, (sigset_t *) | - |
2002 | ((void *)0) | - |
2003 | ); | - |
2004 | } never executed: end of block | 0 |
2005 | | - |
2006 | if (pid != 0TRUE | evaluated 3987239 times by 1 test | FALSE | evaluated 6624 times by 1 test |
) | 6624-3987239 |
2007 | do { sigterm_received = 0; }executed 3987239 times by 1 test: end of block while (0); | 3987239 |
2008 | | - |
2009 | if (pid < 0TRUE | never evaluated | FALSE | evaluated 3993863 times by 1 test |
) | 0-3993863 |
2010 | { | - |
2011 | sys_error ("fork"); | - |
2012 | | - |
2013 | | - |
2014 | terminate_current_pipeline (); | - |
2015 | | - |
2016 | | - |
2017 | if (the_pipelineTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2018 | kill_current_pipeline (); never executed: kill_current_pipeline (); | 0 |
2019 | | - |
2020 | last_command_exit_value = 126; | - |
2021 | throw_to_top_level (); | - |
2022 | } never executed: end of block | 0 |
2023 | | - |
2024 | if (pid == 0TRUE | evaluated 6624 times by 1 test | FALSE | evaluated 3987239 times by 1 test |
) | 6624-3987239 |
2025 | { | - |
2026 | | - |
2027 | | - |
2028 | pid_t mypid; | - |
2029 | | - |
2030 | | - |
2031 | | - |
2032 | | - |
2033 | mypid = getpid (); | - |
2034 | | - |
2035 | | - |
2036 | | - |
2037 | | - |
2038 | unset_bash_input (0); | - |
2039 | | - |
2040 | | - |
2041 | interrupt_state = 0; | - |
2042 | | - |
2043 | | - |
2044 | sigprocmask ( | - |
2045 | 2 | - |
2046 | , &top_level_mask, (sigset_t *) | - |
2047 | ((void *)0) | - |
2048 | ); | - |
2049 | | - |
2050 | if (job_controlTRUE | evaluated 5 times by 1 test | FALSE | evaluated 6619 times by 1 test |
) | 5-6619 |
2051 | { | - |
2052 | | - |
2053 | | - |
2054 | | - |
2055 | if (pipeline_pgrp == 0TRUE | evaluated 2 times by 1 test | FALSE | evaluated 3 times by 1 test |
) | 2-3 |
2056 | pipeline_pgrp = mypid;executed 2 times by 1 test: pipeline_pgrp = mypid; | 2 |
2057 | | - |
2058 | | - |
2059 | if (pipeline_pgrp == shell_pgrpTRUE | evaluated 1 time by 1 test | FALSE | evaluated 4 times by 1 test |
) | 1-4 |
2060 | ignore_tty_job_signals ();executed 1 time by 1 test: ignore_tty_job_signals (); | 1 |
2061 | else | - |
2062 | default_tty_job_signals ();executed 4 times by 1 test: default_tty_job_signals (); | 4 |
2063 | if (setpgid (mypid, pipeline_pgrp) < 0TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-5 |
2064 | sys_error ( never executed: sys_error ( dcgettext (((void *)0), "child setpgid (%ld to %ld)" , 5) , (long)mypid, (long)pipeline_pgrp); | 0 |
2065 | dcgettext (((void *)0), never executed: sys_error ( dcgettext (((void *)0), "child setpgid (%ld to %ld)" , 5) , (long)mypid, (long)pipeline_pgrp); | 0 |
2066 | "child setpgid (%ld to %ld)" never executed: sys_error ( dcgettext (((void *)0), "child setpgid (%ld to %ld)" , 5) , (long)mypid, (long)pipeline_pgrp); | 0 |
2067 | , 5) never executed: sys_error ( dcgettext (((void *)0), "child setpgid (%ld to %ld)" , 5) , (long)mypid, (long)pipeline_pgrp); | 0 |
2068 | , (long)mypid, (long)pipeline_pgrp); never executed: sys_error ( dcgettext (((void *)0), "child setpgid (%ld to %ld)" , 5) , (long)mypid, (long)pipeline_pgrp); | 0 |
2069 | | - |
2070 | | - |
2071 | | - |
2072 | | - |
2073 | | - |
2074 | | - |
2075 | | - |
2076 | if (async_p == 0TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
&& pipeline_pgrp != shell_pgrpTRUE | evaluated 2 times by 1 test | FALSE | evaluated 1 time by 1 test |
&& ((TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
subshell_environment&(0x01|0x10)) == 0)TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& running_in_background == 0TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-3 |
2077 | give_terminal_to (pipeline_pgrp, 0); never executed: give_terminal_to (pipeline_pgrp, 0); | 0 |
2078 | | - |
2079 | | - |
2080 | if (pipeline_pgrp == mypidTRUE | evaluated 2 times by 1 test | FALSE | evaluated 3 times by 1 test |
) | 2-3 |
2081 | pipe_read (pgrp_pipe);executed 2 times by 1 test: pipe_read (pgrp_pipe); | 2 |
2082 | | - |
2083 | }executed 5 times by 1 test: end of block | 5 |
2084 | else | - |
2085 | { | - |
2086 | if (pipeline_pgrp == 0TRUE | evaluated 518 times by 1 test | FALSE | evaluated 6101 times by 1 test |
) | 518-6101 |
2087 | pipeline_pgrp = shell_pgrp;executed 518 times by 1 test: pipeline_pgrp = shell_pgrp; | 518 |
2088 | default_tty_job_signals (); | - |
2089 | }executed 6619 times by 1 test: end of block | 6619 |
2090 | | - |
2091 | | - |
2092 | | - |
2093 | | - |
2094 | sh_closepipe (pgrp_pipe); | - |
2095 | }executed 6624 times by 1 test: end of block | 6624 |
2096 | else | - |
2097 | { | - |
2098 | | - |
2099 | | - |
2100 | | - |
2101 | if (job_controlTRUE | evaluated 51 times by 1 test | FALSE | evaluated 3987188 times by 1 test |
) | 51-3987188 |
2102 | { | - |
2103 | if (pipeline_pgrp == 0TRUE | evaluated 47 times by 1 test | FALSE | evaluated 4 times by 1 test |
) | 4-47 |
2104 | { | - |
2105 | pipeline_pgrp = pid; | - |
2106 | | - |
2107 | | - |
2108 | | - |
2109 | }executed 47 times by 1 test: end of block | 47 |
2110 | | - |
2111 | | - |
2112 | | - |
2113 | | - |
2114 | setpgid (pid, pipeline_pgrp); | - |
2115 | }executed 51 times by 1 test: end of block | 51 |
2116 | else | - |
2117 | { | - |
2118 | if (pipeline_pgrp == 0TRUE | evaluated 42013 times by 1 test | FALSE | evaluated 3945175 times by 1 test |
) | 42013-3945175 |
2119 | pipeline_pgrp = shell_pgrp;executed 42013 times by 1 test: pipeline_pgrp = shell_pgrp; | 42013 |
2120 | }executed 3987188 times by 1 test: end of block | 3987188 |
2121 | | - |
2122 | | - |
2123 | | - |
2124 | add_process (command, pid); | - |
2125 | | - |
2126 | if (async_pTRUE | evaluated 677881 times by 1 test | FALSE | evaluated 3309358 times by 1 test |
) | 677881-3309358 |
2127 | last_asynchronous_pid = pid;executed 677881 times by 1 test: last_asynchronous_pid = pid; | 677881 |
2128 | delete_old_job (pid); | - |
2129 | | - |
2130 | | - |
2131 | | - |
2132 | bgp_delete (pid); | - |
2133 | | - |
2134 | last_made_pid = pid; | - |
2135 | | - |
2136 | | - |
2137 | js.c_totforked++; | - |
2138 | js.c_living++; | - |
2139 | | - |
2140 | | - |
2141 | | - |
2142 | | - |
2143 | sigprocmask ( | - |
2144 | 2 | - |
2145 | , &oset, (sigset_t *) | - |
2146 | ((void *)0) | - |
2147 | ); | - |
2148 | }executed 3987239 times by 1 test: end of block | 3987239 |
2149 | | - |
2150 | returnexecuted 3993863 times by 1 test: return (pid); (pid);executed 3993863 times by 1 test: return (pid); | 3993863 |
2151 | } | - |
2152 | | - |
2153 | | - |
2154 | void | - |
2155 | ignore_tty_job_signals () | - |
2156 | { | - |
2157 | set_signal_handler ( | - |
2158 | 20 | - |
2159 | , | - |
2160 | ((__sighandler_t) 1) | - |
2161 | ); | - |
2162 | set_signal_handler ( | - |
2163 | 21 | - |
2164 | , | - |
2165 | ((__sighandler_t) 1) | - |
2166 | ); | - |
2167 | set_signal_handler ( | - |
2168 | 22 | - |
2169 | , | - |
2170 | ((__sighandler_t) 1) | - |
2171 | ); | - |
2172 | }executed 1 time by 1 test: end of block | 1 |
2173 | | - |
2174 | | - |
2175 | | - |
2176 | | - |
2177 | | - |
2178 | void | - |
2179 | default_tty_job_signals () | - |
2180 | { | - |
2181 | if (signal_is_trapped (TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2182 | 20TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2183 | ) == 0TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
&& signal_is_hard_ignored (TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2184 | 20TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2185 | )TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
) | 0-6623 |
2186 | set_signal_handler ( never executed: set_signal_handler ( 20 , ((__sighandler_t) 1) ); | 0 |
2187 | 20 never executed: set_signal_handler ( 20 , ((__sighandler_t) 1) ); | 0 |
2188 | , never executed: set_signal_handler ( 20 , ((__sighandler_t) 1) ); | 0 |
2189 | ((__sighandler_t) 1) never executed: set_signal_handler ( 20 , ((__sighandler_t) 1) ); | 0 |
2190 | ); never executed: set_signal_handler ( 20 , ((__sighandler_t) 1) ); | 0 |
2191 | else | - |
2192 | set_signal_handler (executed 6623 times by 1 test: set_signal_handler ( 20 , ((__sighandler_t) 0) ); | 6623 |
2193 | 20executed 6623 times by 1 test: set_signal_handler ( 20 , ((__sighandler_t) 0) ); | 6623 |
2194 | , executed 6623 times by 1 test: set_signal_handler ( 20 , ((__sighandler_t) 0) ); | 6623 |
2195 | ((__sighandler_t) 0)executed 6623 times by 1 test: set_signal_handler ( 20 , ((__sighandler_t) 0) ); | 6623 |
2196 | );executed 6623 times by 1 test: set_signal_handler ( 20 , ((__sighandler_t) 0) ); | 6623 |
2197 | | - |
2198 | if (signal_is_trapped (TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2199 | 21TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2200 | ) == 0TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
&& signal_is_hard_ignored (TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2201 | 21TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2202 | )TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
) | 0-6623 |
2203 | set_signal_handler ( never executed: set_signal_handler ( 21 , ((__sighandler_t) 1) ); | 0 |
2204 | 21 never executed: set_signal_handler ( 21 , ((__sighandler_t) 1) ); | 0 |
2205 | , never executed: set_signal_handler ( 21 , ((__sighandler_t) 1) ); | 0 |
2206 | ((__sighandler_t) 1) never executed: set_signal_handler ( 21 , ((__sighandler_t) 1) ); | 0 |
2207 | ); never executed: set_signal_handler ( 21 , ((__sighandler_t) 1) ); | 0 |
2208 | else | - |
2209 | set_signal_handler (executed 6623 times by 1 test: set_signal_handler ( 21 , ((__sighandler_t) 0) ); | 6623 |
2210 | 21executed 6623 times by 1 test: set_signal_handler ( 21 , ((__sighandler_t) 0) ); | 6623 |
2211 | , executed 6623 times by 1 test: set_signal_handler ( 21 , ((__sighandler_t) 0) ); | 6623 |
2212 | ((__sighandler_t) 0)executed 6623 times by 1 test: set_signal_handler ( 21 , ((__sighandler_t) 0) ); | 6623 |
2213 | );executed 6623 times by 1 test: set_signal_handler ( 21 , ((__sighandler_t) 0) ); | 6623 |
2214 | | - |
2215 | if (signal_is_trapped (TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2216 | 22TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
| 0-6623 |
2217 | ) == 0TRUE | evaluated 6623 times by 1 test | FALSE | never evaluated |
&& signal_is_hard_ignored (TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2218 | 22TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
| 0-6623 |
2219 | )TRUE | never evaluated | FALSE | evaluated 6623 times by 1 test |
) | 0-6623 |
2220 | set_signal_handler ( never executed: set_signal_handler ( 22 , ((__sighandler_t) 1) ); | 0 |
2221 | 22 never executed: set_signal_handler ( 22 , ((__sighandler_t) 1) ); | 0 |
2222 | , never executed: set_signal_handler ( 22 , ((__sighandler_t) 1) ); | 0 |
2223 | ((__sighandler_t) 1) never executed: set_signal_handler ( 22 , ((__sighandler_t) 1) ); | 0 |
2224 | ); never executed: set_signal_handler ( 22 , ((__sighandler_t) 1) ); | 0 |
2225 | else | - |
2226 | set_signal_handler (executed 6623 times by 1 test: set_signal_handler ( 22 , ((__sighandler_t) 0) ); | 6623 |
2227 | 22executed 6623 times by 1 test: set_signal_handler ( 22 , ((__sighandler_t) 0) ); | 6623 |
2228 | , executed 6623 times by 1 test: set_signal_handler ( 22 , ((__sighandler_t) 0) ); | 6623 |
2229 | ((__sighandler_t) 0)executed 6623 times by 1 test: set_signal_handler ( 22 , ((__sighandler_t) 0) ); | 6623 |
2230 | );executed 6623 times by 1 test: set_signal_handler ( 22 , ((__sighandler_t) 0) ); | 6623 |
2231 | } | - |
2232 | | - |
2233 | | - |
2234 | void | - |
2235 | get_original_tty_job_signals () | - |
2236 | { | - |
2237 | static int fetched = 0; | - |
2238 | | - |
2239 | if (fetched == 0TRUE | evaluated 5432 times by 1 test | FALSE | evaluated 16 times by 1 test |
) | 16-5432 |
2240 | { | - |
2241 | if (interactive_shellTRUE | evaluated 2 times by 1 test | FALSE | evaluated 5430 times by 1 test |
) | 2-5430 |
2242 | { | - |
2243 | set_original_signal ( | - |
2244 | 20 | - |
2245 | , | - |
2246 | ((__sighandler_t) 0) | - |
2247 | ); | - |
2248 | set_original_signal ( | - |
2249 | 21 | - |
2250 | , | - |
2251 | ((__sighandler_t) 0) | - |
2252 | ); | - |
2253 | set_original_signal ( | - |
2254 | 22 | - |
2255 | , | - |
2256 | ((__sighandler_t) 0) | - |
2257 | ); | - |
2258 | }executed 2 times by 1 test: end of block | 2 |
2259 | else | - |
2260 | { | - |
2261 | get_original_signal ( | - |
2262 | 20 | - |
2263 | ); | - |
2264 | get_original_signal ( | - |
2265 | 21 | - |
2266 | ); | - |
2267 | get_original_signal ( | - |
2268 | 22 | - |
2269 | ); | - |
2270 | }executed 5430 times by 1 test: end of block | 5430 |
2271 | fetched = 1; | - |
2272 | }executed 5432 times by 1 test: end of block | 5432 |
2273 | }executed 5448 times by 1 test: end of block | 5448 |
2274 | | - |
2275 | | - |
2276 | | - |
2277 | | - |
2278 | | - |
2279 | static struct termios shell_tty_info; | - |
2280 | int | - |
2281 | get_tty_state () | - |
2282 | { | - |
2283 | int tty; | - |
2284 | | - |
2285 | tty = (TRUE | evaluated 16 times by 1 test | FALSE | never evaluated |
shell_tty != -1)TRUE | evaluated 16 times by 1 test | FALSE | never evaluated |
? shell_tty : fileno ( | 0-16 |
2286 | stderr | - |
2287 | ); | - |
2288 | if (tty != -1TRUE | evaluated 16 times by 1 test | FALSE | never evaluated |
) | 0-16 |
2289 | { | - |
2290 | if (tcgetattr (tty, &shell_tty_info) < 0TRUE | evaluated 16 times by 1 test | FALSE | never evaluated |
) | 0-16 |
2291 | { | - |
2292 | | - |
2293 | | - |
2294 | | - |
2295 | | - |
2296 | | - |
2297 | | - |
2298 | returnexecuted 16 times by 1 test: return -1; -1;executed 16 times by 1 test: return -1; | 16 |
2299 | } | - |
2300 | | - |
2301 | if (check_window_sizeTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2302 | get_new_window_size (0, (int *)0, (int *)0); never executed: get_new_window_size (0, (int *)0, (int *)0); | 0 |
2303 | } never executed: end of block | 0 |
2304 | return never executed: return 0; 0;never executed: return 0; | 0 |
2305 | } | - |
2306 | | - |
2307 | | - |
2308 | int | - |
2309 | set_tty_state () | - |
2310 | { | - |
2311 | int tty; | - |
2312 | | - |
2313 | tty = (TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
shell_tty != -1)TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
? shell_tty : fileno ( | 0-13 |
2314 | stderr | - |
2315 | ); | - |
2316 | if (tty != -1TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
) | 0-13 |
2317 | { | - |
2318 | if (tcsetattr (tty, TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
| 0-13 |
2319 | 1TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
| 0-13 |
2320 | , &shell_tty_info) < 0TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
) | 0-13 |
2321 | { | - |
2322 | | - |
2323 | | - |
2324 | if (interactiveTRUE | never evaluated | FALSE | evaluated 13 times by 1 test |
) | 0-13 |
2325 | sys_error ("[%ld: %d (%d)] tcsetattr", (long)getpid (), shell_level, tty); never executed: sys_error ("[%ld: %d (%d)] tcsetattr", (long)getpid (), shell_level, tty); | 0 |
2326 | returnexecuted 13 times by 1 test: return -1; -1;executed 13 times by 1 test: return -1; | 13 |
2327 | } | - |
2328 | | - |
2329 | } never executed: end of block | 0 |
2330 | return never executed: return 0; 0;never executed: return 0; | 0 |
2331 | } | - |
2332 | | - |
2333 | | - |
2334 | | - |
2335 | | - |
2336 | static PROCESS * | - |
2337 | find_last_proc (job, block) | - |
2338 | int job; | - |
2339 | int block; | - |
2340 | { | - |
2341 | register PROCESS *p; | - |
2342 | sigset_t set, oset; | - |
2343 | | - |
2344 | if (blockTRUE | never evaluated | FALSE | evaluated 1309 times by 1 test |
) | 0-1309 |
2345 | do { sigemptyset (&set); sigaddset (&set, | - |
2346 | 17 | - |
2347 | ); sigemptyset (&oset); sigprocmask ( | - |
2348 | 0 | - |
2349 | , &set, &oset); } never executed: end of block while (0); | 0 |
2350 | | - |
2351 | p = jobs[job]->pipe; | - |
2352 | while (pTRUE | evaluated 2118 times by 1 test | FALSE | never evaluated |
&& p->next != jobs[job]->pipeTRUE | evaluated 809 times by 1 test | FALSE | evaluated 1309 times by 1 test |
) | 0-2118 |
2353 | p = p->next;executed 809 times by 1 test: p = p->next; | 809 |
2354 | | - |
2355 | if (blockTRUE | never evaluated | FALSE | evaluated 1309 times by 1 test |
) | 0-1309 |
2356 | sigprocmask ( never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
2357 | 2 never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
2358 | , &oset, (sigset_t *) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
2359 | ((void *)0) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
2360 | ); never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
2361 | | - |
2362 | returnexecuted 1309 times by 1 test: return (p); (p);executed 1309 times by 1 test: return (p); | 1309 |
2363 | } | - |
2364 | | - |
2365 | static pid_t | - |
2366 | find_last_pid (job, block) | - |
2367 | int job; | - |
2368 | int block; | - |
2369 | { | - |
2370 | PROCESS *p; | - |
2371 | | - |
2372 | p = find_last_proc (job, block); | - |
2373 | | - |
2374 | returnexecuted 1138 times by 1 test: return p->pid; p->pid;executed 1138 times by 1 test: return p->pid; | 1138 |
2375 | } | - |
2376 | int | - |
2377 | wait_for_single_pid (pid, flags) | - |
2378 | pid_t pid; | - |
2379 | int flags; | - |
2380 | { | - |
2381 | register PROCESS *child; | - |
2382 | sigset_t set, oset; | - |
2383 | int r, job, alive; | - |
2384 | | - |
2385 | do { sigemptyset (&set); sigaddset (&set, | - |
2386 | 17 | - |
2387 | ); sigemptyset (&oset); sigprocmask ( | - |
2388 | 0 | - |
2389 | , &set, &oset); } while (0); | - |
2390 | child = find_pipeline (pid, 0, (int *) | - |
2391 | ((void *)0) | - |
2392 | ); | - |
2393 | sigprocmask ( | - |
2394 | 2 | - |
2395 | , &oset, (sigset_t *) | - |
2396 | ((void *)0) | - |
2397 | ); | - |
2398 | | - |
2399 | if (child == 0TRUE | evaluated 13 times by 1 test | FALSE | evaluated 153 times by 1 test |
) | 13-153 |
2400 | { | - |
2401 | r = bgp_search (pid); | - |
2402 | if (r >= 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 12 times by 1 test |
) | 1-12 |
2403 | returnexecuted 1 time by 1 test: return r; r;executed 1 time by 1 test: return r; | 1 |
2404 | }executed 12 times by 1 test: end of block | 12 |
2405 | | - |
2406 | if (child == 0TRUE | evaluated 12 times by 1 test | FALSE | evaluated 153 times by 1 test |
) | 12-153 |
2407 | { | - |
2408 | if (flags & 0x01TRUE | evaluated 3 times by 1 test | FALSE | evaluated 9 times by 1 test |
) | 3-9 |
2409 | internal_error (executed 3 times by 1 test: internal_error ( dcgettext (((void *)0), "wait: pid %ld is not a child of this shell" , 5) , (long)pid); | 3 |
2410 | dcgettext (((void *)0), executed 3 times by 1 test: internal_error ( dcgettext (((void *)0), "wait: pid %ld is not a child of this shell" , 5) , (long)pid); | 3 |
2411 | "wait: pid %ld is not a child of this shell"executed 3 times by 1 test: internal_error ( dcgettext (((void *)0), "wait: pid %ld is not a child of this shell" , 5) , (long)pid); | 3 |
2412 | , 5)executed 3 times by 1 test: internal_error ( dcgettext (((void *)0), "wait: pid %ld is not a child of this shell" , 5) , (long)pid); | 3 |
2413 | , (long)pid);executed 3 times by 1 test: internal_error ( dcgettext (((void *)0), "wait: pid %ld is not a child of this shell" , 5) , (long)pid); | 3 |
2414 | returnexecuted 12 times by 1 test: return (127); (127);executed 12 times by 1 test: return (127); | 12 |
2415 | } | - |
2416 | | - |
2417 | alive = 0; | - |
2418 | do | - |
2419 | { | - |
2420 | r = wait_for (pid); | - |
2421 | if ((TRUE | evaluated 153 times by 1 test | FALSE | never evaluated |
flags & 0x02) == 0TRUE | evaluated 153 times by 1 test | FALSE | never evaluated |
) | 0-153 |
2422 | break;executed 153 times by 1 test: break; | 153 |
2423 | | - |
2424 | do { sigemptyset (&set); sigaddset (&set, | - |
2425 | 17 | - |
2426 | ); sigemptyset (&oset); sigprocmask ( | - |
2427 | 0 | - |
2428 | , &set, &oset); } while (0); | - |
2429 | alive = (((TRUE | never evaluated | FALSE | never evaluated |
child)->running == 1)TRUE | never evaluated | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2430 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2431 | (child)->statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
2432 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2433 | )TRUE | never evaluated | FALSE | never evaluated |
); | 0 |
2434 | sigprocmask ( | - |
2435 | 2 | - |
2436 | , &oset, (sigset_t *) | - |
2437 | ((void *)0) | - |
2438 | ); | - |
2439 | } never executed: end of block | 0 |
2440 | while (aliveTRUE | never evaluated | FALSE | never evaluated |
); | 0 |
2441 | | - |
2442 | | - |
2443 | | - |
2444 | do { sigemptyset (&set); sigaddset (&set, | - |
2445 | 17 | - |
2446 | ); sigemptyset (&oset); sigprocmask ( | - |
2447 | 0 | - |
2448 | , &set, &oset); } while (0); | - |
2449 | job = find_job (pid, 0, | - |
2450 | ((void *)0) | - |
2451 | ); | - |
2452 | if (job != -1TRUE | evaluated 149 times by 1 test | FALSE | evaluated 4 times by 1 test |
&& jobs[job]TRUE | evaluated 149 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 149 times by 1 test | FALSE | never evaluated |
jobs[(job)]->state == JDEAD)TRUE | evaluated 149 times by 1 test | FALSE | never evaluated |
) | 0-149 |
2453 | jobs[job]->flags |= 0x02;executed 149 times by 1 test: jobs[job]->flags |= 0x02; | 149 |
2454 | sigprocmask ( | - |
2455 | 2 | - |
2456 | , &oset, (sigset_t *) | - |
2457 | ((void *)0) | - |
2458 | ); | - |
2459 | | - |
2460 | | - |
2461 | if (posixly_correctTRUE | never evaluated | FALSE | evaluated 153 times by 1 test |
) | 0-153 |
2462 | { | - |
2463 | cleanup_dead_jobs (); | - |
2464 | bgp_delete (pid); | - |
2465 | } never executed: end of block | 0 |
2466 | | - |
2467 | returnexecuted 153 times by 1 test: return r; r;executed 153 times by 1 test: return r; | 153 |
2468 | } | - |
2469 | | - |
2470 | | - |
2471 | void | - |
2472 | wait_for_background_pids () | - |
2473 | { | - |
2474 | register int i, r; | - |
2475 | int any_stopped, check_async; | - |
2476 | sigset_t set, oset; | - |
2477 | pid_t pid; | - |
2478 | | - |
2479 | for (any_stopped = 0, check_async = 1;;) | - |
2480 | { | - |
2481 | do { sigemptyset (&set); sigaddset (&set, | - |
2482 | 17 | - |
2483 | ); sigemptyset (&oset); sigprocmask ( | - |
2484 | 0 | - |
2485 | , &set, &oset); } while (0); | - |
2486 | | - |
2487 | | - |
2488 | | - |
2489 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 1244 times by 1 test | FALSE | evaluated 138 times by 1 test |
; i++) | 138-1244 |
2490 | { | - |
2491 | | - |
2492 | if (i < js.j_firstjTRUE | evaluated 9 times by 1 test | FALSE | evaluated 1235 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 9 times by 1 test |
) | 0-1235 |
2493 | itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
2494 | if (i > js.j_lastjTRUE | evaluated 952 times by 1 test | FALSE | evaluated 292 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 952 times by 1 test |
) | 0-952 |
2495 | itrace("wait_for_background_pids: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("wait_for_background_pids: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
2496 | | - |
2497 | if (jobs[i]TRUE | evaluated 272 times by 1 test | FALSE | evaluated 972 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 272 times by 1 test |
jobs[(i)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 272 times by 1 test |
) | 0-972 |
2498 | { | - |
2499 | builtin_warning ("job %d[%d] stopped", i+1, find_last_pid (i, 0)); | - |
2500 | any_stopped = 1; | - |
2501 | } never executed: end of block | 0 |
2502 | | - |
2503 | if (jobs[i]TRUE | evaluated 272 times by 1 test | FALSE | evaluated 972 times by 1 test |
&& (TRUE | evaluated 134 times by 1 test | FALSE | evaluated 138 times by 1 test |
jobs[(i)]->state == JRUNNING)TRUE | evaluated 134 times by 1 test | FALSE | evaluated 138 times by 1 test |
&& ((TRUE | evaluated 134 times by 1 test | FALSE | never evaluated |
jobs[i]->flags & 0x01) != 0) == 0TRUE | evaluated 134 times by 1 test | FALSE | never evaluated |
) | 0-972 |
2504 | break;executed 134 times by 1 test: break; | 134 |
2505 | }executed 1110 times by 1 test: end of block | 1110 |
2506 | if (i == js.j_jobslotsTRUE | evaluated 138 times by 1 test | FALSE | evaluated 134 times by 1 test |
) | 134-138 |
2507 | { | - |
2508 | sigprocmask ( | - |
2509 | 2 | - |
2510 | , &oset, (sigset_t *) | - |
2511 | ((void *)0) | - |
2512 | ); | - |
2513 | break;executed 138 times by 1 test: break; | 138 |
2514 | } | - |
2515 | | - |
2516 | | - |
2517 | pid = find_last_pid (i, 0); | - |
2518 | sigprocmask ( | - |
2519 | 2 | - |
2520 | , &oset, (sigset_t *) | - |
2521 | ((void *)0) | - |
2522 | ); | - |
2523 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 134 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | evaluated 134 times by 1 test |
) throw_to_top_level ();never executed: throw_to_top_level (); } while (0); | 0-134 |
2524 | | - |
2525 | (*__errno_location ()) | - |
2526 | = 0; | - |
2527 | r = wait_for_single_pid (pid, 0x01); | - |
2528 | if (r == -1TRUE | never evaluated | FALSE | evaluated 134 times by 1 test |
&& | 0-134 |
2529 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2530 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2531 | 10TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2532 | ) | - |
2533 | { | - |
2534 | | - |
2535 | check_async = 0; | - |
2536 | mark_all_jobs_as_dead (); | - |
2537 | } never executed: end of block | 0 |
2538 | }executed 134 times by 1 test: end of block | 134 |
2539 | | - |
2540 | | - |
2541 | if (last_procsub_childTRUE | never evaluated | FALSE | evaluated 138 times by 1 test |
&& last_procsub_child->pid != (pid_t)-1TRUE | never evaluated | FALSE | never evaluated |
) | 0-138 |
2542 | r = wait_for (last_procsub_child->pid); never executed: r = wait_for (last_procsub_child->pid); | 0 |
2543 | wait_procsubs (); | - |
2544 | reap_procsubs (); | - |
2545 | | - |
2546 | | - |
2547 | | - |
2548 | | - |
2549 | if (any_stopped == 0TRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
) | 0-138 |
2550 | { | - |
2551 | | - |
2552 | while ((TRUE | never evaluated | FALSE | evaluated 138 times by 1 test |
r = wait_for ((pid_t)-1)) >= 0TRUE | never evaluated | FALSE | evaluated 138 times by 1 test |
) | 0-138 |
2553 | { | - |
2554 | do { if (terminating_signalTRUE | never evaluated | FALSE | never evaluated |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | never evaluated |
) throw_to_top_level ();never executed: throw_to_top_level (); } while (0); | 0 |
2555 | do { if (wait_intr_flagTRUE | never evaluated | FALSE | never evaluated |
&& wait_signal_receivedTRUE | never evaluated | FALSE | never evaluated |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0 |
2556 | } never executed: end of block | 0 |
2557 | }executed 138 times by 1 test: end of block | 138 |
2558 | | - |
2559 | | - |
2560 | | - |
2561 | | - |
2562 | | - |
2563 | mark_dead_jobs_as_notified (1); | - |
2564 | cleanup_dead_jobs (); | - |
2565 | bgp_clear (); | - |
2566 | }executed 138 times by 1 test: end of block | 138 |
2567 | | - |
2568 | | - |
2569 | | - |
2570 | static SigHandler *old_sigint_handler = (SigHandler *)wait_for_background_pids; | - |
2571 | | - |
2572 | static int wait_sigint_received; | - |
2573 | static int child_caught_sigint; | - |
2574 | static int waiting_for_child; | - |
2575 | | - |
2576 | | - |
2577 | void | - |
2578 | wait_sigint_cleanup () | - |
2579 | { | - |
2580 | queue_sigchld = 0; | - |
2581 | waiting_for_child = 0; | - |
2582 | } never executed: end of block | 0 |
2583 | | - |
2584 | static void | - |
2585 | restore_sigint_handler () | - |
2586 | { | - |
2587 | if (old_sigint_handler != (SigHandler *)wait_for_background_pidsTRUE | evaluated 3296399 times by 1 test | FALSE | evaluated 205066 times by 1 test |
) | 205066-3296399 |
2588 | { | - |
2589 | set_signal_handler ( | - |
2590 | 2 | - |
2591 | , old_sigint_handler); | - |
2592 | old_sigint_handler = (SigHandler *)wait_for_background_pids; | - |
2593 | waiting_for_child = 0; | - |
2594 | }executed 3296399 times by 1 test: end of block | 3296399 |
2595 | }executed 3501465 times by 1 test: end of block | 3501465 |
2596 | | - |
2597 | | - |
2598 | | - |
2599 | | - |
2600 | static void | - |
2601 | wait_sigint_handler (sig) | - |
2602 | int sig; | - |
2603 | { | - |
2604 | SigHandler *sigint_handler; | - |
2605 | | - |
2606 | if (interrupt_immediatelyTRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
2607 | (this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& this_shell_builtin == wait_builtinTRUE | never evaluated | FALSE | never evaluated |
)) | 0 |
2608 | { | - |
2609 | last_command_exit_value = 128+ | - |
2610 | 2 | - |
2611 | ; | - |
2612 | restore_sigint_handler (); | - |
2613 | | - |
2614 | | - |
2615 | if (this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& this_shell_builtin == wait_builtinTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
2616 | signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2617 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2618 | )TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
2619 | ((TRUE | never evaluated | FALSE | never evaluated |
sigint_handler = trap_to_sighandler (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2620 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2621 | )) == trap_handler)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2622 | { | - |
2623 | trap_handler ( | - |
2624 | 2 | - |
2625 | ); | - |
2626 | wait_signal_received = | - |
2627 | 2 | - |
2628 | ; | - |
2629 | if (interrupt_immediatelyTRUE | never evaluated | FALSE | never evaluated |
&& wait_intr_flagTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2630 | { | - |
2631 | interrupt_immediately = 0; | - |
2632 | siglongjmp((wait_intr_buf), (1)); | - |
2633 | } never executed: end of block | 0 |
2634 | else | - |
2635 | | - |
2636 | return; never executed: return; | 0 |
2637 | } | - |
2638 | else if (interrupt_immediatelyTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2639 | { | - |
2640 | interrupt_state++; | - |
2641 | do { if (terminating_signalTRUE | never evaluated | FALSE | never evaluated |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | never evaluated |
) throw_to_top_level ();never executed: throw_to_top_level (); } while (0); | 0 |
2642 | } never executed: end of block | 0 |
2643 | else | - |
2644 | kill (getpid (), never executed: kill (getpid (), 2 ); | 0 |
2645 | 2 never executed: kill (getpid (), 2 ); | 0 |
2646 | ); never executed: kill (getpid (), 2 ); | 0 |
2647 | } | - |
2648 | | - |
2649 | | - |
2650 | | - |
2651 | if (waiting_for_childTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2652 | wait_sigint_received = 1; never executed: wait_sigint_received = 1; | 0 |
2653 | else | - |
2654 | { | - |
2655 | last_command_exit_value = 128+ | - |
2656 | 2 | - |
2657 | ; | - |
2658 | restore_sigint_handler (); | - |
2659 | kill (getpid (), | - |
2660 | 2 | - |
2661 | ); | - |
2662 | } never executed: end of block | 0 |
2663 | | - |
2664 | | - |
2665 | | - |
2666 | return; never executed: return; | 0 |
2667 | } | - |
2668 | | - |
2669 | static int | - |
2670 | process_exit_signal (status) | - |
2671 | WAIT status; | - |
2672 | { | - |
2673 | returnexecuted 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); (executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2674 | (((signed char) (((executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2675 | statusexecuted 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2676 | ) & 0x7f) + 1) >> 1) > 0) executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2677 | ? executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2678 | ((executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2679 | statusexecuted 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2680 | ) & 0x7f) executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2681 | : 0);executed 3501326 times by 1 test: return ( (((signed char) ((( status ) & 0x7f) + 1) >> 1) > 0) ? (( status ) & 0x7f) : 0); | 3501326 |
2682 | } | - |
2683 | | - |
2684 | static int | - |
2685 | process_exit_status (status) | - |
2686 | WAIT status; | - |
2687 | { | - |
2688 | if ( | - |
2689 | (((TRUE | evaluated 11 times by 1 test | FALSE | evaluated 4013450 times by 1 test |
signed char) (((TRUE | evaluated 11 times by 1 test | FALSE | evaluated 4013450 times by 1 test |
| 11-4013450 |
2690 | statusTRUE | evaluated 11 times by 1 test | FALSE | evaluated 4013450 times by 1 test |
| 11-4013450 |
2691 | ) & 0x7f) + 1) >> 1) > 0)TRUE | evaluated 11 times by 1 test | FALSE | evaluated 4013450 times by 1 test |
| 11-4013450 |
2692 | ) | - |
2693 | returnexecuted 11 times by 1 test: return (128 + (( status ) & 0x7f) ); (128 + executed 11 times by 1 test: return (128 + (( status ) & 0x7f) ); | 11 |
2694 | ((executed 11 times by 1 test: return (128 + (( status ) & 0x7f) ); | 11 |
2695 | statusexecuted 11 times by 1 test: return (128 + (( status ) & 0x7f) ); | 11 |
2696 | ) & 0x7f)executed 11 times by 1 test: return (128 + (( status ) & 0x7f) ); | 11 |
2697 | );executed 11 times by 1 test: return (128 + (( status ) & 0x7f) ); | 11 |
2698 | else if ( | - |
2699 | (((TRUE | evaluated 3808428 times by 1 test | FALSE | evaluated 205022 times by 1 test |
| 205022-3808428 |
2700 | statusTRUE | evaluated 3808428 times by 1 test | FALSE | evaluated 205022 times by 1 test |
| 205022-3808428 |
2701 | ) & 0xff) == 0x7f) TRUE | evaluated 3808428 times by 1 test | FALSE | evaluated 205022 times by 1 test |
| 205022-3808428 |
2702 | == 0TRUE | evaluated 3808428 times by 1 test | FALSE | evaluated 205022 times by 1 test |
) | 205022-3808428 |
2703 | returnexecuted 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); (executed 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); | 3808428 |
2704 | (((executed 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); | 3808428 |
2705 | statusexecuted 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); | 3808428 |
2706 | ) & 0xff00) >> 8)executed 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); | 3808428 |
2707 | );executed 3808428 times by 1 test: return ( ((( status ) & 0xff00) >> 8) ); | 3808428 |
2708 | else | - |
2709 | returnexecuted 205022 times by 1 test: return (0); (0);executed 205022 times by 1 test: return (0); | 205022 |
2710 | } | - |
2711 | | - |
2712 | static WAIT | - |
2713 | job_signal_status (job) | - |
2714 | int job; | - |
2715 | { | - |
2716 | register PROCESS *p; | - |
2717 | WAIT s; | - |
2718 | | - |
2719 | p = jobs[job]->pipe; | - |
2720 | do | - |
2721 | { | - |
2722 | s = p->status; | - |
2723 | if ( | - |
2724 | (((TRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
signed char) (((TRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2725 | sTRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2726 | ) & 0x7f) + 1) >> 1) > 0)TRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2727 | || | - |
2728 | (((TRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2729 | sTRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2730 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | evaluated 53065 times by 1 test |
| 0-53065 |
2731 | ) | - |
2732 | break; never executed: break; | 0 |
2733 | p = p->next; | - |
2734 | }executed 53065 times by 1 test: end of block | 53065 |
2735 | while (p != jobs[job]->pipeTRUE | evaluated 11497 times by 1 test | FALSE | evaluated 41568 times by 1 test |
); | 11497-41568 |
2736 | | - |
2737 | returnexecuted 41568 times by 1 test: return s; s;executed 41568 times by 1 test: return s; | 41568 |
2738 | } | - |
2739 | | - |
2740 | | - |
2741 | | - |
2742 | static WAIT | - |
2743 | raw_job_exit_status (job) | - |
2744 | int job; | - |
2745 | { | - |
2746 | register PROCESS *p; | - |
2747 | int fail; | - |
2748 | WAIT ret; | - |
2749 | | - |
2750 | if (pipefail_optTRUE | evaluated 14887 times by 1 test | FALSE | evaluated 934266 times by 1 test |
) | 14887-934266 |
2751 | { | - |
2752 | fail = 0; | - |
2753 | p = jobs[job]->pipe; | - |
2754 | do | - |
2755 | { | - |
2756 | if ((TRUE | evaluated 19 times by 1 test | FALSE | evaluated 29768 times by 1 test |
p->status) != 0TRUE | evaluated 19 times by 1 test | FALSE | evaluated 29768 times by 1 test |
) | 19-29768 |
2757 | fail = (p->status);executed 19 times by 1 test: fail = (p->status); | 19 |
2758 | p = p->next; | - |
2759 | }executed 29787 times by 1 test: end of block | 29787 |
2760 | while (p != jobs[job]->pipeTRUE | evaluated 14900 times by 1 test | FALSE | evaluated 14887 times by 1 test |
); | 14887-14900 |
2761 | (ret) = fail; | - |
2762 | returnexecuted 14887 times by 1 test: return ret; ret;executed 14887 times by 1 test: return ret; | 14887 |
2763 | } | - |
2764 | | - |
2765 | for (p = jobs[job]->pipe; p->next != jobs[job]->pipeTRUE | evaluated 22424 times by 1 test | FALSE | evaluated 934266 times by 1 test |
; p = p->next) | 22424-934266 |
2766 | ;executed 22424 times by 1 test: ; | 22424 |
2767 | returnexecuted 934266 times by 1 test: return (p->status); (p->status);executed 934266 times by 1 test: return (p->status); | 934266 |
2768 | } | - |
2769 | | - |
2770 | | - |
2771 | | - |
2772 | | - |
2773 | int | - |
2774 | job_exit_status (job) | - |
2775 | int job; | - |
2776 | { | - |
2777 | returnexecuted 247852 times by 1 test: return (process_exit_status (raw_job_exit_status (job))); (process_exit_status (raw_job_exit_status (job)));executed 247852 times by 1 test: return (process_exit_status (raw_job_exit_status (job))); | 247852 |
2778 | } | - |
2779 | | - |
2780 | int | - |
2781 | job_exit_signal (job) | - |
2782 | int job; | - |
2783 | { | - |
2784 | returnexecuted 247749 times by 1 test: return (process_exit_signal (raw_job_exit_status (job))); (process_exit_signal (raw_job_exit_status (job)));executed 247749 times by 1 test: return (process_exit_signal (raw_job_exit_status (job))); | 247749 |
2785 | } | - |
2786 | int | - |
2787 | wait_for (pid) | - |
2788 | pid_t pid; | - |
2789 | { | - |
2790 | int job, termination_state, r; | - |
2791 | WAIT s; | - |
2792 | register PROCESS *child; | - |
2793 | sigset_t set, oset; | - |
2794 | | - |
2795 | | - |
2796 | | - |
2797 | | - |
2798 | child = 0; | - |
2799 | do { sigemptyset (&set); sigaddset (&set, | - |
2800 | 17 | - |
2801 | ); sigemptyset (&oset); sigprocmask ( | - |
2802 | 0 | - |
2803 | , &set, &oset); } while (0); | - |
2804 | wait_sigint_received = child_caught_sigint = 0; | - |
2805 | if (job_control == 0TRUE | evaluated 3296400 times by 1 test | FALSE | evaluated 205066 times by 1 test |
|| (TRUE | never evaluated | FALSE | evaluated 205066 times by 1 test |
subshell_environment&0x04)TRUE | never evaluated | FALSE | evaluated 205066 times by 1 test |
) | 0-3296400 |
2806 | { | - |
2807 | old_sigint_handler = set_signal_handler ( | - |
2808 | 2 | - |
2809 | , wait_sigint_handler); | - |
2810 | waiting_for_child = 0; | - |
2811 | if (old_sigint_handler == TRUE | evaluated 15 times by 1 test | FALSE | evaluated 3296385 times by 1 test |
| 15-3296385 |
2812 | ((__sighandler_t) 1)TRUE | evaluated 15 times by 1 test | FALSE | evaluated 3296385 times by 1 test |
| 15-3296385 |
2813 | ) | - |
2814 | set_signal_handler (executed 15 times by 1 test: set_signal_handler ( 2 , old_sigint_handler); | 15 |
2815 | 2executed 15 times by 1 test: set_signal_handler ( 2 , old_sigint_handler); | 15 |
2816 | , old_sigint_handler);executed 15 times by 1 test: set_signal_handler ( 2 , old_sigint_handler); | 15 |
2817 | }executed 3296400 times by 1 test: end of block | 3296400 |
2818 | | - |
2819 | termination_state = last_command_exit_value; | - |
2820 | | - |
2821 | if (interactiveTRUE | never evaluated | FALSE | evaluated 3501466 times by 1 test |
&& job_control == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-3501466 |
2822 | do { if (terminating_signalTRUE | never evaluated | FALSE | never evaluated |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | never evaluated |
) throw_to_top_level ();never executed: throw_to_top_level (); }never executed: end of block while (0); | 0 |
2823 | | - |
2824 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 3501466 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0-3501466 |
2825 | | - |
2826 | | - |
2827 | do { if (wait_intr_flagTRUE | evaluated 205323 times by 1 test | FALSE | evaluated 3296143 times by 1 test |
&& wait_signal_receivedTRUE | never evaluated | FALSE | evaluated 205323 times by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0-3296143 |
2828 | | - |
2829 | | - |
2830 | | - |
2831 | | - |
2832 | job = -1; | - |
2833 | do | - |
2834 | { | - |
2835 | if (pid != (pid_t)-1TRUE | evaluated 3528425 times by 1 test | FALSE | evaluated 139 times by 1 test |
) | 139-3528425 |
2836 | do { child = find_pipeline (pid, 0, (int *) | - |
2837 | ((void *)0) | - |
2838 | ); if (child == 0TRUE | never evaluated | FALSE | evaluated 3528425 times by 1 test |
) { give_terminal_to (shell_pgrp, 0); sigprocmask ( | 0-3528425 |
2839 | 2 | - |
2840 | , &oset, (sigset_t *) | - |
2841 | ((void *)0) | - |
2842 | ); internal_error ( | - |
2843 | dcgettext (((void *)0), | - |
2844 | "wait_for: No record of process %ld" | - |
2845 | , 5) | - |
2846 | , (long)pid); restore_sigint_handler (); return never executed: return (termination_state = 127); (termination_state = 127);never executed: return (termination_state = 127); } }executed 3528425 times by 1 test: end of block while (0); | 0-3528425 |
2847 | | - |
2848 | | - |
2849 | | - |
2850 | | - |
2851 | | - |
2852 | if (job == -1TRUE | evaluated 3501466 times by 1 test | FALSE | evaluated 27098 times by 1 test |
&& pid != (pid_t)-1TRUE | evaluated 3501327 times by 1 test | FALSE | evaluated 139 times by 1 test |
) | 139-3501466 |
2853 | job = find_job (pid, 0, executed 3501327 times by 1 test: job = find_job (pid, 0, ((void *)0) ); | 3501327 |
2854 | ((void *)0)executed 3501327 times by 1 test: job = find_job (pid, 0, ((void *)0) ); | 3501327 |
2855 | );executed 3501327 times by 1 test: job = find_job (pid, 0, ((void *)0) ); | 3501327 |
2856 | | - |
2857 | | - |
2858 | | - |
2859 | | - |
2860 | | - |
2861 | if (pid == (pid_t)-1TRUE | evaluated 139 times by 1 test | FALSE | evaluated 3528425 times by 1 test |
|| ((TRUE | evaluated 826036 times by 1 test | FALSE | evaluated 2702389 times by 1 test |
child)->running == 1)TRUE | evaluated 826036 times by 1 test | FALSE | evaluated 2702389 times by 1 test |
|| (job != -1TRUE | evaluated 218434 times by 1 test | FALSE | evaluated 2483955 times by 1 test |
&& (TRUE | evaluated 13332 times by 1 test | FALSE | evaluated 205102 times by 1 test |
jobs[(job)]->state == JRUNNING)TRUE | evaluated 13332 times by 1 test | FALSE | evaluated 205102 times by 1 test |
)) | 139-3528425 |
2862 | { | - |
2863 | queue_sigchld = 1; | - |
2864 | waiting_for_child++; | - |
2865 | r = waitchld (pid, 1); | - |
2866 | waiting_for_child--; | - |
2867 | | - |
2868 | | - |
2869 | | - |
2870 | | - |
2871 | | - |
2872 | | - |
2873 | | - |
2874 | queue_sigchld = 0; | - |
2875 | if (r == -1TRUE | evaluated 138 times by 1 test | FALSE | evaluated 839368 times by 1 test |
&& | 138-839368 |
2876 | (*TRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
__errno_location ()) TRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
| 0-138 |
2877 | == TRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
| 0-138 |
2878 | 10TRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
| 0-138 |
2879 | && this_shell_builtin == wait_builtinTRUE | evaluated 138 times by 1 test | FALSE | never evaluated |
) | 0-138 |
2880 | { | - |
2881 | termination_state = -1; | - |
2882 | | - |
2883 | restore_sigint_handler (); | - |
2884 | gotoexecuted 138 times by 1 test: goto wait_for_return; wait_for_return;executed 138 times by 1 test: goto wait_for_return; | 138 |
2885 | } | - |
2886 | | - |
2887 | | - |
2888 | | - |
2889 | | - |
2890 | | - |
2891 | if (r == -1TRUE | never evaluated | FALSE | evaluated 839368 times by 1 test |
&& | 0-839368 |
2892 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2893 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2894 | 10TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2895 | ) | - |
2896 | { | - |
2897 | if (childTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2898 | { | - |
2899 | child->running = 0; | - |
2900 | (child->status) = 0; | - |
2901 | } never executed: end of block | 0 |
2902 | js.c_living = 0; | - |
2903 | if (job != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2904 | { | - |
2905 | jobs[job]->state = JDEAD; | - |
2906 | js.c_reaped++; | - |
2907 | js.j_ndead++; | - |
2908 | } never executed: end of block | 0 |
2909 | if (pid == (pid_t)-1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
2910 | { | - |
2911 | termination_state = -1; | - |
2912 | break; never executed: break; | 0 |
2913 | } | - |
2914 | } never executed: end of block | 0 |
2915 | | - |
2916 | }executed 839368 times by 1 test: end of block | 839368 |
2917 | | - |
2918 | | - |
2919 | | - |
2920 | | - |
2921 | | - |
2922 | if (interactiveTRUE | never evaluated | FALSE | evaluated 3528425 times by 1 test |
&& job_control == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-3528425 |
2923 | do { if (terminating_signalTRUE | never evaluated | FALSE | never evaluated |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | never evaluated |
) throw_to_top_level ();never executed: throw_to_top_level (); }never executed: end of block while (0); | 0 |
2924 | | - |
2925 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 3528425 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0-3528425 |
2926 | | - |
2927 | | - |
2928 | do { if (wait_intr_flagTRUE | evaluated 205197 times by 1 test | FALSE | evaluated 3323228 times by 1 test |
&& wait_signal_receivedTRUE | never evaluated | FALSE | evaluated 205197 times by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0-3323228 |
2929 | | - |
2930 | if (pid == (pid_t)-1TRUE | evaluated 1 time by 1 test | FALSE | evaluated 3528424 times by 1 test |
) | 1-3528424 |
2931 | { | - |
2932 | | - |
2933 | | - |
2934 | restore_sigint_handler (); | - |
2935 | gotoexecuted 1 time by 1 test: goto wait_for_return; wait_for_return;executed 1 time by 1 test: goto wait_for_return; | 1 |
2936 | } | - |
2937 | }executed 3528424 times by 1 test: end of block | 3528424 |
2938 | while (((TRUE | evaluated 13766 times by 1 test | FALSE | evaluated 3514658 times by 1 test |
child)->running == 1)TRUE | evaluated 13766 times by 1 test | FALSE | evaluated 3514658 times by 1 test |
|| (job != -1TRUE | evaluated 261081 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
&& (TRUE | evaluated 13332 times by 1 test | FALSE | evaluated 247749 times by 1 test |
jobs[(job)]->state == JRUNNING)TRUE | evaluated 13332 times by 1 test | FALSE | evaluated 247749 times by 1 test |
)); | 13332-3514658 |
2939 | | - |
2940 | | - |
2941 | restore_sigint_handler (); | - |
2942 | | - |
2943 | | - |
2944 | | - |
2945 | | - |
2946 | | - |
2947 | termination_state = (TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
job != -1)TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
? job_exit_status (job) | 247749-3253577 |
2948 | : (childTRUE | evaluated 3253577 times by 1 test | FALSE | never evaluated |
? process_exit_status (child->status) : 0); | 0-3253577 |
2949 | last_command_exit_signal = (TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
job != -1)TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
? job_exit_signal (job) | 247749-3253577 |
2950 | : (childTRUE | evaluated 3253577 times by 1 test | FALSE | never evaluated |
? process_exit_signal (child->status) : 0); | 0-3253577 |
2951 | | - |
2952 | | - |
2953 | if ((job != -1TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
&& (TRUE | evaluated 205022 times by 1 test | FALSE | evaluated 42727 times by 1 test |
jobs[(job)]->state) == JSTOPPEDTRUE | evaluated 205022 times by 1 test | FALSE | evaluated 42727 times by 1 test |
) || (childTRUE | evaluated 3296304 times by 1 test | FALSE | never evaluated |
&& | 0-3296304 |
2954 | (((TRUE | never evaluated | FALSE | evaluated 3296304 times by 1 test |
| 0-3296304 |
2955 | child->statusTRUE | never evaluated | FALSE | evaluated 3296304 times by 1 test |
| 0-3296304 |
2956 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | evaluated 3296304 times by 1 test |
| 0-3296304 |
2957 | )) | - |
2958 | termination_state = 128 + executed 205022 times by 1 test: termination_state = 128 + ((( child->status ) & 0xff00) >> 8) ; | 205022 |
2959 | (((executed 205022 times by 1 test: termination_state = 128 + ((( child->status ) & 0xff00) >> 8) ; | 205022 |
2960 | child->statusexecuted 205022 times by 1 test: termination_state = 128 + ((( child->status ) & 0xff00) >> 8) ; | 205022 |
2961 | ) & 0xff00) >> 8)executed 205022 times by 1 test: termination_state = 128 + ((( child->status ) & 0xff00) >> 8) ; | 205022 |
2962 | ;executed 205022 times by 1 test: termination_state = 128 + ((( child->status ) & 0xff00) >> 8) ; | 205022 |
2963 | | - |
2964 | if (job == -1TRUE | evaluated 3253577 times by 1 test | FALSE | evaluated 247749 times by 1 test |
|| ((TRUE | evaluated 205055 times by 1 test | FALSE | evaluated 42694 times by 1 test |
jobs[job]->flags & 0x04) != 0)TRUE | evaluated 205055 times by 1 test | FALSE | evaluated 42694 times by 1 test |
) | 42694-3253577 |
2965 | { | - |
2966 | if (running_in_background == 0TRUE | never evaluated | FALSE | evaluated 3458632 times by 1 test |
&& (TRUE | never evaluated | FALSE | never evaluated |
subshell_environment&(0x01|0x10)) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-3458632 |
2967 | give_terminal_to (shell_pgrp, 0); never executed: give_terminal_to (shell_pgrp, 0); | 0 |
2968 | }executed 3458632 times by 1 test: end of block | 3458632 |
2969 | | - |
2970 | | - |
2971 | | - |
2972 | | - |
2973 | | - |
2974 | | - |
2975 | if (job != -1TRUE | evaluated 247749 times by 1 test | FALSE | evaluated 3253577 times by 1 test |
) | 247749-3253577 |
2976 | { | - |
2977 | if (interactive_shellTRUE | evaluated 1 time by 1 test | FALSE | evaluated 247748 times by 1 test |
&& subshell_environment == 0TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-247748 |
2978 | { | - |
2979 | s = job_signal_status (job); | - |
2980 | | - |
2981 | if ( | - |
2982 | (((TRUE | never evaluated | FALSE | never evaluated |
signed char) (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2983 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
2984 | ) & 0x7f) + 1) >> 1) > 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2985 | || | - |
2986 | (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2987 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
2988 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2989 | ) | - |
2990 | { | - |
2991 | set_tty_state (); | - |
2992 | | - |
2993 | | - |
2994 | | - |
2995 | if (check_window_sizeTRUE | never evaluated | FALSE | never evaluated |
&& (job == js.j_currentTRUE | never evaluated | FALSE | never evaluated |
|| ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x01) != 0)TRUE | never evaluated | FALSE | never evaluated |
)) | 0 |
2996 | get_new_window_size (0, (int *)0, (int *)0); never executed: get_new_window_size (0, (int *)0, (int *)0); | 0 |
2997 | } never executed: end of block | 0 |
2998 | else | - |
2999 | | - |
3000 | | - |
3001 | | - |
3002 | if ((TRUE | never evaluated | FALSE | never evaluated |
rl_readline_state & (0x0004000)) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3003 | | - |
3004 | get_tty_state (); never executed: get_tty_state (); | 0 |
3005 | | - |
3006 | | - |
3007 | | - |
3008 | | - |
3009 | | - |
3010 | if (job_controlTRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x04) != 0)TRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x01) != 0)TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
3011 | | - |
3012 | (((TRUE | never evaluated | FALSE | never evaluated |
signed char) (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3013 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
3014 | ) & 0x7f) + 1) >> 1) > 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3015 | && | - |
3016 | ((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3017 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
3018 | ) & 0x7f) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3019 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3020 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3021 | ) | - |
3022 | { | - |
3023 | | - |
3024 | | - |
3025 | | - |
3026 | | - |
3027 | if (signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3028 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3029 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
&& (loop_levelTRUE | never evaluated | FALSE | never evaluated |
|| (shell_compatibility_level > 32TRUE | never evaluated | FALSE | never evaluated |
&& executing_listTRUE | never evaluated | FALSE | never evaluated |
))) | 0 |
3030 | interrupt_state++; never executed: interrupt_state++; | 0 |
3031 | | - |
3032 | | - |
3033 | | - |
3034 | | - |
3035 | | - |
3036 | | - |
3037 | else if (signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3038 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3039 | )TRUE | never evaluated | FALSE | never evaluated |
&& loop_levelTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3040 | interrupt_state++; never executed: interrupt_state++; | 0 |
3041 | | - |
3042 | | - |
3043 | else if (interactive_shellTRUE | never evaluated | FALSE | never evaluated |
&& signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3044 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3045 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
&& sourcelevelTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3046 | interrupt_state++; never executed: interrupt_state++; | 0 |
3047 | else | - |
3048 | { | - |
3049 | putchar ('\n'); | - |
3050 | fflush ( | - |
3051 | stdout | - |
3052 | ); | - |
3053 | } never executed: end of block | 0 |
3054 | } | - |
3055 | } never executed: end of block | 0 |
3056 | else if ((TRUE | evaluated 971 times by 1 test | FALSE | evaluated 246778 times by 1 test |
subshell_environment & (0x04|0x10))TRUE | evaluated 971 times by 1 test | FALSE | evaluated 246778 times by 1 test |
&& wait_sigint_receivedTRUE | never evaluated | FALSE | evaluated 971 times by 1 test |
) | 0-246778 |
3057 | { | - |
3058 | | - |
3059 | | - |
3060 | | - |
3061 | | - |
3062 | | - |
3063 | if (child_caught_sigint == 0TRUE | never evaluated | FALSE | never evaluated |
&& signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3064 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3065 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3066 | { | - |
3067 | sigprocmask ( | - |
3068 | 2 | - |
3069 | , &oset, (sigset_t *) | - |
3070 | ((void *)0) | - |
3071 | ); | - |
3072 | old_sigint_handler = set_signal_handler ( | - |
3073 | 2 | - |
3074 | , | - |
3075 | ((__sighandler_t) 0) | - |
3076 | ); | - |
3077 | if (old_sigint_handler == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3078 | ((__sighandler_t) 1)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3079 | ) | - |
3080 | restore_sigint_handler (); never executed: restore_sigint_handler (); | 0 |
3081 | else | - |
3082 | kill (getpid (), never executed: kill (getpid (), 2 ); | 0 |
3083 | 2 never executed: kill (getpid (), 2 ); | 0 |
3084 | ); never executed: kill (getpid (), 2 ); | 0 |
3085 | } | - |
3086 | } never executed: end of block | 0 |
3087 | else if (interactive_shell == 0TRUE | evaluated 247748 times by 1 test | FALSE | evaluated 1 time by 1 test |
&& subshell_environment == 0TRUE | evaluated 246742 times by 1 test | FALSE | evaluated 1006 times by 1 test |
&& ((TRUE | evaluated 41568 times by 1 test | FALSE | evaluated 205174 times by 1 test |
jobs[job]->flags & 0x01) != 0)TRUE | evaluated 41568 times by 1 test | FALSE | evaluated 205174 times by 1 test |
) | 1-247748 |
3088 | { | - |
3089 | s = job_signal_status (job); | - |
3090 | | - |
3091 | | - |
3092 | | - |
3093 | | - |
3094 | if (job_controlTRUE | evaluated 18 times by 1 test | FALSE | evaluated 41550 times by 1 test |
&& ((TRUE | evaluated 18 times by 1 test | FALSE | never evaluated |
jobs[job]->flags & 0x04) != 0)TRUE | evaluated 18 times by 1 test | FALSE | never evaluated |
&& | 0-41550 |
3095 | (((TRUE | never evaluated | FALSE | evaluated 18 times by 1 test |
signed char) (((TRUE | never evaluated | FALSE | evaluated 18 times by 1 test |
| 0-18 |
3096 | sTRUE | never evaluated | FALSE | evaluated 18 times by 1 test |
| 0-18 |
3097 | ) & 0x7f) + 1) >> 1) > 0)TRUE | never evaluated | FALSE | evaluated 18 times by 1 test |
| 0-18 |
3098 | && | - |
3099 | ((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3100 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
3101 | ) & 0x7f) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3102 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3103 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3104 | ) | - |
3105 | { | - |
3106 | interrupt_state++; | - |
3107 | } never executed: end of block | 0 |
3108 | | - |
3109 | if (check_window_sizeTRUE | never evaluated | FALSE | evaluated 41568 times by 1 test |
) | 0-41568 |
3110 | get_new_window_size (0, (int *)0, (int *)0); never executed: get_new_window_size (0, (int *)0, (int *)0); | 0 |
3111 | }executed 41568 times by 1 test: end of block | 41568 |
3112 | | - |
3113 | | - |
3114 | | - |
3115 | if ((TRUE | evaluated 42727 times by 1 test | FALSE | evaluated 205022 times by 1 test |
jobs[(job)]->state == JDEAD)TRUE | evaluated 42727 times by 1 test | FALSE | evaluated 205022 times by 1 test |
&& ((TRUE | evaluated 42565 times by 1 test | FALSE | evaluated 162 times by 1 test |
jobs[job]->flags & 0x01) != 0)TRUE | evaluated 42565 times by 1 test | FALSE | evaluated 162 times by 1 test |
) | 162-205022 |
3116 | setjstatus (job);executed 42565 times by 1 test: setjstatus (job); | 42565 |
3117 | | - |
3118 | | - |
3119 | | - |
3120 | | - |
3121 | | - |
3122 | | - |
3123 | notify_and_cleanup (); | - |
3124 | }executed 247749 times by 1 test: end of block | 247749 |
3125 | | - |
3126 | wait_for_return:code before this statement executed 3501326 times by 1 test: wait_for_return: | 3501326 |
3127 | | - |
3128 | sigprocmask ( | - |
3129 | 2 | - |
3130 | , &oset, (sigset_t *) | - |
3131 | ((void *)0) | - |
3132 | ); | - |
3133 | | - |
3134 | returnexecuted 3501465 times by 1 test: return (termination_state); (termination_state);executed 3501465 times by 1 test: return (termination_state); | 3501465 |
3135 | } | - |
3136 | | - |
3137 | | - |
3138 | | - |
3139 | | - |
3140 | | - |
3141 | | - |
3142 | int | - |
3143 | wait_for_job (job, flags) | - |
3144 | int job, flags; | - |
3145 | { | - |
3146 | pid_t pid; | - |
3147 | int r, state; | - |
3148 | sigset_t set, oset; | - |
3149 | | - |
3150 | do { sigemptyset (&set); sigaddset (&set, | - |
3151 | 17 | - |
3152 | ); sigemptyset (&oset); sigprocmask ( | - |
3153 | 0 | - |
3154 | , &set, &oset); } while (0); | - |
3155 | state = (jobs[(job)]->state); | - |
3156 | if (state == JSTOPPEDTRUE | never evaluated | FALSE | evaluated 9 times by 1 test |
) | 0-9 |
3157 | internal_warning ( never executed: internal_warning ( dcgettext (((void *)0), "wait_for_job: job %d is stopped" , 5) , job+1); | 0 |
3158 | dcgettext (((void *)0), never executed: internal_warning ( dcgettext (((void *)0), "wait_for_job: job %d is stopped" , 5) , job+1); | 0 |
3159 | "wait_for_job: job %d is stopped" never executed: internal_warning ( dcgettext (((void *)0), "wait_for_job: job %d is stopped" , 5) , job+1); | 0 |
3160 | , 5) never executed: internal_warning ( dcgettext (((void *)0), "wait_for_job: job %d is stopped" , 5) , job+1); | 0 |
3161 | , job+1); never executed: internal_warning ( dcgettext (((void *)0), "wait_for_job: job %d is stopped" , 5) , job+1); | 0 |
3162 | | - |
3163 | pid = find_last_pid (job, 0); | - |
3164 | sigprocmask ( | - |
3165 | 2 | - |
3166 | , &oset, (sigset_t *) | - |
3167 | ((void *)0) | - |
3168 | ); | - |
3169 | | - |
3170 | do | - |
3171 | { | - |
3172 | r = wait_for (pid); | - |
3173 | if (r == -1TRUE | never evaluated | FALSE | evaluated 205031 times by 1 test |
&& | 0-205031 |
3174 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3175 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3176 | 10TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3177 | ) | - |
3178 | mark_all_jobs_as_dead (); never executed: mark_all_jobs_as_dead (); | 0 |
3179 | | - |
3180 | if ((TRUE | evaluated 8 times by 1 test | FALSE | evaluated 205023 times by 1 test |
flags & 0x02) == 0TRUE | evaluated 8 times by 1 test | FALSE | evaluated 205023 times by 1 test |
) | 8-205023 |
3181 | break;executed 8 times by 1 test: break; | 8 |
3182 | | - |
3183 | do { sigemptyset (&set); sigaddset (&set, | - |
3184 | 17 | - |
3185 | ); sigemptyset (&oset); sigprocmask ( | - |
3186 | 0 | - |
3187 | , &set, &oset); } while (0); | - |
3188 | state = (job != -1TRUE | evaluated 205023 times by 1 test | FALSE | never evaluated |
&& jobs[job]TRUE | evaluated 205023 times by 1 test | FALSE | never evaluated |
) ? (jobs[(job)]->state) : JDEAD; | 0-205023 |
3189 | sigprocmask ( | - |
3190 | 2 | - |
3191 | , &oset, (sigset_t *) | - |
3192 | ((void *)0) | - |
3193 | ); | - |
3194 | }executed 205023 times by 1 test: end of block | 205023 |
3195 | while (state != JDEADTRUE | evaluated 205022 times by 1 test | FALSE | evaluated 1 time by 1 test |
); | 1-205022 |
3196 | | - |
3197 | | - |
3198 | | - |
3199 | do { sigemptyset (&set); sigaddset (&set, | - |
3200 | 17 | - |
3201 | ); sigemptyset (&oset); sigprocmask ( | - |
3202 | 0 | - |
3203 | , &set, &oset); } while (0); | - |
3204 | if (job != -1TRUE | evaluated 9 times by 1 test | FALSE | never evaluated |
&& jobs[job]TRUE | evaluated 9 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 9 times by 1 test | FALSE | never evaluated |
jobs[(job)]->state == JDEAD)TRUE | evaluated 9 times by 1 test | FALSE | never evaluated |
) | 0-9 |
3205 | jobs[job]->flags |= 0x02;executed 9 times by 1 test: jobs[job]->flags |= 0x02; | 9 |
3206 | sigprocmask ( | - |
3207 | 2 | - |
3208 | , &oset, (sigset_t *) | - |
3209 | ((void *)0) | - |
3210 | ); | - |
3211 | | - |
3212 | returnexecuted 9 times by 1 test: return r; r;executed 9 times by 1 test: return r; | 9 |
3213 | } | - |
3214 | | - |
3215 | | - |
3216 | | - |
3217 | | - |
3218 | | - |
3219 | int | - |
3220 | wait_for_any_job (flags) | - |
3221 | int flags; | - |
3222 | { | - |
3223 | pid_t pid; | - |
3224 | int i, r; | - |
3225 | sigset_t set, oset; | - |
3226 | | - |
3227 | if (jobs_list_frozenTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
3228 | return never executed: return -1; -1;never executed: return -1; | 0 |
3229 | | - |
3230 | | - |
3231 | do { sigemptyset (&set); sigaddset (&set, | - |
3232 | 17 | - |
3233 | ); sigemptyset (&oset); sigprocmask ( | - |
3234 | 0 | - |
3235 | , &set, &oset); } while (0); | - |
3236 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 8 times by 1 test | FALSE | evaluated 1 time by 1 test |
; i++) | 1-8 |
3237 | { | - |
3238 | if (jobs[i]TRUE | evaluated 3 times by 1 test | FALSE | evaluated 5 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
jobs[(i)]->state == JDEAD)TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
&& ((TRUE | never evaluated | FALSE | never evaluated |
jobs[i]->flags & 0x02) != 0) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-5 |
3239 | { | - |
3240 | return_job: | - |
3241 | r = job_exit_status (i); | - |
3242 | notify_of_job_status (); | - |
3243 | delete_job (i, 0); | - |
3244 | | - |
3245 | coproc_reap (); | - |
3246 | | - |
3247 | sigprocmask ( | - |
3248 | 2 | - |
3249 | , &oset, (sigset_t *) | - |
3250 | ((void *)0) | - |
3251 | ); | - |
3252 | returnexecuted 1 time by 1 test: return r; r;executed 1 time by 1 test: return r; | 1 |
3253 | } | - |
3254 | }executed 8 times by 1 test: end of block | 8 |
3255 | sigprocmask ( | - |
3256 | 2 | - |
3257 | , &oset, (sigset_t *) | - |
3258 | ((void *)0) | - |
3259 | ); | - |
3260 | | - |
3261 | | - |
3262 | | - |
3263 | for (;;) | - |
3264 | { | - |
3265 | | - |
3266 | do { sigemptyset (&set); sigaddset (&set, | - |
3267 | 17 | - |
3268 | ); sigemptyset (&oset); sigprocmask ( | - |
3269 | 0 | - |
3270 | , &set, &oset); } while (0); | - |
3271 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
; i++) | 0-1 |
3272 | if (jobs[i]TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
jobs[(i)]->state == JRUNNING)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
&& ((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
jobs[i]->flags & 0x01) != 0) == 0TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1 |
3273 | break;executed 1 time by 1 test: break; | 1 |
3274 | if (i == js.j_jobslotsTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
3275 | { | - |
3276 | sigprocmask ( | - |
3277 | 2 | - |
3278 | , &oset, (sigset_t *) | - |
3279 | ((void *)0) | - |
3280 | ); | - |
3281 | return never executed: return -1; -1;never executed: return -1; | 0 |
3282 | } | - |
3283 | | - |
3284 | sigprocmask ( | - |
3285 | 2 | - |
3286 | , &oset, (sigset_t *) | - |
3287 | ((void *)0) | - |
3288 | ); | - |
3289 | | - |
3290 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) throw_to_top_level ();never executed: throw_to_top_level (); } while (0); | 0-1 |
3291 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0-1 |
3292 | do { if (wait_intr_flagTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
&& wait_signal_receivedTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0-1 |
3293 | | - |
3294 | | - |
3295 | (*__errno_location ()) | - |
3296 | = 0; | - |
3297 | r = wait_for ((pid_t)-1); | - |
3298 | if (r == -1TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
&& | 0-1 |
3299 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3300 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3301 | 10TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3302 | ) | - |
3303 | mark_all_jobs_as_dead (); never executed: mark_all_jobs_as_dead (); | 0 |
3304 | | - |
3305 | | - |
3306 | do { sigemptyset (&set); sigaddset (&set, | - |
3307 | 17 | - |
3308 | ); sigemptyset (&oset); sigprocmask ( | - |
3309 | 0 | - |
3310 | , &set, &oset); } while (0); | - |
3311 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
; i++) | 0-2 |
3312 | if (jobs[i]TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
jobs[(i)]->state == JDEAD)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
) | 0-2 |
3313 | gotoexecuted 1 time by 1 test: goto return_job; return_job;executed 1 time by 1 test: goto return_job; | 1 |
3314 | sigprocmask ( | - |
3315 | 2 | - |
3316 | , &oset, (sigset_t *) | - |
3317 | ((void *)0) | - |
3318 | ); | - |
3319 | } never executed: end of block | 0 |
3320 | | - |
3321 | return never executed: return -1; -1;never executed: return -1; | 0 |
3322 | } | - |
3323 | | - |
3324 | | - |
3325 | | - |
3326 | | - |
3327 | | - |
3328 | void | - |
3329 | notify_and_cleanup () | - |
3330 | { | - |
3331 | if (jobs_list_frozenTRUE | evaluated 134 times by 1 test | FALSE | evaluated 1709099 times by 1 test |
) | 134-1709099 |
3332 | return;executed 134 times by 1 test: return; | 134 |
3333 | | - |
3334 | if (interactiveTRUE | never evaluated | FALSE | evaluated 1709099 times by 1 test |
|| interactive_shell == 0TRUE | evaluated 1709098 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| sourcelevelTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1709099 |
3335 | notify_of_job_status ();executed 1709099 times by 1 test: notify_of_job_status (); | 1709099 |
3336 | | - |
3337 | cleanup_dead_jobs (); | - |
3338 | }executed 1709099 times by 1 test: end of block | 1709099 |
3339 | | - |
3340 | | - |
3341 | | - |
3342 | void | - |
3343 | reap_dead_jobs () | - |
3344 | { | - |
3345 | mark_dead_jobs_as_notified (0); | - |
3346 | cleanup_dead_jobs (); | - |
3347 | }executed 19307759 times by 1 test: end of block | 19307759 |
3348 | | - |
3349 | | - |
3350 | | - |
3351 | | - |
3352 | static int | - |
3353 | most_recent_job_in_state (job, state) | - |
3354 | int job; | - |
3355 | JOB_STATE state; | - |
3356 | { | - |
3357 | register int i, result; | - |
3358 | sigset_t set, oset; | - |
3359 | | - |
3360 | do { sigemptyset (&set); sigaddset (&set, | - |
3361 | 17 | - |
3362 | ); sigemptyset (&oset); sigprocmask ( | - |
3363 | 0 | - |
3364 | , &set, &oset); } while (0); | - |
3365 | | - |
3366 | for (result = -1, i = job - 1; i >= 0TRUE | evaluated 6117 times by 1 test | FALSE | evaluated 751 times by 1 test |
; i--) | 751-6117 |
3367 | { | - |
3368 | if (jobs[i]TRUE | evaluated 577 times by 1 test | FALSE | evaluated 5540 times by 1 test |
&& ((TRUE | evaluated 254 times by 1 test | FALSE | evaluated 323 times by 1 test |
jobs[(i)]->state) == state)TRUE | evaluated 254 times by 1 test | FALSE | evaluated 323 times by 1 test |
) | 254-5540 |
3369 | { | - |
3370 | result = i; | - |
3371 | break;executed 254 times by 1 test: break; | 254 |
3372 | } | - |
3373 | }executed 5863 times by 1 test: end of block | 5863 |
3374 | | - |
3375 | sigprocmask ( | - |
3376 | 2 | - |
3377 | , &oset, (sigset_t *) | - |
3378 | ((void *)0) | - |
3379 | ); | - |
3380 | | - |
3381 | returnexecuted 1005 times by 1 test: return (result); (result);executed 1005 times by 1 test: return (result); | 1005 |
3382 | } | - |
3383 | | - |
3384 | | - |
3385 | | - |
3386 | static int | - |
3387 | job_last_stopped (job) | - |
3388 | int job; | - |
3389 | { | - |
3390 | returnexecuted 387 times by 1 test: return (most_recent_job_in_state (job, JSTOPPED)); (most_recent_job_in_state (job, JSTOPPED));executed 387 times by 1 test: return (most_recent_job_in_state (job, JSTOPPED)); | 387 |
3391 | } | - |
3392 | | - |
3393 | | - |
3394 | | - |
3395 | static int | - |
3396 | job_last_running (job) | - |
3397 | int job; | - |
3398 | { | - |
3399 | returnexecuted 618 times by 1 test: return (most_recent_job_in_state (job, JRUNNING)); (most_recent_job_in_state (job, JRUNNING));executed 618 times by 1 test: return (most_recent_job_in_state (job, JRUNNING)); | 618 |
3400 | } | - |
3401 | | - |
3402 | | - |
3403 | | - |
3404 | static void | - |
3405 | set_current_job (job) | - |
3406 | int job; | - |
3407 | { | - |
3408 | int candidate; | - |
3409 | | - |
3410 | if (js.j_current != jobTRUE | evaluated 220 times by 1 test | FALSE | evaluated 16 times by 1 test |
) | 16-220 |
3411 | { | - |
3412 | js.j_previous = js.j_current; | - |
3413 | js.j_current = job; | - |
3414 | }executed 220 times by 1 test: end of block | 220 |
3415 | | - |
3416 | | - |
3417 | if (js.j_previous != js.j_currentTRUE | evaluated 222 times by 1 test | FALSE | evaluated 14 times by 1 test |
&& | 14-222 |
3418 | js.j_previous != -1TRUE | evaluated 35 times by 1 test | FALSE | evaluated 187 times by 1 test |
&& | 35-187 |
3419 | jobs[js.j_previous]TRUE | evaluated 34 times by 1 test | FALSE | evaluated 1 time by 1 test |
&& | 1-34 |
3420 | (TRUE | never evaluated | FALSE | evaluated 34 times by 1 test |
jobs[(js.j_previous)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 34 times by 1 test |
) | 0-34 |
3421 | return; never executed: return; | 0 |
3422 | | - |
3423 | | - |
3424 | | - |
3425 | candidate = -1; | - |
3426 | if ((TRUE | evaluated 5 times by 1 test | FALSE | evaluated 231 times by 1 test |
jobs[(js.j_current)]->state == JSTOPPED)TRUE | evaluated 5 times by 1 test | FALSE | evaluated 231 times by 1 test |
) | 5-231 |
3427 | { | - |
3428 | candidate = job_last_stopped (js.j_current); | - |
3429 | | - |
3430 | if (candidate != -1TRUE | never evaluated | FALSE | evaluated 5 times by 1 test |
) | 0-5 |
3431 | { | - |
3432 | js.j_previous = candidate; | - |
3433 | return; never executed: return; | 0 |
3434 | } | - |
3435 | }executed 5 times by 1 test: end of block | 5 |
3436 | candidate = (TRUE | evaluated 231 times by 1 test | FALSE | evaluated 5 times by 1 test |
jobs[(js.j_current)]->state == JRUNNING)TRUE | evaluated 231 times by 1 test | FALSE | evaluated 5 times by 1 test |
? job_last_running (js.j_current) | 5-231 |
3437 | : job_last_running (js.j_jobslots); | - |
3438 | | - |
3439 | if (candidate != -1TRUE | evaluated 35 times by 1 test | FALSE | evaluated 201 times by 1 test |
) | 35-201 |
3440 | { | - |
3441 | js.j_previous = candidate; | - |
3442 | return;executed 35 times by 1 test: return; | 35 |
3443 | } | - |
3444 | | - |
3445 | | - |
3446 | js.j_previous = js.j_current; | - |
3447 | }executed 201 times by 1 test: end of block | 201 |
3448 | static void | - |
3449 | reset_current () | - |
3450 | { | - |
3451 | int candidate; | - |
3452 | | - |
3453 | if (js.j_jobslotsTRUE | evaluated 382 times by 1 test | FALSE | never evaluated |
&& js.j_current != -1TRUE | evaluated 194 times by 1 test | FALSE | evaluated 188 times by 1 test |
&& jobs[js.j_current]TRUE | evaluated 44 times by 1 test | FALSE | evaluated 150 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 44 times by 1 test |
jobs[(js.j_current)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 44 times by 1 test |
) | 0-382 |
3454 | candidate = js.j_current; never executed: candidate = js.j_current; | 0 |
3455 | else | - |
3456 | { | - |
3457 | candidate = -1; | - |
3458 | | - |
3459 | | - |
3460 | if (js.j_previous != -1TRUE | evaluated 194 times by 1 test | FALSE | evaluated 188 times by 1 test |
&& jobs[js.j_previous]TRUE | evaluated 32 times by 1 test | FALSE | evaluated 162 times by 1 test |
&& (TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
jobs[(js.j_previous)]->state == JSTOPPED)TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
) | 0-194 |
3461 | candidate = js.j_previous; never executed: candidate = js.j_previous; | 0 |
3462 | | - |
3463 | | - |
3464 | if (candidate == -1TRUE | evaluated 382 times by 1 test | FALSE | never evaluated |
) | 0-382 |
3465 | candidate = job_last_stopped (js.j_jobslots);executed 382 times by 1 test: candidate = job_last_stopped (js.j_jobslots); | 382 |
3466 | | - |
3467 | | - |
3468 | if (candidate == -1TRUE | evaluated 382 times by 1 test | FALSE | never evaluated |
) | 0-382 |
3469 | candidate = job_last_running (js.j_jobslots);executed 382 times by 1 test: candidate = job_last_running (js.j_jobslots); | 382 |
3470 | }executed 382 times by 1 test: end of block | 382 |
3471 | | - |
3472 | | - |
3473 | | - |
3474 | if (candidate != -1TRUE | evaluated 219 times by 1 test | FALSE | evaluated 163 times by 1 test |
) | 163-219 |
3475 | set_current_job (candidate);executed 219 times by 1 test: set_current_job (candidate); | 219 |
3476 | else | - |
3477 | js.j_current = js.j_previous = -1;executed 163 times by 1 test: js.j_current = js.j_previous = -1; | 163 |
3478 | } | - |
3479 | | - |
3480 | | - |
3481 | | - |
3482 | static void | - |
3483 | set_job_running (job) | - |
3484 | int job; | - |
3485 | { | - |
3486 | register PROCESS *p; | - |
3487 | | - |
3488 | | - |
3489 | p = jobs[job]->pipe; | - |
3490 | | - |
3491 | do | - |
3492 | { | - |
3493 | if ( | - |
3494 | (((TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
3495 | p->statusTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
3496 | ) & 0xff) == 0x7f)TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
3497 | ) | - |
3498 | p->running = 1;executed 3 times by 1 test: p->running = 1; | 3 |
3499 | p = p->next; | - |
3500 | }executed 3 times by 1 test: end of block | 3 |
3501 | while (p != jobs[job]->pipeTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
); | 0-3 |
3502 | | - |
3503 | | - |
3504 | (jobs[(job)]->state) = JRUNNING; | - |
3505 | }executed 3 times by 1 test: end of block | 3 |
3506 | | - |
3507 | | - |
3508 | | - |
3509 | | - |
3510 | | - |
3511 | int | - |
3512 | start_job (job, foreground) | - |
3513 | int job, foreground; | - |
3514 | { | - |
3515 | register PROCESS *p; | - |
3516 | int already_running; | - |
3517 | sigset_t set, oset; | - |
3518 | char *wd, *s; | - |
3519 | static struct termios save_stty; | - |
3520 | | - |
3521 | do { sigemptyset (&set); sigaddset (&set, | - |
3522 | 17 | - |
3523 | ); sigemptyset (&oset); sigprocmask ( | - |
3524 | 0 | - |
3525 | , &set, &oset); } while (0); | - |
3526 | | - |
3527 | if ((TRUE | never evaluated | FALSE | evaluated 17 times by 1 test |
jobs[(job)]->state == JDEAD)TRUE | never evaluated | FALSE | evaluated 17 times by 1 test |
) | 0-17 |
3528 | { | - |
3529 | internal_error ( | - |
3530 | dcgettext (((void *)0), | - |
3531 | "%s: job has terminated" | - |
3532 | , 5) | - |
3533 | , this_command_name); | - |
3534 | sigprocmask ( | - |
3535 | 2 | - |
3536 | , &oset, (sigset_t *) | - |
3537 | ((void *)0) | - |
3538 | ); | - |
3539 | return never executed: return (-1); (-1);never executed: return (-1); | 0 |
3540 | } | - |
3541 | | - |
3542 | already_running = (jobs[(job)]->state == JRUNNING); | - |
3543 | | - |
3544 | if (foreground == 0TRUE | evaluated 4 times by 1 test | FALSE | evaluated 13 times by 1 test |
&& already_runningTRUE | evaluated 3 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-13 |
3545 | { | - |
3546 | internal_error ( | - |
3547 | dcgettext (((void *)0), | - |
3548 | "%s: job %d already in background" | - |
3549 | , 5) | - |
3550 | , this_command_name, job + 1); | - |
3551 | sigprocmask ( | - |
3552 | 2 | - |
3553 | , &oset, (sigset_t *) | - |
3554 | ((void *)0) | - |
3555 | ); | - |
3556 | returnexecuted 3 times by 1 test: return (0); (0);executed 3 times by 1 test: return (0); | 3 |
3557 | } | - |
3558 | | - |
3559 | wd = current_working_directory (); | - |
3560 | | - |
3561 | | - |
3562 | jobs[job]->flags &= ~0x02; | - |
3563 | | - |
3564 | if (foregroundTRUE | evaluated 13 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-13 |
3565 | { | - |
3566 | set_current_job (job); | - |
3567 | jobs[job]->flags |= 0x01; | - |
3568 | }executed 13 times by 1 test: end of block | 13 |
3569 | | - |
3570 | | - |
3571 | p = jobs[job]->pipe; | - |
3572 | | - |
3573 | if (foreground == 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 13 times by 1 test |
) | 1-13 |
3574 | { | - |
3575 | | - |
3576 | | - |
3577 | if (posixly_correct == 0TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1 |
3578 | s = (TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
job == js.j_current)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
? "+ ": ((TRUE | never evaluated | FALSE | never evaluated |
job == js.j_previous)TRUE | never evaluated | FALSE | never evaluated |
? "- " : " ");executed 1 time by 1 test: s = (job == js.j_current) ? "+ ": ((job == js.j_previous) ? "- " : " "); | 0-1 |
3579 | else | - |
3580 | s = " "; never executed: s = " "; | 0 |
3581 | printf ("[%d]%s", job + 1, s); | - |
3582 | }executed 1 time by 1 test: end of block | 1 |
3583 | | - |
3584 | do | - |
3585 | { | - |
3586 | printf ("%s%s", | - |
3587 | p->command ? p->command : "", | - |
3588 | p->next != jobs[job]->pipe? " | " : ""); | - |
3589 | p = p->next; | - |
3590 | }executed 14 times by 1 test: end of block | 14 |
3591 | while (p != jobs[job]->pipeTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
); | 0-14 |
3592 | | - |
3593 | if (foreground == 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 13 times by 1 test |
) | 1-13 |
3594 | printf (" &");executed 1 time by 1 test: printf (" &"); | 1 |
3595 | | - |
3596 | if ( | - |
3597 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3598 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3599 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3600 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3601 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3602 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3603 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3604 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3605 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3606 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3607 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3608 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3609 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3610 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3611 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3612 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3613 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3614 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3615 | , TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3616 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3617 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3618 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3619 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3620 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3621 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3622 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3623 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3624 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3625 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3626 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3627 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3628 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3629 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3630 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3631 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3632 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3633 | , TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3634 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3635 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3636 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3637 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3638 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3639 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3640 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3641 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3642 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3643 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( wd ))[3] - __s2[3]); TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3644 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( wd ))[3] - __s2[3]); | 0-14 |
3645 | ))[3] - __s2[3]);TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( wd ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3646 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3647 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3648 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3649 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3650 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3651 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3652 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3653 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3654 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3655 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3656 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3657 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3658 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3659 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3660 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3661 | , TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3662 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3663 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3664 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3665 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3666 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3667 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3668 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3669 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3670 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3671 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3672 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); | 0-14 |
3673 | ))[3] - __s2[3]);TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3674 | wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3675 | , TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3676 | jobs[job]->wdTRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3677 | )))); }) TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
| 0-14 |
3678 | != 0TRUE | never evaluated | FALSE | evaluated 14 times by 1 test |
) | 0-14 |
3679 | printf (" (wd: %s)", polite_directory_format (jobs[job]->wd)); never executed: printf (" (wd: %s)", polite_directory_format (jobs[job]->wd)); | 0 |
3680 | | - |
3681 | printf ("\n"); | - |
3682 | | - |
3683 | | - |
3684 | if (already_running == 0TRUE | evaluated 2 times by 1 test | FALSE | evaluated 12 times by 1 test |
) | 2-12 |
3685 | set_job_running (job);executed 2 times by 1 test: set_job_running (job); | 2 |
3686 | | - |
3687 | | - |
3688 | if (foregroundTRUE | evaluated 13 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-13 |
3689 | { | - |
3690 | get_tty_state (); | - |
3691 | save_stty = shell_tty_info; | - |
3692 | | - |
3693 | if (((TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
jobs[job]->flags & 0x04) != 0)TRUE | evaluated 13 times by 1 test | FALSE | never evaluated |
) | 0-13 |
3694 | give_terminal_to (jobs[job]->pgrp, 0);executed 13 times by 1 test: give_terminal_to (jobs[job]->pgrp, 0); | 13 |
3695 | }executed 13 times by 1 test: end of block | 13 |
3696 | else | - |
3697 | jobs[job]->flags &= ~0x01;executed 1 time by 1 test: jobs[job]->flags &= ~0x01; | 1 |
3698 | | - |
3699 | | - |
3700 | if (already_running == 0TRUE | evaluated 2 times by 1 test | FALSE | evaluated 12 times by 1 test |
) | 2-12 |
3701 | { | - |
3702 | jobs[job]->flags |= 0x02; | - |
3703 | killpg (jobs[job]->pgrp, | - |
3704 | 18 | - |
3705 | ); | - |
3706 | }executed 2 times by 1 test: end of block | 2 |
3707 | | - |
3708 | if (foregroundTRUE | evaluated 13 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-13 |
3709 | { | - |
3710 | pid_t pid; | - |
3711 | int st; | - |
3712 | | - |
3713 | pid = find_last_pid (job, 0); | - |
3714 | sigprocmask ( | - |
3715 | 2 | - |
3716 | , &oset, (sigset_t *) | - |
3717 | ((void *)0) | - |
3718 | ); | - |
3719 | st = wait_for (pid); | - |
3720 | shell_tty_info = save_stty; | - |
3721 | set_tty_state (); | - |
3722 | returnexecuted 13 times by 1 test: return (st); (st);executed 13 times by 1 test: return (st); | 13 |
3723 | } | - |
3724 | else | - |
3725 | { | - |
3726 | reset_current (); | - |
3727 | sigprocmask ( | - |
3728 | 2 | - |
3729 | , &oset, (sigset_t *) | - |
3730 | ((void *)0) | - |
3731 | ); | - |
3732 | returnexecuted 1 time by 1 test: return (0); (0);executed 1 time by 1 test: return (0); | 1 |
3733 | } | - |
3734 | } | - |
3735 | | - |
3736 | | - |
3737 | | - |
3738 | | - |
3739 | | - |
3740 | int | - |
3741 | kill_pid (pid, sig, group) | - |
3742 | pid_t pid; | - |
3743 | int sig, group; | - |
3744 | { | - |
3745 | register PROCESS *p; | - |
3746 | int job, result, negative; | - |
3747 | sigset_t set, oset; | - |
3748 | | - |
3749 | if (pid < -1TRUE | never evaluated | FALSE | evaluated 17 times by 1 test |
) | 0-17 |
3750 | { | - |
3751 | pid = -pid; | - |
3752 | group = negative = 1; | - |
3753 | } never executed: end of block | 0 |
3754 | else | - |
3755 | negative = 0;executed 17 times by 1 test: negative = 0; | 17 |
3756 | | - |
3757 | result = 0; | - |
3758 | if (groupTRUE | evaluated 7 times by 1 test | FALSE | evaluated 10 times by 1 test |
) | 7-10 |
3759 | { | - |
3760 | do { sigemptyset (&set); sigaddset (&set, | - |
3761 | 17 | - |
3762 | ); sigemptyset (&oset); sigprocmask ( | - |
3763 | 0 | - |
3764 | , &set, &oset); } while (0); | - |
3765 | p = find_pipeline (pid, 0, &job); | - |
3766 | | - |
3767 | if (job != -1TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
) | 0-7 |
3768 | { | - |
3769 | jobs[job]->flags &= ~0x02; | - |
3770 | | - |
3771 | | - |
3772 | | - |
3773 | | - |
3774 | if (negativeTRUE | never evaluated | FALSE | evaluated 7 times by 1 test |
&& jobs[job]->pgrp == shell_pgrpTRUE | never evaluated | FALSE | never evaluated |
) | 0-7 |
3775 | result = killpg (pid, sig); never executed: result = killpg (pid, sig); | 0 |
3776 | | - |
3777 | | - |
3778 | else if (jobs[job]->pgrp == shell_pgrpTRUE | evaluated 1 time by 1 test | FALSE | evaluated 6 times by 1 test |
) | 1-6 |
3779 | { | - |
3780 | p = jobs[job]->pipe; | - |
3781 | do | - |
3782 | { | - |
3783 | if ((((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
p)->running == 1)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3784 | (((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3785 | (p)->statusTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3786 | ) & 0xff) == 0x7f)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3787 | )TRUE | never evaluated | FALSE | never evaluated |
) == 0TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
3788 | continue; never executed: continue; | 0 |
3789 | kill (p->pid, sig); | - |
3790 | if (((TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
p)->running == 0)TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
&& (sig == TRUE | never evaluated | FALSE | never evaluated |
| 0-1 |
3791 | 15TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3792 | || sig == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3793 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3794 | )) | - |
3795 | kill (p->pid, never executed: kill (p->pid, 18 ); | 0 |
3796 | 18 never executed: kill (p->pid, 18 ); | 0 |
3797 | ); never executed: kill (p->pid, 18 ); | 0 |
3798 | p = p->next; | - |
3799 | }executed 1 time by 1 test: end of block | 1 |
3800 | while (p != jobs[job]->pipeTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
); | 0-1 |
3801 | }executed 1 time by 1 test: end of block | 1 |
3802 | else | - |
3803 | { | - |
3804 | result = killpg (jobs[job]->pgrp, sig); | - |
3805 | if (pTRUE | evaluated 6 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 5 times by 1 test |
jobs[(job)]->state == JSTOPPED)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 5 times by 1 test |
&& (sig == TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-6 |
3806 | 15TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3807 | || sig == TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3808 | 1TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
| 0-1 |
3809 | )) | - |
3810 | killpg (jobs[job]->pgrp, never executed: killpg (jobs[job]->pgrp, 18 ); | 0 |
3811 | 18 never executed: killpg (jobs[job]->pgrp, 18 ); | 0 |
3812 | ); never executed: killpg (jobs[job]->pgrp, 18 ); | 0 |
3813 | | - |
3814 | | - |
3815 | if (pTRUE | evaluated 6 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 5 times by 1 test |
jobs[(job)]->state == JSTOPPED)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 5 times by 1 test |
&& (TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
sig == TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-6 |
3816 | 18TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
3817 | )TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
) | 0-1 |
3818 | { | - |
3819 | set_job_running (job); | - |
3820 | jobs[job]->flags &= ~0x01; | - |
3821 | jobs[job]->flags |= 0x02; | - |
3822 | }executed 1 time by 1 test: end of block | 1 |
3823 | }executed 6 times by 1 test: end of block | 6 |
3824 | } | - |
3825 | else | - |
3826 | result = killpg (pid, sig); never executed: result = killpg (pid, sig); | 0 |
3827 | | - |
3828 | sigprocmask ( | - |
3829 | 2 | - |
3830 | , &oset, (sigset_t *) | - |
3831 | ((void *)0) | - |
3832 | ); | - |
3833 | }executed 7 times by 1 test: end of block | 7 |
3834 | else | - |
3835 | result = kill (pid, sig);executed 10 times by 1 test: result = kill (pid, sig); | 10 |
3836 | | - |
3837 | returnexecuted 17 times by 1 test: return (result); (result);executed 17 times by 1 test: return (result); | 17 |
3838 | } | - |
3839 | | - |
3840 | | - |
3841 | | - |
3842 | static void | - |
3843 | sigchld_handler (sig) | - |
3844 | int sig; | - |
3845 | { | - |
3846 | int n, oerrno; | - |
3847 | | - |
3848 | oerrno = | - |
3849 | (*__errno_location ()) | - |
3850 | ; | - |
3851 | ; | - |
3852 | sigchld++; | - |
3853 | n = 0; | - |
3854 | if (queue_sigchld == 0TRUE | evaluated 3958703 times by 1 test | FALSE | never evaluated |
) | 0-3958703 |
3855 | n = waitchld (-1, 0);executed 3958703 times by 1 test: n = waitchld (-1, 0); | 3958703 |
3856 | | - |
3857 | (*__errno_location ()) | - |
3858 | = oerrno; | - |
3859 | return;executed 3958703 times by 1 test: return; | 3958703 |
3860 | } | - |
3861 | static int | - |
3862 | waitchld (wpid, block) | - |
3863 | pid_t wpid; | - |
3864 | int block; | - |
3865 | { | - |
3866 | WAIT status; | - |
3867 | PROCESS *child; | - |
3868 | pid_t pid; | - |
3869 | int ind; | - |
3870 | | - |
3871 | int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; | - |
3872 | static int wcontinued = | - |
3873 | 8 | - |
3874 | ; | - |
3875 | | - |
3876 | call_set_current = children_exited = 0; | - |
3877 | last_stopped_job = -1; | - |
3878 | | - |
3879 | do | - |
3880 | { | - |
3881 | | - |
3882 | | - |
3883 | waitpid_flags = (job_controlTRUE | evaluated 107 times by 1 test | FALSE | evaluated 7944566 times by 1 test |
&& subshell_environment == 0TRUE | evaluated 107 times by 1 test | FALSE | never evaluated |
) | 0-7944566 |
3884 | ? ( | - |
3885 | 2 | - |
3886 | |wcontinued) | - |
3887 | : 0; | - |
3888 | if (sigchldTRUE | evaluated 3958703 times by 1 test | FALSE | evaluated 3985970 times by 1 test |
|| block == 0TRUE | evaluated 3146463 times by 1 test | FALSE | evaluated 839507 times by 1 test |
) | 839507-3985970 |
3889 | waitpid_flags |= executed 7105166 times by 1 test: waitpid_flags |= 1 ; | 7105166 |
3890 | 1executed 7105166 times by 1 test: waitpid_flags |= 1 ; | 7105166 |
3891 | ;executed 7105166 times by 1 test: waitpid_flags |= 1 ; | 7105166 |
3892 | | - |
3893 | | - |
3894 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 7944673 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0-7944673 |
3895 | | - |
3896 | do { if (wait_intr_flagTRUE | evaluated 466 times by 1 test | FALSE | evaluated 7944207 times by 1 test |
&& wait_signal_receivedTRUE | never evaluated | FALSE | evaluated 466 times by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0-7944207 |
3897 | | - |
3898 | if (block == 1TRUE | evaluated 839507 times by 1 test | FALSE | evaluated 7105166 times by 1 test |
&& queue_sigchld == 0TRUE | never evaluated | FALSE | evaluated 839507 times by 1 test |
&& (TRUE | never evaluated | FALSE | never evaluated |
waitpid_flags & TRUE | never evaluated | FALSE | never evaluated |
| 0-7105166 |
3899 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3900 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3901 | { | - |
3902 | internal_warning ( | - |
3903 | dcgettext (((void *)0), | - |
3904 | "waitchld: turning on WNOHANG to avoid indefinite block" | - |
3905 | , 5) | - |
3906 | ); | - |
3907 | waitpid_flags |= | - |
3908 | 1 | - |
3909 | ; | - |
3910 | } never executed: end of block | 0 |
3911 | | - |
3912 | pid = waitpid ((pid_t)-1, &status, waitpid_flags); | - |
3913 | if (wcontinuedTRUE | evaluated 7944672 times by 1 test | FALSE | never evaluated |
&& pid < 0TRUE | evaluated 3749667 times by 1 test | FALSE | evaluated 4195005 times by 1 test |
&& | 0-7944672 |
3914 | (*TRUE | never evaluated | FALSE | evaluated 3749667 times by 1 test |
__errno_location ()) TRUE | never evaluated | FALSE | evaluated 3749667 times by 1 test |
| 0-3749667 |
3915 | == TRUE | never evaluated | FALSE | evaluated 3749667 times by 1 test |
| 0-3749667 |
3916 | 22TRUE | never evaluated | FALSE | evaluated 3749667 times by 1 test |
| 0-3749667 |
3917 | ) | - |
3918 | { | - |
3919 | wcontinued = 0; | - |
3920 | continue; never executed: continue; | 0 |
3921 | } | - |
3922 | | - |
3923 | | - |
3924 | | - |
3925 | if (sigchld > 0TRUE | evaluated 3958703 times by 1 test | FALSE | evaluated 3985969 times by 1 test |
&& (TRUE | evaluated 3958703 times by 1 test | FALSE | never evaluated |
waitpid_flags & TRUE | evaluated 3958703 times by 1 test | FALSE | never evaluated |
| 0-3985969 |
3926 | 1TRUE | evaluated 3958703 times by 1 test | FALSE | never evaluated |
| 0-3958703 |
3927 | )TRUE | evaluated 3958703 times by 1 test | FALSE | never evaluated |
) | 0-3958703 |
3928 | sigchld--;executed 3958703 times by 1 test: sigchld--; | 3958703 |
3929 | | - |
3930 | | - |
3931 | | - |
3932 | if (pid < 0TRUE | evaluated 3749667 times by 1 test | FALSE | evaluated 4195005 times by 1 test |
&& | 3749667-4195005 |
3933 | (*TRUE | evaluated 3749667 times by 1 test | FALSE | never evaluated |
__errno_location ()) TRUE | evaluated 3749667 times by 1 test | FALSE | never evaluated |
| 0-3749667 |
3934 | == TRUE | evaluated 3749667 times by 1 test | FALSE | never evaluated |
| 0-3749667 |
3935 | 10TRUE | evaluated 3749667 times by 1 test | FALSE | never evaluated |
| 0-3749667 |
3936 | ) | - |
3937 | { | - |
3938 | if (children_exited == 0TRUE | evaluated 803299 times by 1 test | FALSE | evaluated 2946368 times by 1 test |
) | 803299-2946368 |
3939 | returnexecuted 803299 times by 1 test: return -1; -1;executed 803299 times by 1 test: return -1; | 803299 |
3940 | else | - |
3941 | break;executed 2946368 times by 1 test: break; | 2946368 |
3942 | } | - |
3943 | | - |
3944 | | - |
3945 | | - |
3946 | | - |
3947 | | - |
3948 | | - |
3949 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 4195005 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0-4195005 |
3950 | do { if (wait_intr_flagTRUE | evaluated 182 times by 1 test | FALSE | evaluated 4194823 times by 1 test |
&& wait_signal_receivedTRUE | never evaluated | FALSE | evaluated 182 times by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
this_shell_builtin == wait_builtin)TRUE | never evaluated | FALSE | never evaluated |
) siglongjmp((wait_intr_buf), (1));never executed: siglongjmp((wait_intr_buf), (1)); } while (0); | 0-4194823 |
3951 | | - |
3952 | | - |
3953 | | - |
3954 | | - |
3955 | | - |
3956 | | - |
3957 | if (pid < 0TRUE | never evaluated | FALSE | evaluated 4195005 times by 1 test |
&& | 0-4195005 |
3958 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3959 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3960 | 4TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3961 | && wait_sigint_receivedTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
3962 | child_caught_sigint = 1; never executed: child_caught_sigint = 1; | 0 |
3963 | | - |
3964 | if (pid <= 0TRUE | evaluated 209174 times by 1 test | FALSE | evaluated 3985831 times by 1 test |
) | 209174-3985831 |
3965 | continue;executed 209174 times by 1 test: continue; | 209174 |
3966 | | - |
3967 | | - |
3968 | | - |
3969 | | - |
3970 | | - |
3971 | if (wait_sigint_receivedTRUE | never evaluated | FALSE | evaluated 3985831 times by 1 test |
&& ( | 0-3985831 |
3972 | (((TRUE | never evaluated | FALSE | never evaluated |
signed char) (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3973 | statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
3974 | ) & 0x7f) + 1) >> 1) > 0) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3975 | == 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
3976 | ((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3977 | statusTRUE | never evaluated | FALSE | never evaluated |
| 0 |
3978 | ) & 0x7f) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3979 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3980 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
3981 | )) | - |
3982 | child_caught_sigint = 1; never executed: child_caught_sigint = 1; | 0 |
3983 | | - |
3984 | | - |
3985 | | - |
3986 | if ( | - |
3987 | (((TRUE | evaluated 11 times by 1 test | FALSE | evaluated 3985820 times by 1 test |
signed char) (((TRUE | evaluated 11 times by 1 test | FALSE | evaluated 3985820 times by 1 test |
| 11-3985820 |
3988 | statusTRUE | evaluated 11 times by 1 test | FALSE | evaluated 3985820 times by 1 test |
| 11-3985820 |
3989 | ) & 0x7f) + 1) >> 1) > 0)TRUE | evaluated 11 times by 1 test | FALSE | evaluated 3985820 times by 1 test |
| 11-3985820 |
3990 | && | - |
3991 | ((TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
3992 | statusTRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
3993 | ) & 0x7f) TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
3994 | == TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
3995 | 2TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
3996 | ) | - |
3997 | child_caught_sigint = 0; never executed: child_caught_sigint = 0; | 0 |
3998 | | - |
3999 | | - |
4000 | | - |
4001 | if ( | - |
4002 | ((TRUE | evaluated 3985827 times by 1 test | FALSE | evaluated 4 times by 1 test |
| 4-3985827 |
4003 | statusTRUE | evaluated 3985827 times by 1 test | FALSE | evaluated 4 times by 1 test |
| 4-3985827 |
4004 | ) == 0xffff) TRUE | evaluated 3985827 times by 1 test | FALSE | evaluated 4 times by 1 test |
| 4-3985827 |
4005 | == 0TRUE | evaluated 3985827 times by 1 test | FALSE | evaluated 4 times by 1 test |
) | 4-3985827 |
4006 | { | - |
4007 | children_exited++; | - |
4008 | js.c_living--; | - |
4009 | }executed 3985827 times by 1 test: end of block | 3985827 |
4010 | | - |
4011 | | - |
4012 | child = find_process (pid, 1, &job); | - |
4013 | | - |
4014 | | - |
4015 | coproc_pidchk (pid, (status)); | - |
4016 | | - |
4017 | | - |
4018 | | - |
4019 | | - |
4020 | | - |
4021 | if ((TRUE | evaluated 476018 times by 1 test | FALSE | evaluated 3509813 times by 1 test |
ind = find_procsub_child (pid)) >= 0TRUE | evaluated 476018 times by 1 test | FALSE | evaluated 3509813 times by 1 test |
) | 476018-3509813 |
4022 | set_procsub_status (ind, pid, (status));executed 476018 times by 1 test: set_procsub_status (ind, pid, (status)); | 476018 |
4023 | | - |
4024 | | - |
4025 | | - |
4026 | | - |
4027 | | - |
4028 | | - |
4029 | | - |
4030 | if (child == 0TRUE | evaluated 192444 times by 1 test | FALSE | evaluated 3793387 times by 1 test |
) | 192444-3793387 |
4031 | { | - |
4032 | if ( | - |
4033 | (((TRUE | evaluated 192443 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-192443 |
4034 | statusTRUE | evaluated 192443 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-192443 |
4035 | ) & 0x7f) == 0)TRUE | evaluated 192443 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-192443 |
4036 | || | - |
4037 | (((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
signed char) (((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
4038 | statusTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
4039 | ) & 0x7f) + 1) >> 1) > 0)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
4040 | ) | - |
4041 | js.c_reaped++;executed 192444 times by 1 test: js.c_reaped++; | 192444 |
4042 | continue;executed 192444 times by 1 test: continue; | 192444 |
4043 | } | - |
4044 | | - |
4045 | | - |
4046 | child->status = status; | - |
4047 | child->running = | - |
4048 | ((TRUE | evaluated 4 times by 1 test | FALSE | evaluated 3793383 times by 1 test |
| 4-3793383 |
4049 | statusTRUE | evaluated 4 times by 1 test | FALSE | evaluated 3793383 times by 1 test |
| 4-3793383 |
4050 | ) == 0xffff)TRUE | evaluated 4 times by 1 test | FALSE | evaluated 3793383 times by 1 test |
| 4-3793383 |
4051 | ? 1 : 0; | - |
4052 | | - |
4053 | if (((TRUE | evaluated 3793383 times by 1 test | FALSE | evaluated 4 times by 1 test |
child)->running == 0)TRUE | evaluated 3793383 times by 1 test | FALSE | evaluated 4 times by 1 test |
) | 4-3793383 |
4054 | { | - |
4055 | js.c_totreaped++; | - |
4056 | if (job != -1TRUE | evaluated 55010 times by 1 test | FALSE | evaluated 3738373 times by 1 test |
) | 55010-3738373 |
4057 | js.c_reaped++;executed 55010 times by 1 test: js.c_reaped++; | 55010 |
4058 | }executed 3793383 times by 1 test: end of block | 3793383 |
4059 | | - |
4060 | if (job == -1TRUE | evaluated 3738373 times by 1 test | FALSE | evaluated 55014 times by 1 test |
) | 55014-3738373 |
4061 | continue;executed 3738373 times by 1 test: continue; | 3738373 |
4062 | | - |
4063 | call_set_current += set_job_status_and_cleanup (job); | - |
4064 | | - |
4065 | if ((TRUE | evaluated 4 times by 1 test | FALSE | evaluated 55010 times by 1 test |
jobs[(job)]->state == JSTOPPED)TRUE | evaluated 4 times by 1 test | FALSE | evaluated 55010 times by 1 test |
) | 4-55010 |
4066 | last_stopped_job = job;executed 4 times by 1 test: last_stopped_job = job; | 4 |
4067 | else if ((TRUE | evaluated 42759 times by 1 test | FALSE | evaluated 12251 times by 1 test |
jobs[(job)]->state == JDEAD)TRUE | evaluated 42759 times by 1 test | FALSE | evaluated 12251 times by 1 test |
&& last_stopped_job == jobTRUE | never evaluated | FALSE | evaluated 42759 times by 1 test |
) | 0-42759 |
4068 | last_stopped_job = -1; never executed: last_stopped_job = -1; | 0 |
4069 | }executed 55014 times by 1 test: end of block | 55014 |
4070 | while ((sigchldTRUE | never evaluated | FALSE | evaluated 4195005 times by 1 test |
|| block == 0TRUE | evaluated 3355637 times by 1 test | FALSE | evaluated 839368 times by 1 test |
) && pid > (pid_t)0TRUE | evaluated 3146463 times by 1 test | FALSE | evaluated 209174 times by 1 test |
); | 0-4195005 |
4071 | | - |
4072 | | - |
4073 | | - |
4074 | if (call_set_currentTRUE | evaluated 5 times by 1 test | FALSE | evaluated 3994905 times by 1 test |
) | 5-3994905 |
4075 | { | - |
4076 | if (last_stopped_job != -1TRUE | evaluated 4 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-4 |
4077 | set_current_job (last_stopped_job);executed 4 times by 1 test: set_current_job (last_stopped_job); | 4 |
4078 | else | - |
4079 | reset_current ();executed 1 time by 1 test: reset_current (); | 1 |
4080 | } | - |
4081 | | - |
4082 | | - |
4083 | | - |
4084 | if (children_exitedTRUE | evaluated 3985827 times by 1 test | FALSE | evaluated 9083 times by 1 test |
&& | 9083-3985827 |
4085 | (signal_is_trapped (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 3985824 times by 1 test |
| 3-3985824 |
4086 | 17TRUE | evaluated 3 times by 1 test | FALSE | evaluated 3985824 times by 1 test |
| 3-3985824 |
4087 | )TRUE | evaluated 3 times by 1 test | FALSE | evaluated 3985824 times by 1 test |
|| trap_list[TRUE | never evaluated | FALSE | evaluated 3985824 times by 1 test |
| 0-3985824 |
4088 | 17TRUE | never evaluated | FALSE | evaluated 3985824 times by 1 test |
| 0-3985824 |
4089 | ] == (char *)(SigHandler *)initialize_trapsTRUE | never evaluated | FALSE | evaluated 3985824 times by 1 test |
) && | 0-3985824 |
4090 | trap_list[TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
4091 | 17TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
4092 | ] != (char *)TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
4093 | ((__sighandler_t) 1)TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
| 0-3 |
4094 | ) | - |
4095 | { | - |
4096 | if (posixly_correctTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
&& this_shell_builtinTRUE | never evaluated | FALSE | never evaluated |
&& this_shell_builtin == wait_builtinTRUE | never evaluated | FALSE | never evaluated |
) | 0-3 |
4097 | { | - |
4098 | interrupt_immediately = 0; | - |
4099 | | - |
4100 | | - |
4101 | queue_sigchld_trap (children_exited); | - |
4102 | wait_signal_received = | - |
4103 | 17 | - |
4104 | ; | - |
4105 | | - |
4106 | | - |
4107 | if (sigchld == 0TRUE | never evaluated | FALSE | never evaluated |
&& wait_intr_flagTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4108 | siglongjmp((wait_intr_buf), (1)); never executed: siglongjmp((wait_intr_buf), (1)); | 0 |
4109 | } never executed: end of block | 0 |
4110 | | - |
4111 | | - |
4112 | | - |
4113 | else if (sigchldTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
4114 | queue_sigchld_trap (children_exited); never executed: queue_sigchld_trap (children_exited); | 0 |
4115 | else if (signal_in_progress (TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
4116 | 17TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
4117 | )TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
4118 | queue_sigchld_trap (children_exited); never executed: queue_sigchld_trap (children_exited); | 0 |
4119 | else if (trap_list[TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
4120 | 17TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
4121 | ] == (char *)(SigHandler *)initialize_trapsTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
4122 | queue_sigchld_trap (children_exited); never executed: queue_sigchld_trap (children_exited); | 0 |
4123 | else if (running_trapTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
4124 | queue_sigchld_trap (children_exited); never executed: queue_sigchld_trap (children_exited); | 0 |
4125 | else if (this_shell_builtin == wait_builtinTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) | 0-3 |
4126 | run_sigchld_trap (children_exited);executed 3 times by 1 test: run_sigchld_trap (children_exited); | 3 |
4127 | else | - |
4128 | queue_sigchld_trap (children_exited); never executed: queue_sigchld_trap (children_exited); | 0 |
4129 | } | - |
4130 | | - |
4131 | | - |
4132 | | - |
4133 | | - |
4134 | | - |
4135 | if (asynchronous_notificationTRUE | never evaluated | FALSE | evaluated 3994910 times by 1 test |
&& interactiveTRUE | never evaluated | FALSE | never evaluated |
) | 0-3994910 |
4136 | notify_of_job_status (); never executed: notify_of_job_status (); | 0 |
4137 | | - |
4138 | returnexecuted 3994910 times by 1 test: return (children_exited); (children_exited);executed 3994910 times by 1 test: return (children_exited); | 3994910 |
4139 | } | - |
4140 | | - |
4141 | | - |
4142 | | - |
4143 | | - |
4144 | | - |
4145 | | - |
4146 | static int | - |
4147 | set_job_status_and_cleanup (job) | - |
4148 | int job; | - |
4149 | { | - |
4150 | PROCESS *child; | - |
4151 | int tstatus, job_state, any_stopped, any_tstped, call_set_current; | - |
4152 | SigHandler *temp_handler; | - |
4153 | | - |
4154 | child = jobs[job]->pipe; | - |
4155 | jobs[job]->flags &= ~0x02; | - |
4156 | | - |
4157 | call_set_current = 0; | - |
4158 | | - |
4159 | | - |
4160 | | - |
4161 | | - |
4162 | | - |
4163 | | - |
4164 | | - |
4165 | job_state = any_stopped = any_tstped = 0; | - |
4166 | do | - |
4167 | { | - |
4168 | job_state |= ((child)->running == 1); | - |
4169 | | - |
4170 | | - |
4171 | | - |
4172 | | - |
4173 | if ((TRUE | evaluated 4 times by 1 test | FALSE | evaluated 80151 times by 1 test |
| 4-80151 |
4174 | (((TRUE | evaluated 4 times by 1 test | FALSE | evaluated 80151 times by 1 test |
| 4-80151 |
4175 | (child)->statusTRUE | evaluated 4 times by 1 test | FALSE | evaluated 80151 times by 1 test |
| 4-80151 |
4176 | ) & 0xff) == 0x7f)TRUE | evaluated 4 times by 1 test | FALSE | evaluated 80151 times by 1 test |
| 4-80151 |
4177 | )TRUE | evaluated 4 times by 1 test | FALSE | evaluated 80151 times by 1 test |
) | 4-80151 |
4178 | | - |
4179 | { | - |
4180 | any_stopped = 1; | - |
4181 | any_tstped |= job_controlTRUE | evaluated 4 times by 1 test | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4182 | (((TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4183 | child->statusTRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4184 | ) & 0xff00) >> 8) TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4185 | == TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4186 | 20TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
| 0-4 |
4187 | )TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
; | 0-4 |
4188 | }executed 4 times by 1 test: end of block | 4 |
4189 | child = child->next; | - |
4190 | }executed 80155 times by 1 test: end of block | 80155 |
4191 | while (child != jobs[job]->pipeTRUE | evaluated 25141 times by 1 test | FALSE | evaluated 55014 times by 1 test |
); | 25141-55014 |
4192 | | - |
4193 | | - |
4194 | | - |
4195 | | - |
4196 | if (job_state != 0TRUE | evaluated 12251 times by 1 test | FALSE | evaluated 42763 times by 1 test |
&& (TRUE | evaluated 12250 times by 1 test | FALSE | evaluated 1 time by 1 test |
jobs[(job)]->state) != JSTOPPEDTRUE | evaluated 12250 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-42763 |
4197 | returnexecuted 12250 times by 1 test: return 0; 0;executed 12250 times by 1 test: return 0; | 12250 |
4198 | | - |
4199 | | - |
4200 | | - |
4201 | | - |
4202 | | - |
4203 | | - |
4204 | if (any_stoppedTRUE | evaluated 4 times by 1 test | FALSE | evaluated 42760 times by 1 test |
) | 4-42760 |
4205 | { | - |
4206 | jobs[job]->state = JSTOPPED; | - |
4207 | jobs[job]->flags &= ~0x01; | - |
4208 | call_set_current++; | - |
4209 | | - |
4210 | if (any_tstpedTRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
&& loop_levelTRUE | never evaluated | FALSE | never evaluated |
) | 0-4 |
4211 | breaking = loop_level; never executed: breaking = loop_level; | 0 |
4212 | }executed 4 times by 1 test: end of block | 4 |
4213 | else if (job_state != 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 42759 times by 1 test |
) | 1-42759 |
4214 | { | - |
4215 | jobs[job]->state = JRUNNING; | - |
4216 | call_set_current++; | - |
4217 | }executed 1 time by 1 test: end of block | 1 |
4218 | else | - |
4219 | { | - |
4220 | jobs[job]->state = JDEAD; | - |
4221 | js.j_ndead++; | - |
4222 | if (jobs[job]->j_cleanupTRUE | never evaluated | FALSE | evaluated 42759 times by 1 test |
) | 0-42759 |
4223 | { | - |
4224 | (*jobs[job]->j_cleanup) (jobs[job]->cleanarg); | - |
4225 | jobs[job]->j_cleanup = (sh_vptrfunc_t *) | - |
4226 | ((void *)0) | - |
4227 | ; | - |
4228 | } never executed: end of block | 0 |
4229 | }executed 42759 times by 1 test: end of block | 42759 |
4230 | if ((TRUE | evaluated 42759 times by 1 test | FALSE | evaluated 5 times by 1 test |
jobs[(job)]->state) == JDEADTRUE | evaluated 42759 times by 1 test | FALSE | evaluated 5 times by 1 test |
) | 5-42759 |
4231 | { | - |
4232 | | - |
4233 | | - |
4234 | | - |
4235 | | - |
4236 | if (wait_sigint_receivedTRUE | never evaluated | FALSE | evaluated 42759 times by 1 test |
&& interactive_shell == 0TRUE | never evaluated | FALSE | never evaluated |
&& | 0-42759 |
4237 | child_caught_sigintTRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x01) != 0)TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
4238 | signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4239 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4240 | )TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4241 | { | - |
4242 | int old_frozen; | - |
4243 | wait_sigint_received = 0; | - |
4244 | last_command_exit_value = process_exit_status (child->status); | - |
4245 | | - |
4246 | old_frozen = jobs_list_frozen; | - |
4247 | jobs_list_frozen = 1; | - |
4248 | tstatus = maybe_call_trap_handler ( | - |
4249 | 2 | - |
4250 | ); | - |
4251 | jobs_list_frozen = old_frozen; | - |
4252 | } never executed: end of block | 0 |
4253 | else if (wait_sigint_receivedTRUE | never evaluated | FALSE | evaluated 42759 times by 1 test |
&& | 0-42759 |
4254 | child_caught_sigint == 0TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
4255 | ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x01) != 0)TRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
jobs[job]->flags & 0x04) != 0) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4256 | { | - |
4257 | int old_frozen; | - |
4258 | | - |
4259 | wait_sigint_received = 0; | - |
4260 | | - |
4261 | | - |
4262 | | - |
4263 | if (signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4264 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4265 | )TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4266 | last_command_exit_value = process_exit_status (child->status); never executed: last_command_exit_value = process_exit_status (child->status); | 0 |
4267 | | - |
4268 | | - |
4269 | | - |
4270 | | - |
4271 | | - |
4272 | | - |
4273 | old_frozen = jobs_list_frozen; | - |
4274 | jobs_list_frozen = 1; | - |
4275 | tstatus = maybe_call_trap_handler ( | - |
4276 | 2 | - |
4277 | ); | - |
4278 | jobs_list_frozen = old_frozen; | - |
4279 | if (tstatus == 0TRUE | never evaluated | FALSE | never evaluated |
&& old_sigint_handler != (SigHandler *)wait_for_background_pidsTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4280 | { | - |
4281 | | - |
4282 | | - |
4283 | | - |
4284 | | - |
4285 | | - |
4286 | | - |
4287 | temp_handler = old_sigint_handler; | - |
4288 | | - |
4289 | | - |
4290 | | - |
4291 | | - |
4292 | | - |
4293 | | - |
4294 | if (temp_handler == trap_handlerTRUE | never evaluated | FALSE | never evaluated |
&& signal_is_trapped (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4295 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4296 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4297 | temp_handler = trap_to_sighandler ( never executed: temp_handler = trap_to_sighandler ( 2 ); | 0 |
4298 | 2 never executed: temp_handler = trap_to_sighandler ( 2 ); | 0 |
4299 | ); never executed: temp_handler = trap_to_sighandler ( 2 ); | 0 |
4300 | restore_sigint_handler (); | - |
4301 | if (temp_handler == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4302 | ((__sighandler_t) 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4303 | ) | - |
4304 | termsig_handler ( never executed: termsig_handler ( 2 ); | 0 |
4305 | 2 never executed: termsig_handler ( 2 ); | 0 |
4306 | ); never executed: termsig_handler ( 2 ); | 0 |
4307 | else if (temp_handler != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4308 | ((__sighandler_t) 1)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4309 | ) | - |
4310 | (* never executed: (*temp_handler) ( 2 ); temp_handler) (never executed: (*temp_handler) ( 2 ); | 0 |
4311 | 2 never executed: (*temp_handler) ( 2 ); | 0 |
4312 | ); never executed: (*temp_handler) ( 2 ); | 0 |
4313 | } never executed: end of block | 0 |
4314 | } never executed: end of block | 0 |
4315 | }executed 42759 times by 1 test: end of block | 42759 |
4316 | | - |
4317 | returnexecuted 42764 times by 1 test: return call_set_current; call_set_current;executed 42764 times by 1 test: return call_set_current; | 42764 |
4318 | } | - |
4319 | | - |
4320 | | - |
4321 | | - |
4322 | static void | - |
4323 | setjstatus (j) | - |
4324 | int j; | - |
4325 | { | - |
4326 | | - |
4327 | register int i; | - |
4328 | register PROCESS *p; | - |
4329 | | - |
4330 | for (i = 1, p = jobs[j]->pipe; p->next != jobs[j]->pipeTRUE | evaluated 12381 times by 1 test | FALSE | evaluated 42565 times by 1 test |
; p = p->next, i++) | 12381-42565 |
4331 | ;executed 12381 times by 1 test: ; | 12381 |
4332 | i++; | - |
4333 | if (statsize < iTRUE | evaluated 6023 times by 1 test | FALSE | evaluated 36542 times by 1 test |
) | 6023-36542 |
4334 | { | - |
4335 | pstatuses = (int *)sh_xrealloc((pstatuses), (i * sizeof (int)), "jobs.c", 3952); | - |
4336 | statsize = i; | - |
4337 | }executed 6023 times by 1 test: end of block | 6023 |
4338 | i = 0; | - |
4339 | p = jobs[j]->pipe; | - |
4340 | do | - |
4341 | { | - |
4342 | pstatuses[i++] = process_exit_status (p->status); | - |
4343 | p = p->next; | - |
4344 | }executed 54946 times by 1 test: end of block | 54946 |
4345 | while (p != jobs[j]->pipeTRUE | evaluated 12381 times by 1 test | FALSE | evaluated 42565 times by 1 test |
); | 12381-42565 |
4346 | | - |
4347 | pstatuses[i] = -1; | - |
4348 | set_pipestatus_array (pstatuses, i); | - |
4349 | | - |
4350 | }executed 42565 times by 1 test: end of block | 42565 |
4351 | | - |
4352 | void | - |
4353 | run_sigchld_trap (nchild) | - |
4354 | int nchild; | - |
4355 | { | - |
4356 | char *trap_command; | - |
4357 | int i; | - |
4358 | | - |
4359 | | - |
4360 | | - |
4361 | | - |
4362 | | - |
4363 | trap_command = (char *)strcpy (sh_xmalloc((1 + strlen (trap_list[ | - |
4364 | 17 | - |
4365 | ])), "jobs.c", 3980), (trap_list[ | - |
4366 | 17 | - |
4367 | ])); | - |
4368 | | - |
4369 | begin_unwind_frame ("SIGCHLD trap"); | - |
4370 | unwind_protect_mem ((char *)&(last_command_exit_value), sizeof (last_command_exit_value)); | - |
4371 | unwind_protect_mem ((char *)&(last_command_exit_signal), sizeof (last_command_exit_signal)); | - |
4372 | unwind_protect_mem ((char *)&(last_made_pid), sizeof (last_made_pid)); | - |
4373 | unwind_protect_mem ((char *)&(interrupt_immediately), sizeof (interrupt_immediately)); | - |
4374 | unwind_protect_mem ((char *)&(jobs_list_frozen), sizeof (jobs_list_frozen)); | - |
4375 | unwind_protect_mem ((char *)&(the_pipeline), sizeof (the_pipeline)); | - |
4376 | unwind_protect_mem ((char *)&(subst_assign_varlist), sizeof (subst_assign_varlist)); | - |
4377 | unwind_protect_mem ((char *)&(this_shell_builtin), sizeof (this_shell_builtin)); | - |
4378 | unwind_protect_mem ((char *)&(temporary_env), sizeof (temporary_env)); | - |
4379 | | - |
4380 | | - |
4381 | | - |
4382 | | - |
4383 | add_unwind_protect (xfree, trap_command); | - |
4384 | add_unwind_protect (maybe_set_sigchld_trap, trap_command); | - |
4385 | | - |
4386 | subst_assign_varlist = (WORD_LIST *) | - |
4387 | ((void *)0) | - |
4388 | ; | - |
4389 | the_pipeline = (PROCESS *) | - |
4390 | ((void *)0) | - |
4391 | ; | - |
4392 | temporary_env = 0; | - |
4393 | | - |
4394 | running_trap = | - |
4395 | 17 | - |
4396 | + 1; | - |
4397 | | - |
4398 | set_impossible_sigchld_trap (); | - |
4399 | jobs_list_frozen = 1; | - |
4400 | for (i = 0; i < nchildTRUE | evaluated 3 times by 1 test | FALSE | evaluated 3 times by 1 test |
; i++) | 3 |
4401 | { | - |
4402 | | - |
4403 | | - |
4404 | | - |
4405 | parse_and_execute ((char *)strcpy (sh_xmalloc((1 + strlen (trap_command)), "jobs.c", 4012), (trap_command)), "trap", 0x004|0x010); | - |
4406 | }executed 3 times by 1 test: end of block | 3 |
4407 | | - |
4408 | run_unwind_frame ("SIGCHLD trap"); | - |
4409 | running_trap = 0; | - |
4410 | }executed 3 times by 1 test: end of block | 3 |
4411 | | - |
4412 | | - |
4413 | | - |
4414 | | - |
4415 | | - |
4416 | static void | - |
4417 | notify_of_job_status () | - |
4418 | { | - |
4419 | register int job, termsig; | - |
4420 | char *dir; | - |
4421 | sigset_t set, oset; | - |
4422 | WAIT s; | - |
4423 | | - |
4424 | if (jobs == 0TRUE | evaluated 134526 times by 1 test | FALSE | evaluated 1574574 times by 1 test |
|| js.j_jobslots == 0TRUE | evaluated 5316 times by 1 test | FALSE | evaluated 1569258 times by 1 test |
) | 5316-1574574 |
4425 | return;executed 139842 times by 1 test: return; | 139842 |
4426 | | - |
4427 | if (old_ttou != 0TRUE | never evaluated | FALSE | evaluated 1569258 times by 1 test |
) | 0-1569258 |
4428 | { | - |
4429 | sigemptyset (&set); | - |
4430 | sigaddset (&set, | - |
4431 | 17 | - |
4432 | ); | - |
4433 | sigaddset (&set, | - |
4434 | 22 | - |
4435 | ); | - |
4436 | sigemptyset (&oset); | - |
4437 | sigprocmask ( | - |
4438 | 0 | - |
4439 | , &set, &oset); | - |
4440 | } never executed: end of block | 0 |
4441 | else | - |
4442 | queue_sigchld++;executed 1569258 times by 1 test: queue_sigchld++; | 1569258 |
4443 | | - |
4444 | | - |
4445 | for (job = 0, dir = (char *) | - |
4446 | ((void *)0) | - |
4447 | ; job < js.j_jobslotsTRUE | evaluated 12554064 times by 1 test | FALSE | evaluated 1569258 times by 1 test |
; job++) | 1569258-12554064 |
4448 | { | - |
4449 | if (jobs[job]TRUE | evaluated 453694 times by 1 test | FALSE | evaluated 12100370 times by 1 test |
&& ((TRUE | evaluated 453552 times by 1 test | FALSE | evaluated 142 times by 1 test |
jobs[job]->flags & 0x02) != 0) == 0TRUE | evaluated 453552 times by 1 test | FALSE | evaluated 142 times by 1 test |
) | 142-12100370 |
4450 | { | - |
4451 | s = raw_job_exit_status (job); | - |
4452 | termsig = | - |
4453 | (( | - |
4454 | s | - |
4455 | ) & 0x7f) | - |
4456 | ; | - |
4457 | | - |
4458 | | - |
4459 | | - |
4460 | | - |
4461 | | - |
4462 | | - |
4463 | if (startup_state == 0TRUE | evaluated 452650 times by 1 test | FALSE | evaluated 902 times by 1 test |
&& | 902-452650 |
4464 | (((TRUE | evaluated 452643 times by 1 test | FALSE | evaluated 7 times by 1 test |
signed char) (((TRUE | evaluated 452643 times by 1 test | FALSE | evaluated 7 times by 1 test |
| 7-452643 |
4465 | sTRUE | evaluated 452643 times by 1 test | FALSE | evaluated 7 times by 1 test |
| 7-452643 |
4466 | ) & 0x7f) + 1) >> 1) > 0) TRUE | evaluated 452643 times by 1 test | FALSE | evaluated 7 times by 1 test |
| 7-452643 |
4467 | == 0TRUE | evaluated 452643 times by 1 test | FALSE | evaluated 7 times by 1 test |
&& | 7-452643 |
4468 | (((TRUE | evaluated 41976 times by 1 test | FALSE | evaluated 410667 times by 1 test |
jobs[(job)]->state == JDEAD)TRUE | evaluated 41976 times by 1 test | FALSE | evaluated 410667 times by 1 test |
&& ((TRUE | evaluated 298 times by 1 test | FALSE | evaluated 41678 times by 1 test |
jobs[job]->flags & 0x01) != 0) == 0TRUE | evaluated 298 times by 1 test | FALSE | evaluated 41678 times by 1 test |
) || (TRUE | evaluated 205036 times by 1 test | FALSE | evaluated 247309 times by 1 test |
jobs[(job)]->state == JSTOPPED)TRUE | evaluated 205036 times by 1 test | FALSE | evaluated 247309 times by 1 test |
)) | 298-410667 |
4469 | continue;executed 205334 times by 1 test: continue; | 205334 |
4470 | if ((job_control == 0TRUE | evaluated 43037 times by 1 test | FALSE | evaluated 205181 times by 1 test |
&& interactive_shellTRUE | evaluated 1 time by 1 test | FALSE | evaluated 43036 times by 1 test |
) || | 1-205181 |
4471 | (startup_state == 2TRUE | evaluated 901 times by 1 test | FALSE | evaluated 247316 times by 1 test |
&& (TRUE | evaluated 851 times by 1 test | FALSE | evaluated 50 times by 1 test |
subshell_environment & 0x04)TRUE | evaluated 851 times by 1 test | FALSE | evaluated 50 times by 1 test |
)) | 50-247316 |
4472 | | - |
4473 | { | - |
4474 | | - |
4475 | | - |
4476 | | - |
4477 | | - |
4478 | if ((TRUE | evaluated 851 times by 1 test | FALSE | evaluated 1 time by 1 test |
jobs[(job)]->state == JDEAD)TRUE | evaluated 851 times by 1 test | FALSE | evaluated 1 time by 1 test |
&& (interactive_shellTRUE | evaluated 1 time by 1 test | FALSE | evaluated 850 times by 1 test |
|| (TRUE | evaluated 849 times by 1 test | FALSE | evaluated 1 time by 1 test |
find_last_pid (job, 0) != last_asynchronous_pid)TRUE | evaluated 849 times by 1 test | FALSE | evaluated 1 time by 1 test |
)) | 1-851 |
4479 | jobs[job]->flags |= 0x02;executed 850 times by 1 test: jobs[job]->flags |= 0x02; | 850 |
4480 | continue;executed 852 times by 1 test: continue; | 852 |
4481 | } | - |
4482 | | - |
4483 | | - |
4484 | | - |
4485 | | - |
4486 | switch ((jobs[(job)]->state)) | - |
4487 | { | - |
4488 | caseexecuted 41735 times by 1 test: case JDEAD: JDEAD:executed 41735 times by 1 test: case JDEAD: | 41735 |
4489 | if (interactive_shell == 0TRUE | evaluated 41735 times by 1 test | FALSE | never evaluated |
&& termsigTRUE | evaluated 7 times by 1 test | FALSE | evaluated 41728 times by 1 test |
&& | 0-41735 |
4490 | (((TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
signed char) (((TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
| 0-7 |
4491 | sTRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
| 0-7 |
4492 | ) & 0x7f) + 1) >> 1) > 0)TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
| 0-7 |
4493 | && | - |
4494 | termsig != TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
| 0-7 |
4495 | 2TRUE | evaluated 7 times by 1 test | FALSE | never evaluated |
| 0-7 |
4496 | && | - |
4497 | | - |
4498 | termsig != TRUE | evaluated 5 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-5 |
4499 | 15TRUE | evaluated 5 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-5 |
4500 | && | - |
4501 | | - |
4502 | | - |
4503 | termsig != TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
4504 | 13TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
4505 | && | - |
4506 | | - |
4507 | signal_is_trapped (termsig) == 0TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
) | 0-5 |
4508 | { | - |
4509 | | - |
4510 | fprintf ( | - |
4511 | stderr | - |
4512 | , | - |
4513 | dcgettext (((void *)0), | - |
4514 | "%s: line %d: " | - |
4515 | , 5) | - |
4516 | , get_name_for_error (), (line_number == 0) ? 1 : line_number); | - |
4517 | pretty_print_job (job, 4, | - |
4518 | stderr | - |
4519 | ); | - |
4520 | }executed 5 times by 1 test: end of block | 5 |
4521 | else if (((TRUE | evaluated 41728 times by 1 test | FALSE | evaluated 2 times by 1 test |
jobs[job]->flags & 0x01) != 0)TRUE | evaluated 41728 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-41728 |
4522 | { | - |
4523 | | - |
4524 | | - |
4525 | | - |
4526 | if (termsigTRUE | never evaluated | FALSE | evaluated 41728 times by 1 test |
&& | 0-41728 |
4527 | (((TRUE | never evaluated | FALSE | never evaluated |
signed char) (((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4528 | sTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4529 | ) & 0x7f) + 1) >> 1) > 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4530 | && termsig != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4531 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4532 | && termsig != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4533 | 13TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4534 | ) | - |
4535 | | - |
4536 | { | - |
4537 | fprintf ( | - |
4538 | stderr | - |
4539 | , "%s", j_strsignal (termsig)); | - |
4540 | | - |
4541 | if (((TRUE | never evaluated | FALSE | never evaluated |
s) & 0200)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4542 | fprintf ( never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4543 | stderr never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4544 | , never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4545 | dcgettext (((void *)0), never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4546 | " (core dumped)" never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4547 | , 5) never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4548 | ); never executed: fprintf ( stderr , dcgettext (((void *)0), " (core dumped)" , 5) ); | 0 |
4549 | | - |
4550 | fprintf ( | - |
4551 | stderr | - |
4552 | , "\n"); | - |
4553 | } never executed: end of block | 0 |
4554 | }executed 41728 times by 1 test: end of block | 41728 |
4555 | else if (job_controlTRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
4556 | { | - |
4557 | if (dir == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4558 | dir = current_working_directory (); never executed: dir = current_working_directory (); | 0 |
4559 | pretty_print_job (job, 0, | - |
4560 | stderr | - |
4561 | ); | - |
4562 | if (dirTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
4563 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4564 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4565 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4566 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4567 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4568 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4569 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4570 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4571 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4572 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4573 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4574 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4575 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4576 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4577 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4578 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4579 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4580 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4581 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4582 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4583 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4584 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4585 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4586 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4587 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4588 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4589 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4590 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4591 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4592 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4593 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4594 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4595 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4596 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4597 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4598 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4599 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4600 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4601 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4602 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4603 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4604 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4605 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4606 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4607 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4608 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4609 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( dir ))[3] - __s2[3]); | 0 |
4610 | dirTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( dir ))[3] - __s2[3]); | 0 |
4611 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4612 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4613 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4614 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4615 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4616 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4617 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4618 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4619 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4620 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4621 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4622 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4623 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4624 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4625 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4626 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4627 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4628 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4629 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4630 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4631 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4632 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4633 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4634 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4635 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4636 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4637 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); | 0 |
4638 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); | 0 |
4639 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4640 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4641 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4642 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4643 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4644 | != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4645 | fprintf ( never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4646 | stderr never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4647 | , never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4648 | never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4649 | dcgettext (((void *)0), never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4650 | "(wd now: %s)\n" never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4651 | , 5) never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4652 | , polite_directory_format (dir)); never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4653 | } never executed: end of block | 0 |
4654 | | - |
4655 | jobs[job]->flags |= 0x02; | - |
4656 | break;executed 41735 times by 1 test: break; | 41735 |
4657 | | - |
4658 | case never executed: case JSTOPPED: JSTOPPED:never executed: case JSTOPPED: | 0 |
4659 | fprintf ( | - |
4660 | stderr | - |
4661 | , "\n"); | - |
4662 | if (dir == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4663 | dir = current_working_directory (); never executed: dir = current_working_directory (); | 0 |
4664 | pretty_print_job (job, 0, | - |
4665 | stderr | - |
4666 | ); | - |
4667 | if (dirTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4668 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4669 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4670 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4671 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4672 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4673 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4674 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4675 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4676 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4677 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4678 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4679 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4680 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4681 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4682 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4683 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4684 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4685 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4686 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4687 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4688 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4689 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4690 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4691 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4692 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4693 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4694 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4695 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4696 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4697 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4698 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4699 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4700 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4701 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4702 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4703 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4704 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4705 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4706 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4707 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4708 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4709 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4710 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4711 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4712 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4713 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4714 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( dir ))[3] - __s2[3]); | 0 |
4715 | dirTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( dir ))[3] - __s2[3]); | 0 |
4716 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4717 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4718 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4719 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4720 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4721 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4722 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4723 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4724 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4725 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4726 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4727 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4728 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4729 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4730 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4731 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4732 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4733 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4734 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4735 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4736 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4737 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4738 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4739 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4740 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4741 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4742 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); | 0 |
4743 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( jobs[job]->wd ))[3] - __s2[3]); | 0 |
4744 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4745 | dirTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4746 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4747 | jobs[job]->wdTRUE | never evaluated | FALSE | never evaluated |
| 0 |
4748 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
4749 | != 0)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4750 | fprintf ( never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4751 | stderr never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4752 | , never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4753 | never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4754 | dcgettext (((void *)0), never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4755 | "(wd now: %s)\n" never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4756 | , 5) never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4757 | , polite_directory_format (dir)); never executed: fprintf ( stderr , dcgettext (((void *)0), "(wd now: %s)\n" , 5) , polite_directory_format (dir)); | 0 |
4758 | jobs[job]->flags |= 0x02; | - |
4759 | break; never executed: break; | 0 |
4760 | | - |
4761 | caseexecuted 205631 times by 1 test: case JRUNNING: JRUNNING:executed 205631 times by 1 test: case JRUNNING: | 205631 |
4762 | case never executed: case JMIXED: JMIXED:never executed: case JMIXED: | 0 |
4763 | break;executed 205631 times by 1 test: break; | 205631 |
4764 | | - |
4765 | default never executed: default: :never executed: default: | 0 |
4766 | programming_error ("notify_of_job_status"); | - |
4767 | } never executed: end of block | 0 |
4768 | } | - |
4769 | }executed 12347878 times by 1 test: end of block | 12347878 |
4770 | if (old_ttou != 0TRUE | never evaluated | FALSE | evaluated 1569258 times by 1 test |
) | 0-1569258 |
4771 | sigprocmask ( never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
4772 | 2 never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
4773 | , &oset, (sigset_t *) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
4774 | ((void *)0) never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
4775 | ); never executed: sigprocmask ( 2 , &oset, (sigset_t *) ((void *)0) ); | 0 |
4776 | else | - |
4777 | queue_sigchld--;executed 1569258 times by 1 test: queue_sigchld--; | 1569258 |
4778 | } | - |
4779 | | - |
4780 | | - |
4781 | int | - |
4782 | initialize_job_control (force) | - |
4783 | int force; | - |
4784 | { | - |
4785 | pid_t t; | - |
4786 | int t_errno, tty_sigs; | - |
4787 | | - |
4788 | t_errno = -1; | - |
4789 | shell_pgrp = getpgrp (); | - |
4790 | | - |
4791 | if (shell_pgrp == -1TRUE | never evaluated | FALSE | evaluated 5447 times by 1 test |
) | 0-5447 |
4792 | { | - |
4793 | sys_error ( | - |
4794 | dcgettext (((void *)0), | - |
4795 | "initialize_job_control: getpgrp failed" | - |
4796 | , 5) | - |
4797 | ); | - |
4798 | exit (1); never executed: exit (1); | 0 |
4799 | } | - |
4800 | | - |
4801 | | - |
4802 | if (interactive == 0TRUE | evaluated 5445 times by 1 test | FALSE | evaluated 2 times by 1 test |
&& force == 0TRUE | evaluated 5445 times by 1 test | FALSE | never evaluated |
) | 0-5445 |
4803 | { | - |
4804 | job_control = 0; | - |
4805 | original_pgrp = (pid_t)-1; | - |
4806 | shell_tty = fileno ( | - |
4807 | stderr | - |
4808 | ); | - |
4809 | terminal_pgrp = tcgetpgrp (shell_tty); | - |
4810 | }executed 5445 times by 1 test: end of block | 5445 |
4811 | else | - |
4812 | { | - |
4813 | shell_tty = -1; | - |
4814 | | - |
4815 | | - |
4816 | | - |
4817 | | - |
4818 | | - |
4819 | | - |
4820 | if (forced_interactiveTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& isatty (fileno (TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
4821 | stderrTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
4822 | )) == 0TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4823 | shell_tty = open ("/dev/tty", executed 2 times by 1 test: shell_tty = open ("/dev/tty", 02 | 04000 ); | 2 |
4824 | 02executed 2 times by 1 test: shell_tty = open ("/dev/tty", 02 | 04000 ); | 2 |
4825 | |executed 2 times by 1 test: shell_tty = open ("/dev/tty", 02 | 04000 ); | 2 |
4826 | 04000executed 2 times by 1 test: shell_tty = open ("/dev/tty", 02 | 04000 ); | 2 |
4827 | );executed 2 times by 1 test: shell_tty = open ("/dev/tty", 02 | 04000 ); | 2 |
4828 | | - |
4829 | | - |
4830 | | - |
4831 | | - |
4832 | if (shell_tty == -1TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4833 | shell_tty = dup (fileno (executed 2 times by 1 test: shell_tty = dup (fileno ( stderr )); | 2 |
4834 | stderrexecuted 2 times by 1 test: shell_tty = dup (fileno ( stderr )); | 2 |
4835 | ));executed 2 times by 1 test: shell_tty = dup (fileno ( stderr )); | 2 |
4836 | | - |
4837 | if (shell_tty != -1TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4838 | shell_tty = move_to_high_fd (shell_tty, 1, -1);executed 2 times by 1 test: shell_tty = move_to_high_fd (shell_tty, 1, -1); | 2 |
4839 | | - |
4840 | | - |
4841 | | - |
4842 | if (shell_pgrp == 0TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
4843 | { | - |
4844 | shell_pgrp = getpid (); | - |
4845 | setpgid (0, shell_pgrp); | - |
4846 | if (shell_tty != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4847 | tcsetpgrp (shell_tty, shell_pgrp); never executed: tcsetpgrp (shell_tty, shell_pgrp); | 0 |
4848 | } never executed: end of block | 0 |
4849 | | - |
4850 | tty_sigs = 0; | - |
4851 | while ((TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
terminal_pgrp = tcgetpgrp (shell_tty)) != -1TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
4852 | { | - |
4853 | if (shell_pgrp != terminal_pgrpTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4854 | { | - |
4855 | SigHandler *ottin; | - |
4856 | | - |
4857 | do { if (terminating_signalTRUE | never evaluated | FALSE | never evaluated |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); } while (0); | 0 |
4858 | ottin = set_signal_handler ( | - |
4859 | 21 | - |
4860 | , | - |
4861 | ((__sighandler_t) 0) | - |
4862 | ); | - |
4863 | kill (0, | - |
4864 | 21 | - |
4865 | ); | - |
4866 | set_signal_handler ( | - |
4867 | 21 | - |
4868 | , ottin); | - |
4869 | if (tty_sigs++ > 16TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4870 | { | - |
4871 | sys_error ( | - |
4872 | dcgettext (((void *)0), | - |
4873 | "initialize_job_control: no job control in background" | - |
4874 | , 5) | - |
4875 | ); | - |
4876 | job_control = 0; | - |
4877 | original_pgrp = terminal_pgrp; | - |
4878 | goto never executed: goto just_bail; just_bail;never executed: goto just_bail; | 0 |
4879 | } | - |
4880 | continue; never executed: continue; | 0 |
4881 | } | - |
4882 | break; never executed: break; | 0 |
4883 | } | - |
4884 | | - |
4885 | if (terminal_pgrp == -1TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4886 | t_errno = executed 2 times by 1 test: t_errno = (*__errno_location ()) ; | 2 |
4887 | (*__errno_location ())executed 2 times by 1 test: t_errno = (*__errno_location ()) ; | 2 |
4888 | ;executed 2 times by 1 test: t_errno = (*__errno_location ()) ; | 2 |
4889 | | - |
4890 | | - |
4891 | if (set_new_line_discipline (shell_tty) < 0TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
4892 | { | - |
4893 | sys_error ( | - |
4894 | dcgettext (((void *)0), | - |
4895 | "initialize_job_control: line discipline" | - |
4896 | , 5) | - |
4897 | ); | - |
4898 | job_control = 0; | - |
4899 | } never executed: end of block | 0 |
4900 | else | - |
4901 | { | - |
4902 | original_pgrp = shell_pgrp; | - |
4903 | shell_pgrp = getpid (); | - |
4904 | | - |
4905 | if ((TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
original_pgrp != shell_pgrp)TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
setpgid (0, shell_pgrp) < 0)TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
4906 | { | - |
4907 | sys_error ( | - |
4908 | dcgettext (((void *)0), | - |
4909 | "initialize_job_control: setpgid" | - |
4910 | , 5) | - |
4911 | ); | - |
4912 | shell_pgrp = original_pgrp; | - |
4913 | } never executed: end of block | 0 |
4914 | | - |
4915 | job_control = 1; | - |
4916 | if (shell_pgrp != original_pgrpTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& shell_pgrp != terminal_pgrpTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4917 | { | - |
4918 | if (give_terminal_to (shell_pgrp, 0) < 0TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4919 | { | - |
4920 | t_errno = | - |
4921 | (*__errno_location ()) | - |
4922 | ; | - |
4923 | setpgid (0, original_pgrp); | - |
4924 | shell_pgrp = original_pgrp; | - |
4925 | | - |
4926 | (*__errno_location ()) | - |
4927 | = t_errno; | - |
4928 | sys_error ( | - |
4929 | dcgettext (((void *)0), | - |
4930 | "cannot set terminal process group (%d)" | - |
4931 | , 5) | - |
4932 | , shell_pgrp); | - |
4933 | job_control = 0; | - |
4934 | }executed 2 times by 1 test: end of block | 2 |
4935 | }executed 2 times by 1 test: end of block | 2 |
4936 | | - |
4937 | if (job_controlTRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& ((TRUE | never evaluated | FALSE | never evaluated |
t = tcgetpgrp (shell_tty)) == -1TRUE | never evaluated | FALSE | never evaluated |
|| t != shell_pgrpTRUE | never evaluated | FALSE | never evaluated |
)) | 0-2 |
4938 | { | - |
4939 | if (t_errno != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
4940 | | - |
4941 | (* never executed: (*__errno_location ()) = t_errno; __errno_location ()) never executed: (*__errno_location ()) = t_errno; | 0 |
4942 | = t_errno; never executed: (*__errno_location ()) = t_errno; | 0 |
4943 | sys_error ( | - |
4944 | dcgettext (((void *)0), | - |
4945 | "cannot set terminal process group (%d)" | - |
4946 | , 5) | - |
4947 | , t); | - |
4948 | job_control = 0; | - |
4949 | } never executed: end of block | 0 |
4950 | }executed 2 times by 1 test: end of block | 2 |
4951 | if (job_control == 0TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
4952 | internal_error (executed 2 times by 1 test: internal_error ( dcgettext (((void *)0), "no job control in this shell" , 5) ); | 2 |
4953 | dcgettext (((void *)0), executed 2 times by 1 test: internal_error ( dcgettext (((void *)0), "no job control in this shell" , 5) ); | 2 |
4954 | "no job control in this shell"executed 2 times by 1 test: internal_error ( dcgettext (((void *)0), "no job control in this shell" , 5) ); | 2 |
4955 | , 5)executed 2 times by 1 test: internal_error ( dcgettext (((void *)0), "no job control in this shell" , 5) ); | 2 |
4956 | );executed 2 times by 1 test: internal_error ( dcgettext (((void *)0), "no job control in this shell" , 5) ); | 2 |
4957 | }executed 2 times by 1 test: end of block | 2 |
4958 | | - |
4959 | just_bail:code before this statement executed 5447 times by 1 test: just_bail: | 5447 |
4960 | running_in_background = terminal_pgrp != shell_pgrp; | - |
4961 | | - |
4962 | if (shell_tty != fileno (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
4963 | stderrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
4964 | )TRUE | evaluated 2 times by 1 test | FALSE | evaluated 5445 times by 1 test |
) | 2-5445 |
4965 | (executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); fcntl ((shell_tty), executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); | 2 |
4966 | 2executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); | 2 |
4967 | , executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); | 2 |
4968 | 1executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); | 2 |
4969 | ));executed 2 times by 1 test: (fcntl ((shell_tty), 2 , 1 )); | 2 |
4970 | | - |
4971 | set_signal_handler ( | - |
4972 | 17 | - |
4973 | , sigchld_handler); | - |
4974 | | - |
4975 | change_flag ('m', job_control ? '-' : '+'); | - |
4976 | | - |
4977 | if (interactiveTRUE | evaluated 2 times by 1 test | FALSE | evaluated 5445 times by 1 test |
) | 2-5445 |
4978 | get_tty_state ();executed 2 times by 1 test: get_tty_state (); | 2 |
4979 | | - |
4980 | if (js.c_childmax < 0TRUE | evaluated 5447 times by 1 test | FALSE | never evaluated |
) | 0-5447 |
4981 | js.c_childmax = getmaxchild ();executed 5447 times by 1 test: js.c_childmax = getmaxchild (); | 5447 |
4982 | if (js.c_childmax < 0TRUE | never evaluated | FALSE | evaluated 5447 times by 1 test |
) | 0-5447 |
4983 | js.c_childmax = 32; never executed: js.c_childmax = 32; | 0 |
4984 | | - |
4985 | | - |
4986 | | - |
4987 | | - |
4988 | | - |
4989 | | - |
4990 | returnexecuted 5447 times by 1 test: return job_control; job_control;executed 5447 times by 1 test: return job_control; | 5447 |
4991 | } | - |
4992 | | - |
4993 | | - |
4994 | void | - |
4995 | debug_print_pgrps () | - |
4996 | { | - |
4997 | itrace("original_pgrp = %ld shell_pgrp = %ld terminal_pgrp = %ld", | - |
4998 | (long)original_pgrp, (long)shell_pgrp, (long)terminal_pgrp); | - |
4999 | itrace("tcgetpgrp(%d) -> %ld, getpgid(0) -> %ld", | - |
5000 | shell_tty, (long)tcgetpgrp (shell_tty), (long)getpgrp ()); | - |
5001 | } never executed: end of block | 0 |
5002 | | - |
5003 | | - |
5004 | | - |
5005 | | - |
5006 | static int | - |
5007 | set_new_line_discipline (tty) | - |
5008 | int tty; | - |
5009 | { | - |
5010 | returnexecuted 2 times by 1 test: return (0); (0);executed 2 times by 1 test: return (0); | 2 |
5011 | | - |
5012 | | - |
5013 | | - |
5014 | | - |
5015 | | - |
5016 | } | - |
5017 | | - |
5018 | | - |
5019 | void | - |
5020 | initialize_job_signals () | - |
5021 | { | - |
5022 | if (interactiveTRUE | evaluated 2 times by 1 test | FALSE | evaluated 5446 times by 1 test |
) | 2-5446 |
5023 | { | - |
5024 | set_signal_handler ( | - |
5025 | 2 | - |
5026 | , sigint_sighandler); | - |
5027 | set_signal_handler ( | - |
5028 | 20 | - |
5029 | , | - |
5030 | ((__sighandler_t) 1) | - |
5031 | ); | - |
5032 | set_signal_handler ( | - |
5033 | 22 | - |
5034 | , | - |
5035 | ((__sighandler_t) 1) | - |
5036 | ); | - |
5037 | set_signal_handler ( | - |
5038 | 21 | - |
5039 | , | - |
5040 | ((__sighandler_t) 1) | - |
5041 | ); | - |
5042 | }executed 2 times by 1 test: end of block | 2 |
5043 | else if (job_controlTRUE | never evaluated | FALSE | evaluated 5446 times by 1 test |
) | 0-5446 |
5044 | { | - |
5045 | old_tstp = set_signal_handler ( | - |
5046 | 20 | - |
5047 | , sigstop_sighandler); | - |
5048 | old_ttin = set_signal_handler ( | - |
5049 | 21 | - |
5050 | , sigstop_sighandler); | - |
5051 | old_ttou = set_signal_handler ( | - |
5052 | 22 | - |
5053 | , sigstop_sighandler); | - |
5054 | } never executed: end of block | 0 |
5055 | | - |
5056 | | - |
5057 | }executed 5448 times by 1 test: end of block | 5448 |
5058 | | - |
5059 | | - |
5060 | static void | - |
5061 | sigcont_sighandler (sig) | - |
5062 | int sig; | - |
5063 | { | - |
5064 | initialize_job_signals (); | - |
5065 | set_signal_handler ( | - |
5066 | 18 | - |
5067 | , old_cont); | - |
5068 | kill (getpid (), | - |
5069 | 18 | - |
5070 | ); | - |
5071 | | - |
5072 | return; never executed: return; | 0 |
5073 | } | - |
5074 | | - |
5075 | | - |
5076 | static void | - |
5077 | sigstop_sighandler (sig) | - |
5078 | int sig; | - |
5079 | { | - |
5080 | set_signal_handler ( | - |
5081 | 20 | - |
5082 | , old_tstp); | - |
5083 | set_signal_handler ( | - |
5084 | 22 | - |
5085 | , old_ttou); | - |
5086 | set_signal_handler ( | - |
5087 | 21 | - |
5088 | , old_ttin); | - |
5089 | | - |
5090 | old_cont = set_signal_handler ( | - |
5091 | 18 | - |
5092 | , sigcont_sighandler); | - |
5093 | | - |
5094 | give_terminal_to (shell_pgrp, 0); | - |
5095 | | - |
5096 | kill (getpid (), sig); | - |
5097 | | - |
5098 | return; never executed: return; | 0 |
5099 | } | - |
5100 | | - |
5101 | | - |
5102 | int | - |
5103 | give_terminal_to (pgrp, force) | - |
5104 | pid_t pgrp; | - |
5105 | int force; | - |
5106 | { | - |
5107 | sigset_t set, oset; | - |
5108 | int r, e; | - |
5109 | | - |
5110 | r = 0; | - |
5111 | if (job_controlTRUE | evaluated 16 times by 1 test | FALSE | evaluated 9 times by 1 test |
|| forceTRUE | evaluated 8 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-16 |
5112 | { | - |
5113 | sigemptyset (&set); | - |
5114 | sigaddset (&set, | - |
5115 | 22 | - |
5116 | ); | - |
5117 | sigaddset (&set, | - |
5118 | 21 | - |
5119 | ); | - |
5120 | sigaddset (&set, | - |
5121 | 20 | - |
5122 | ); | - |
5123 | sigaddset (&set, | - |
5124 | 17 | - |
5125 | ); | - |
5126 | sigemptyset (&oset); | - |
5127 | sigprocmask ( | - |
5128 | 0 | - |
5129 | , &set, &oset); | - |
5130 | | - |
5131 | if (tcsetpgrp (shell_tty, pgrp) < 0TRUE | evaluated 24 times by 1 test | FALSE | never evaluated |
) | 0-24 |
5132 | { | - |
5133 | | - |
5134 | | - |
5135 | | - |
5136 | | - |
5137 | | - |
5138 | r = -1; | - |
5139 | e = | - |
5140 | (*__errno_location ()) | - |
5141 | ; | - |
5142 | }executed 24 times by 1 test: end of block | 24 |
5143 | else | - |
5144 | terminal_pgrp = pgrp; never executed: terminal_pgrp = pgrp; | 0 |
5145 | sigprocmask ( | - |
5146 | 2 | - |
5147 | , &oset, (sigset_t *) | - |
5148 | ((void *)0) | - |
5149 | ); | - |
5150 | }executed 24 times by 1 test: end of block | 24 |
5151 | | - |
5152 | if (r == -1TRUE | evaluated 24 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-24 |
5153 | | - |
5154 | (*executed 24 times by 1 test: (*__errno_location ()) = e; __errno_location ()) executed 24 times by 1 test: (*__errno_location ()) = e; | 24 |
5155 | = e;executed 24 times by 1 test: (*__errno_location ()) = e; | 24 |
5156 | | - |
5157 | returnexecuted 25 times by 1 test: return r; r;executed 25 times by 1 test: return r; | 25 |
5158 | } | - |
5159 | | - |
5160 | | - |
5161 | | - |
5162 | static int | - |
5163 | maybe_give_terminal_to (opgrp, npgrp, flags) | - |
5164 | pid_t opgrp, npgrp; | - |
5165 | int flags; | - |
5166 | { | - |
5167 | int tpgrp; | - |
5168 | | - |
5169 | tpgrp = tcgetpgrp (shell_tty); | - |
5170 | if (tpgrp < 0TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
5171 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5172 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5173 | 25TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5174 | ) | - |
5175 | return never executed: return -1; -1;never executed: return -1; | 0 |
5176 | if (tpgrp == npgrpTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5177 | { | - |
5178 | terminal_pgrp = npgrp; | - |
5179 | return never executed: return 0; 0;never executed: return 0; | 0 |
5180 | } | - |
5181 | else if (tpgrp != opgrpTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5182 | { | - |
5183 | | - |
5184 | internal_warning ("%d: maybe_give_terminal_to: terminal pgrp == %d shell pgrp = %d new pgrp = %d in_background = %d", (int)getpid(), tpgrp, opgrp, npgrp, running_in_background); | - |
5185 | | - |
5186 | return never executed: return -1; -1;never executed: return -1; | 0 |
5187 | } | - |
5188 | else | - |
5189 | return never executed: return (give_terminal_to (npgrp, flags)); (give_terminal_to (npgrp, flags));never executed: return (give_terminal_to (npgrp, flags)); | 0 |
5190 | } | - |
5191 | | - |
5192 | | - |
5193 | | - |
5194 | | - |
5195 | | - |
5196 | | - |
5197 | void | - |
5198 | delete_all_jobs (running_only) | - |
5199 | int running_only; | - |
5200 | { | - |
5201 | register int i; | - |
5202 | sigset_t set, oset; | - |
5203 | | - |
5204 | do { sigemptyset (&set); sigaddset (&set, | - |
5205 | 17 | - |
5206 | ); sigemptyset (&oset); sigprocmask ( | - |
5207 | 0 | - |
5208 | , &set, &oset); } while (0); | - |
5209 | | - |
5210 | | - |
5211 | if (js.j_jobslotsTRUE | evaluated 2148 times by 1 test | FALSE | evaluated 110 times by 1 test |
) | 110-2148 |
5212 | { | - |
5213 | js.j_current = js.j_previous = -1; | - |
5214 | | - |
5215 | | - |
5216 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 17184 times by 1 test | FALSE | evaluated 2148 times by 1 test |
; i++) | 2148-17184 |
5217 | { | - |
5218 | | - |
5219 | if (i < js.j_firstjTRUE | evaluated 1 time by 1 test | FALSE | evaluated 17183 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-17183 |
5220 | itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
5221 | if (i > js.j_lastjTRUE | evaluated 15031 times by 1 test | FALSE | evaluated 2153 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 15031 times by 1 test |
) | 0-15031 |
5222 | itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
5223 | | - |
5224 | if (jobs[i]TRUE | evaluated 15 times by 1 test | FALSE | evaluated 17169 times by 1 test |
&& (running_only == 0TRUE | evaluated 15 times by 1 test | FALSE | never evaluated |
|| (running_onlyTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
jobs[(i)]->state == JRUNNING)TRUE | never evaluated | FALSE | never evaluated |
))) | 0-17169 |
5225 | | - |
5226 | | - |
5227 | | - |
5228 | | - |
5229 | | - |
5230 | delete_job (i, 1|2);executed 15 times by 1 test: delete_job (i, 1|2); | 15 |
5231 | }executed 17184 times by 1 test: end of block | 17184 |
5232 | if (running_only == 0TRUE | evaluated 2148 times by 1 test | FALSE | never evaluated |
) | 0-2148 |
5233 | { | - |
5234 | sh_xfree(((char *)jobs), "jobs.c", 4547); | - |
5235 | js.j_jobslots = 0; | - |
5236 | js.j_firstj = js.j_lastj = js.j_njobs = 0; | - |
5237 | }executed 2148 times by 1 test: end of block | 2148 |
5238 | }executed 2148 times by 1 test: end of block | 2148 |
5239 | | - |
5240 | if (running_only == 0TRUE | evaluated 2258 times by 1 test | FALSE | never evaluated |
) | 0-2258 |
5241 | bgp_clear ();executed 2258 times by 1 test: bgp_clear (); | 2258 |
5242 | | - |
5243 | sigprocmask ( | - |
5244 | 2 | - |
5245 | , &oset, (sigset_t *) | - |
5246 | ((void *)0) | - |
5247 | ); | - |
5248 | }executed 2258 times by 1 test: end of block | 2258 |
5249 | | - |
5250 | | - |
5251 | | - |
5252 | void | - |
5253 | nohup_all_jobs (running_only) | - |
5254 | int running_only; | - |
5255 | { | - |
5256 | register int i; | - |
5257 | sigset_t set, oset; | - |
5258 | | - |
5259 | do { sigemptyset (&set); sigaddset (&set, | - |
5260 | 17 | - |
5261 | ); sigemptyset (&oset); sigprocmask ( | - |
5262 | 0 | - |
5263 | , &set, &oset); } while (0); | - |
5264 | | - |
5265 | if (js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5266 | { | - |
5267 | | - |
5268 | for (i = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
5269 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
&& (running_only == 0TRUE | never evaluated | FALSE | never evaluated |
|| (running_onlyTRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
jobs[(i)]->state == JRUNNING)TRUE | never evaluated | FALSE | never evaluated |
))) | 0 |
5270 | nohup_job (i); never executed: nohup_job (i); | 0 |
5271 | } never executed: end of block | 0 |
5272 | | - |
5273 | sigprocmask ( | - |
5274 | 2 | - |
5275 | , &oset, (sigset_t *) | - |
5276 | ((void *)0) | - |
5277 | ); | - |
5278 | } never executed: end of block | 0 |
5279 | | - |
5280 | int | - |
5281 | count_all_jobs () | - |
5282 | { | - |
5283 | int i, n; | - |
5284 | sigset_t set, oset; | - |
5285 | | - |
5286 | | - |
5287 | do { sigemptyset (&set); sigaddset (&set, | - |
5288 | 17 | - |
5289 | ); sigemptyset (&oset); sigprocmask ( | - |
5290 | 0 | - |
5291 | , &set, &oset); } while (0); | - |
5292 | | - |
5293 | for (i = n = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
5294 | { | - |
5295 | | - |
5296 | if (i < js.j_firstjTRUE | never evaluated | FALSE | never evaluated |
&& jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5297 | itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
5298 | if (i > js.j_lastjTRUE | never evaluated | FALSE | never evaluated |
&& jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5299 | itrace("count_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("count_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
5300 | | - |
5301 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
jobs[(i)]->state == JDEAD) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5302 | n++; never executed: n++; | 0 |
5303 | } never executed: end of block | 0 |
5304 | sigprocmask ( | - |
5305 | 2 | - |
5306 | , &oset, (sigset_t *) | - |
5307 | ((void *)0) | - |
5308 | ); | - |
5309 | return never executed: return n; n;never executed: return n; | 0 |
5310 | } | - |
5311 | | - |
5312 | static void | - |
5313 | mark_all_jobs_as_dead () | - |
5314 | { | - |
5315 | register int i; | - |
5316 | sigset_t set, oset; | - |
5317 | | - |
5318 | if (js.j_jobslots == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5319 | return; never executed: return; | 0 |
5320 | | - |
5321 | do { sigemptyset (&set); sigaddset (&set, | - |
5322 | 17 | - |
5323 | ); sigemptyset (&oset); sigprocmask ( | - |
5324 | 0 | - |
5325 | , &set, &oset); } while (0); | - |
5326 | | - |
5327 | | - |
5328 | for (i = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
5329 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5330 | { | - |
5331 | jobs[i]->state = JDEAD; | - |
5332 | js.j_ndead++; | - |
5333 | } never executed: end of block | 0 |
5334 | | - |
5335 | sigprocmask ( | - |
5336 | 2 | - |
5337 | , &oset, (sigset_t *) | - |
5338 | ((void *)0) | - |
5339 | ); | - |
5340 | } never executed: end of block | 0 |
5341 | | - |
5342 | | - |
5343 | | - |
5344 | | - |
5345 | | - |
5346 | static void | - |
5347 | mark_dead_jobs_as_notified (force) | - |
5348 | int force; | - |
5349 | { | - |
5350 | register int i, ndead, ndeadproc; | - |
5351 | sigset_t set, oset; | - |
5352 | | - |
5353 | if (js.j_jobslots == 0TRUE | evaluated 106096 times by 1 test | FALSE | evaluated 19201801 times by 1 test |
) | 106096-19201801 |
5354 | return;executed 106096 times by 1 test: return; | 106096 |
5355 | | - |
5356 | do { sigemptyset (&set); sigaddset (&set, | - |
5357 | 17 | - |
5358 | ); sigemptyset (&oset); sigprocmask ( | - |
5359 | 0 | - |
5360 | , &set, &oset); } while (0); | - |
5361 | | - |
5362 | | - |
5363 | | - |
5364 | if (forceTRUE | evaluated 138 times by 1 test | FALSE | evaluated 19201663 times by 1 test |
) | 138-19201663 |
5365 | { | - |
5366 | | - |
5367 | for (i = 0; i < js.j_jobslotsTRUE | evaluated 1104 times by 1 test | FALSE | evaluated 138 times by 1 test |
; i++) | 138-1104 |
5368 | { | - |
5369 | if (jobs[i]TRUE | evaluated 132 times by 1 test | FALSE | evaluated 972 times by 1 test |
&& (TRUE | evaluated 132 times by 1 test | FALSE | never evaluated |
jobs[(i)]->state == JDEAD)TRUE | evaluated 132 times by 1 test | FALSE | never evaluated |
&& (interactive_shellTRUE | never evaluated | FALSE | evaluated 132 times by 1 test |
|| (TRUE | evaluated 6 times by 1 test | FALSE | evaluated 126 times by 1 test |
find_last_pid (i, 0) != last_asynchronous_pid)TRUE | evaluated 6 times by 1 test | FALSE | evaluated 126 times by 1 test |
)) | 0-972 |
5370 | jobs[i]->flags |= 0x02;executed 6 times by 1 test: jobs[i]->flags |= 0x02; | 6 |
5371 | }executed 1104 times by 1 test: end of block | 1104 |
5372 | sigprocmask ( | - |
5373 | 2 | - |
5374 | , &oset, (sigset_t *) | - |
5375 | ((void *)0) | - |
5376 | ); | - |
5377 | return;executed 138 times by 1 test: return; | 138 |
5378 | } | - |
5379 | for (i = ndead = ndeadproc = 0; i < js.j_jobslotsTRUE | evaluated 153613304 times by 1 test | FALSE | evaluated 19201663 times by 1 test |
; i++) | 19201663-153613304 |
5380 | { | - |
5381 | | - |
5382 | if (i < js.j_firstjTRUE | evaluated 34 times by 1 test | FALSE | evaluated 153613270 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 34 times by 1 test |
) | 0-153613270 |
5383 | itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
5384 | if (i > js.j_lastjTRUE | evaluated 134411426 times by 1 test | FALSE | evaluated 19201878 times by 1 test |
&& jobs[i]TRUE | never evaluated | FALSE | evaluated 134411426 times by 1 test |
) | 0-134411426 |
5385 | itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
5386 | | - |
5387 | if (jobs[i]TRUE | evaluated 393 times by 1 test | FALSE | evaluated 153612911 times by 1 test |
&& (TRUE | evaluated 93 times by 1 test | FALSE | evaluated 300 times by 1 test |
jobs[(i)]->state == JDEAD)TRUE | evaluated 93 times by 1 test | FALSE | evaluated 300 times by 1 test |
) | 93-153612911 |
5388 | { | - |
5389 | ndead++; | - |
5390 | ndeadproc += processes_in_job (i); | - |
5391 | }executed 93 times by 1 test: end of block | 93 |
5392 | }executed 153613304 times by 1 test: end of block | 153613304 |
5393 | | - |
5394 | | - |
5395 | | - |
5396 | | - |
5397 | | - |
5398 | | - |
5399 | if (ndead != js.j_ndeadTRUE | never evaluated | FALSE | evaluated 19201663 times by 1 test |
) | 0-19201663 |
5400 | itrace("mark_dead_jobs_as_notified: ndead (%d) != js.j_ndead (%d)", ndead, js.j_ndead); never executed: itrace("mark_dead_jobs_as_notified: ndead (%d) != js.j_ndead (%d)", ndead, js.j_ndead); | 0 |
5401 | | - |
5402 | | - |
5403 | if (js.c_childmax < 0TRUE | never evaluated | FALSE | evaluated 19201663 times by 1 test |
) | 0-19201663 |
5404 | js.c_childmax = getmaxchild (); never executed: js.c_childmax = getmaxchild (); | 0 |
5405 | if (js.c_childmax < 0TRUE | never evaluated | FALSE | evaluated 19201663 times by 1 test |
) | 0-19201663 |
5406 | js.c_childmax = 32; never executed: js.c_childmax = 32; | 0 |
5407 | if (ndeadproc <= js.c_childmaxTRUE | evaluated 19201663 times by 1 test | FALSE | never evaluated |
) | 0-19201663 |
5408 | { | - |
5409 | sigprocmask ( | - |
5410 | 2 | - |
5411 | , &oset, (sigset_t *) | - |
5412 | ((void *)0) | - |
5413 | ); | - |
5414 | return;executed 19201663 times by 1 test: return; | 19201663 |
5415 | } | - |
5416 | for (i = 0; i < js.j_jobslotsTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
5417 | { | - |
5418 | if (jobs[i]TRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
jobs[(i)]->state == JDEAD)TRUE | never evaluated | FALSE | never evaluated |
&& (interactive_shellTRUE | never evaluated | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
find_last_pid (i, 0) != last_asynchronous_pid)TRUE | never evaluated | FALSE | never evaluated |
)) | 0 |
5419 | { | - |
5420 | | - |
5421 | if (i < js.j_firstjTRUE | never evaluated | FALSE | never evaluated |
&& jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5422 | itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); never executed: itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj); | 0 |
5423 | if (i > js.j_lastjTRUE | never evaluated | FALSE | never evaluated |
&& jobs[i]TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5424 | itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); never executed: itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj); | 0 |
5425 | | - |
5426 | | - |
5427 | | - |
5428 | | - |
5429 | | - |
5430 | if ((TRUE | never evaluated | FALSE | never evaluated |
ndeadproc -= processes_in_job (i)) <= js.c_childmaxTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5431 | break; never executed: break; | 0 |
5432 | jobs[i]->flags |= 0x02; | - |
5433 | } never executed: end of block | 0 |
5434 | } never executed: end of block | 0 |
5435 | | - |
5436 | sigprocmask ( | - |
5437 | 2 | - |
5438 | , &oset, (sigset_t *) | - |
5439 | ((void *)0) | - |
5440 | ); | - |
5441 | } never executed: end of block | 0 |
5442 | | - |
5443 | | - |
5444 | | - |
5445 | int | - |
5446 | freeze_jobs_list () | - |
5447 | { | - |
5448 | int o; | - |
5449 | | - |
5450 | o = jobs_list_frozen; | - |
5451 | jobs_list_frozen = 1; | - |
5452 | returnexecuted 156 times by 1 test: return o; o;executed 156 times by 1 test: return o; | 156 |
5453 | } | - |
5454 | | - |
5455 | void | - |
5456 | unfreeze_jobs_list () | - |
5457 | { | - |
5458 | jobs_list_frozen = 0; | - |
5459 | }executed 145 times by 1 test: end of block | 145 |
5460 | | - |
5461 | | - |
5462 | | - |
5463 | int | - |
5464 | set_job_control (arg) | - |
5465 | int arg; | - |
5466 | { | - |
5467 | int old; | - |
5468 | | - |
5469 | old = job_control; | - |
5470 | job_control = arg; | - |
5471 | | - |
5472 | if (terminal_pgrp == (pid_t)-1TRUE | evaluated 14553 times by 1 test | FALSE | never evaluated |
) | 0-14553 |
5473 | terminal_pgrp = tcgetpgrp (shell_tty);executed 14553 times by 1 test: terminal_pgrp = tcgetpgrp (shell_tty); | 14553 |
5474 | | - |
5475 | running_in_background = (terminal_pgrp != shell_pgrp); | - |
5476 | if (job_control != oldTRUE | evaluated 5447 times by 1 test | FALSE | evaluated 9106 times by 1 test |
&& job_controlTRUE | evaluated 13 times by 1 test | FALSE | evaluated 5434 times by 1 test |
) | 13-9106 |
5477 | pipeline_pgrp = 0;executed 13 times by 1 test: pipeline_pgrp = 0; | 13 |
5478 | | - |
5479 | returnexecuted 14553 times by 1 test: return (old); (old);executed 14553 times by 1 test: return (old); | 14553 |
5480 | } | - |
5481 | | - |
5482 | | - |
5483 | | - |
5484 | void | - |
5485 | without_job_control () | - |
5486 | { | - |
5487 | stop_making_children (); | - |
5488 | start_pipeline (); | - |
5489 | | - |
5490 | sh_closepipe (pgrp_pipe); | - |
5491 | | - |
5492 | delete_all_jobs (0); | - |
5493 | set_job_control (0); | - |
5494 | }executed 2258 times by 1 test: end of block | 2258 |
5495 | | - |
5496 | | - |
5497 | | - |
5498 | | - |
5499 | void | - |
5500 | end_job_control () | - |
5501 | { | - |
5502 | if (job_controlTRUE | evaluated 8 times by 1 test | FALSE | evaluated 542 times by 1 test |
) | 8-542 |
5503 | { | - |
5504 | terminate_stopped_jobs (); | - |
5505 | | - |
5506 | if (original_pgrp >= 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 7 times by 1 test |
) | 1-7 |
5507 | give_terminal_to (original_pgrp, 1);executed 1 time by 1 test: give_terminal_to (original_pgrp, 1); | 1 |
5508 | }executed 8 times by 1 test: end of block | 8 |
5509 | | - |
5510 | if (original_pgrp >= 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 549 times by 1 test |
) | 1-549 |
5511 | setpgid (0, original_pgrp);executed 1 time by 1 test: setpgid (0, original_pgrp); | 1 |
5512 | }executed 550 times by 1 test: end of block | 550 |
5513 | | - |
5514 | | - |
5515 | | - |
5516 | void | - |
5517 | restart_job_control () | - |
5518 | { | - |
5519 | if (shell_tty != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5520 | close (shell_tty); never executed: close (shell_tty); | 0 |
5521 | initialize_job_control (0); | - |
5522 | } never executed: end of block | 0 |
5523 | | - |
5524 | void | - |
5525 | set_maxchild (nchild) | - |
5526 | int nchild; | - |
5527 | { | - |
5528 | static int lmaxchild = -1; | - |
5529 | | - |
5530 | if (lmaxchild < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5531 | lmaxchild = getmaxchild (); never executed: lmaxchild = getmaxchild (); | 0 |
5532 | if (lmaxchild < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5533 | lmaxchild = 32; never executed: lmaxchild = 32; | 0 |
5534 | | - |
5535 | | - |
5536 | | - |
5537 | if (nchild < lmaxchildTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5538 | nchild = lmaxchild; never executed: nchild = lmaxchild; | 0 |
5539 | else if (nchild > 32768TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
5540 | nchild = 32768; never executed: nchild = 32768; | 0 |
5541 | | - |
5542 | js.c_childmax = nchild; | - |
5543 | } never executed: end of block | 0 |
5544 | | - |
5545 | | - |
5546 | void | - |
5547 | set_sigchld_handler () | - |
5548 | { | - |
5549 | set_signal_handler ( | - |
5550 | 17 | - |
5551 | , sigchld_handler); | - |
5552 | }executed 3937827 times by 1 test: end of block | 3937827 |
5553 | | - |
5554 | | - |
5555 | | - |
5556 | | - |
5557 | static void | - |
5558 | pipe_read (pp) | - |
5559 | int *pp; | - |
5560 | { | - |
5561 | char ch; | - |
5562 | | - |
5563 | if (pp[1] >= 0TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
5564 | { | - |
5565 | close (pp[1]); | - |
5566 | pp[1] = -1; | - |
5567 | }executed 2 times by 1 test: end of block | 2 |
5568 | | - |
5569 | if (pp[0] >= 0TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
5570 | { | - |
5571 | while (read (pp[0], &ch, 1) == -1TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& | 0-2 |
5572 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5573 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5574 | 4TRUE | never evaluated | FALSE | never evaluated |
| 0 |
5575 | ) | - |
5576 | ; never executed: ; | 0 |
5577 | }executed 2 times by 1 test: end of block | 2 |
5578 | }executed 2 times by 1 test: end of block | 2 |
5579 | | - |
5580 | | - |
5581 | void | - |
5582 | close_pgrp_pipe () | - |
5583 | { | - |
5584 | sh_closepipe (pgrp_pipe); | - |
5585 | }executed 3933198 times by 1 test: end of block | 3933198 |
5586 | | - |
5587 | void | - |
5588 | save_pgrp_pipe (p, clear) | - |
5589 | int *p; | - |
5590 | int clear; | - |
5591 | { | - |
5592 | p[0] = pgrp_pipe[0]; | - |
5593 | p[1] = pgrp_pipe[1]; | - |
5594 | if (clearTRUE | evaluated 1961 times by 1 test | FALSE | never evaluated |
) | 0-1961 |
5595 | pgrp_pipe[0] = pgrp_pipe[1] = -1;executed 1961 times by 1 test: pgrp_pipe[0] = pgrp_pipe[1] = -1; | 1961 |
5596 | }executed 1961 times by 1 test: end of block | 1961 |
5597 | | - |
5598 | void | - |
5599 | restore_pgrp_pipe (p) | - |
5600 | int *p; | - |
5601 | { | - |
5602 | pgrp_pipe[0] = p[0]; | - |
5603 | pgrp_pipe[1] = p[1]; | - |
5604 | }executed 1961 times by 1 test: end of block | 1961 |
| | |