| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/builtins/wait.def |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||
| 10 | extern int wait_signal_received; | - | ||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||
| 12 | sigjmp_buf wait_intr_buf; | - | ||||||||||||||||||||||||||||||||||||
| 13 | int wait_intr_flag; | - | ||||||||||||||||||||||||||||||||||||
| 14 | int | - | ||||||||||||||||||||||||||||||||||||
| 15 | wait_builtin (list) | - | ||||||||||||||||||||||||||||||||||||
| 16 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||||||||||||||
| 18 | int status, code, opt, nflag, wflags; | - | ||||||||||||||||||||||||||||||||||||
| 19 | volatile int old_interrupt_immediately; | - | ||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||
| 21 | ((void) &(list)); | - | ||||||||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||||||||
| 23 | nflag = wflags = 0; | - | ||||||||||||||||||||||||||||||||||||
| 24 | reset_internal_getopt (); | - | ||||||||||||||||||||||||||||||||||||
| 25 | while ((
| 2-183 | ||||||||||||||||||||||||||||||||||||
| 26 | { | - | ||||||||||||||||||||||||||||||||||||
| 27 | switch (opt) | - | ||||||||||||||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||||||||||||||
| 30 | case executed 1 time by 1 test: 'n':case 'n':Executed by:
executed 1 time by 1 test: case 'n':Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 31 | nflag = 1; | - | ||||||||||||||||||||||||||||||||||||
| 32 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 33 | case executed 1 time by 1 test: 'f':case 'f':Executed by:
executed 1 time by 1 test: case 'f':Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 34 | wflags |= 0x02; | - | ||||||||||||||||||||||||||||||||||||
| 35 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||||||||
| 37 | case never executed: -99:case -99:never executed: builtin_help (); returncase -99:never executed: (258);return (258);never executed: return (258); | 0 | ||||||||||||||||||||||||||||||||||||
| 38 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 39 | builtin_usage (); | - | ||||||||||||||||||||||||||||||||||||
| 40 | return never executed: (258);return (258);never executed: return (258); | 0 | ||||||||||||||||||||||||||||||||||||
| 41 | } | - | ||||||||||||||||||||||||||||||||||||
| 42 | } | - | ||||||||||||||||||||||||||||||||||||
| 43 | list = loptend; | - | ||||||||||||||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||||||||||||||
| 45 | old_interrupt_immediately = interrupt_immediately; | - | ||||||||||||||||||||||||||||||||||||
| 46 | wait_intr_flag = 1; | - | ||||||||||||||||||||||||||||||||||||
| 47 | code = | - | ||||||||||||||||||||||||||||||||||||
| 48 | __sigsetjmp ( | - | ||||||||||||||||||||||||||||||||||||
| 49 | (wait_intr_buf) | - | ||||||||||||||||||||||||||||||||||||
| 50 | , | - | ||||||||||||||||||||||||||||||||||||
| 51 | 1 | - | ||||||||||||||||||||||||||||||||||||
| 52 | ) | - | ||||||||||||||||||||||||||||||||||||
| 53 | ; | - | ||||||||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||||||||
| 55 | if (code
| 0-183 | ||||||||||||||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||||||||||||||
| 57 | last_command_exit_signal = wait_signal_received; | - | ||||||||||||||||||||||||||||||||||||
| 58 | status = 128 + wait_signal_received; | - | ||||||||||||||||||||||||||||||||||||
| 59 | wait_sigint_cleanup (); | - | ||||||||||||||||||||||||||||||||||||
| 60 | do { interrupt_immediately = old_interrupt_immediately; wait_signal_received = 0; wait_intr_flag = 0; return never executed: (status);return (status);never executed: } while (0);return (status); | 0 | ||||||||||||||||||||||||||||||||||||
| 61 | } | - | ||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||||||||
| 67 | if (nflag
| 1-182 | ||||||||||||||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||||||||||||||
| 69 | status = wait_for_any_job (wflags); | - | ||||||||||||||||||||||||||||||||||||
| 70 | if (status < 0
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 71 | status = 127; never executed: status = 127; | 0 | ||||||||||||||||||||||||||||||||||||
| 72 | do { interrupt_immediately = old_interrupt_immediately; wait_signal_received = 0; wait_intr_flag = 0; return executed 1 time by 1 test: (status);return (status);Executed by:
executed 1 time by 1 test: } while (0);return (status);Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 73 | } | - | ||||||||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||||||||
| 78 | if (list == 0
| 44-138 | ||||||||||||||||||||||||||||||||||||
| 79 | { | - | ||||||||||||||||||||||||||||||||||||
| 80 | wait_for_background_pids (); | - | ||||||||||||||||||||||||||||||||||||
| 81 | do { interrupt_immediately = old_interrupt_immediately; wait_signal_received = 0; wait_intr_flag = 0; return executed 138 times by 1 test: (0);return (0);Executed by:
executed 138 times by 1 test: } while (0);return (0);Executed by:
| 138 | ||||||||||||||||||||||||||||||||||||
| 82 | } | - | ||||||||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||||||||
| 84 | status = 0; | - | ||||||||||||||||||||||||||||||||||||
| 85 | while (list
| 41-44 | ||||||||||||||||||||||||||||||||||||
| 86 | { | - | ||||||||||||||||||||||||||||||||||||
| 87 | pid_t pid; | - | ||||||||||||||||||||||||||||||||||||
| 88 | char *w; | - | ||||||||||||||||||||||||||||||||||||
| 89 | intmax_t pid_value; | - | ||||||||||||||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||||||||||||||
| 91 | w = list->word->word; | - | ||||||||||||||||||||||||||||||||||||
| 92 | if (((*
| 0-26 | ||||||||||||||||||||||||||||||||||||
| 93 | { | - | ||||||||||||||||||||||||||||||||||||
| 94 | if (legal_number (w, &pid_value)
| 0-23 | ||||||||||||||||||||||||||||||||||||
| 95 | { | - | ||||||||||||||||||||||||||||||||||||
| 96 | pid = (pid_t)pid_value; | - | ||||||||||||||||||||||||||||||||||||
| 97 | status = wait_for_single_pid (pid, wflags|0x01); | - | ||||||||||||||||||||||||||||||||||||
| 98 | } executed 23 times by 1 test: end of blockExecuted by:
| 23 | ||||||||||||||||||||||||||||||||||||
| 99 | else | - | ||||||||||||||||||||||||||||||||||||
| 100 | { | - | ||||||||||||||||||||||||||||||||||||
| 101 | sh_badpid (w); | - | ||||||||||||||||||||||||||||||||||||
| 102 | do { interrupt_immediately = old_interrupt_immediately; wait_signal_received = 0; wait_intr_flag = 0; return executed 3 times by 1 test: (1);return (1);Executed by:
executed 3 times by 1 test: } while (0);return (1);Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 103 | } | - | ||||||||||||||||||||||||||||||||||||
| 104 | } | - | ||||||||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||||||||
| 106 | else if (*
| 0-18 | ||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||
| 108 | { | - | ||||||||||||||||||||||||||||||||||||
| 109 | int job; | - | ||||||||||||||||||||||||||||||||||||
| 110 | sigset_t set, oset; | - | ||||||||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||||||||
| 112 | do { sigemptyset (&set); sigaddset (&set, | - | ||||||||||||||||||||||||||||||||||||
| 113 | 17 | - | ||||||||||||||||||||||||||||||||||||
| 114 | ); sigemptyset (&oset); sigprocmask ( | - | ||||||||||||||||||||||||||||||||||||
| 115 | 0 | - | ||||||||||||||||||||||||||||||||||||
| 116 | , &set, &oset); } while (0); | - | ||||||||||||||||||||||||||||||||||||
| 117 | job = get_job_spec (list); | - | ||||||||||||||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||||||||||||||
| 119 | if (((
| 0-15 | ||||||||||||||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||||||||||||||
| 121 | if (job != -2
| 0-6 | ||||||||||||||||||||||||||||||||||||
| 122 | sh_badjob (list->word->word); executed 6 times by 1 test: sh_badjob (list->word->word);Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
| 123 | sigprocmask ( | - | ||||||||||||||||||||||||||||||||||||
| 124 | 2 | - | ||||||||||||||||||||||||||||||||||||
| 125 | , &oset, (sigset_t *) | - | ||||||||||||||||||||||||||||||||||||
| 126 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 127 | ); | - | ||||||||||||||||||||||||||||||||||||
| 128 | status = 127; | - | ||||||||||||||||||||||||||||||||||||
| 129 | list = list->next; | - | ||||||||||||||||||||||||||||||||||||
| 130 | continue; executed 6 times by 1 test: continue;Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
| 131 | } | - | ||||||||||||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||||||||
| 134 | sigprocmask ( | - | ||||||||||||||||||||||||||||||||||||
| 135 | 2 | - | ||||||||||||||||||||||||||||||||||||
| 136 | , &oset, (sigset_t *) | - | ||||||||||||||||||||||||||||||||||||
| 137 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 138 | ); | - | ||||||||||||||||||||||||||||||||||||
| 139 | status = wait_for_job (job, wflags); | - | ||||||||||||||||||||||||||||||||||||
| 140 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||||||||||||||
| 142 | else | - | ||||||||||||||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||||||||||||||
| 144 | sh_badpid (w); | - | ||||||||||||||||||||||||||||||||||||
| 145 | status = 1; | - | ||||||||||||||||||||||||||||||||||||
| 146 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 147 | list = list->next; | - | ||||||||||||||||||||||||||||||||||||
| 148 | } executed 35 times by 1 test: end of blockExecuted by:
| 35 | ||||||||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||||||||
| 150 | do { interrupt_immediately = old_interrupt_immediately; wait_signal_received = 0; wait_intr_flag = 0; return executed 41 times by 1 test: (status);return (status);Executed by:
executed 41 times by 1 test: } while (0);return (status);Executed by:
| 41 | ||||||||||||||||||||||||||||||||||||
| 151 | } | - | ||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |