* @brief Iterate over all process IDs * * @param[in] cb Callback function to execute for each PID * @param[in] data User-provided context data * * @return int Error code (0 on success, negative on error) */
| 175 | * @return int Error code (0 on success, negative on error) |
| 176 | */ |
| 177 | int lwp_pid_for_each(int (*cb)(pid_t pid, void *data), void *data) |
| 178 | { |
| 179 | int error; |
| 180 | struct pid_foreach_param buf = |
| 181 | { |
| 182 | .cb = cb, |
| 183 | .data = data, |
| 184 | }; |
| 185 | |
| 186 | lwp_pid_lock_take(); |
| 187 | error = lwp_avl_traversal(lwp_pid_root, _before_cb, &buf); |
| 188 | lwp_pid_lock_release(); |
| 189 | |
| 190 | return error; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * @brief Get the PID array |
no test coverage detected