* @brief Queries process state change events from a child process * * @param[in] child The child process to query * @param[in] cur_thr The current thread context * @param[in] self_lwp The parent process (current LWP) * @param[in] options Wait options (e.g., WSTOPPED) * @param[out] status Pointer to store child's status (optional) * * @return sysret_t Returns child PID if event found, or HA
| 1227 | * @note Checks for termination or stopped state changes in child process |
| 1228 | */ |
| 1229 | static sysret_t _query_event_from_lwp(rt_lwp_t child, rt_thread_t cur_thr, rt_lwp_t self_lwp, |
| 1230 | int options, int *status) |
| 1231 | { |
| 1232 | sysret_t rc; |
| 1233 | |
| 1234 | LWP_LOCK(child); |
| 1235 | if (child->terminated) |
| 1236 | { |
| 1237 | rc = child->pid; |
| 1238 | } |
| 1239 | else if ((options & WSTOPPED) && child->jobctl_stopped && !child->wait_reap_stp) |
| 1240 | { |
| 1241 | child->wait_reap_stp = 1; |
| 1242 | rc = child->pid; |
| 1243 | } |
| 1244 | else |
| 1245 | { |
| 1246 | rc = HAS_CHILD_BUT_NO_EVT; |
| 1247 | } |
| 1248 | LWP_UNLOCK(child); |
| 1249 | |
| 1250 | LOG_D("%s(child_pid=%d ('%s'), stopped=%d) => %d", __func__, child->pid, child->cmd, child->jobctl_stopped, rc); |
| 1251 | return rc; |
| 1252 | } |
| 1253 | |
| 1254 | /** |
| 1255 | * @brief Verifies and reaps a child process if conditions are met |
no outgoing calls
no test coverage detected