MCPcopy Index your code
hub / github.com/RsyncProject/rsync / wait_process_with_flush

Function wait_process_with_flush

main.c:194–223  ·  view source on GitHub ↗

Wait for a process to exit, calling io_flush while waiting. */

Source from the content-addressed store, hash-verified

192
193/* Wait for a process to exit, calling io_flush while waiting. */
194static void wait_process_with_flush(pid_t pid, int *exit_code_ptr)
195{
196 pid_t waited_pid;
197 int status;
198
199 while ((waited_pid = wait_process(pid, &status, WNOHANG)) == 0) {
200 msleep(20);
201 io_flush(FULL_FLUSH);
202 }
203
204 /* TODO: If the child exited on a signal, then log an
205 * appropriate error message. Perhaps we should also accept a
206 * message describing the purpose of the child. Also indicate
207 * this to the caller so that they know something went wrong. */
208 if (waited_pid < 0) {
209 rsyserr(FERROR, errno, "waitpid");
210 *exit_code_ptr = RERR_WAITCHILD;
211 } else if (!WIFEXITED(status)) {
212#ifdef WCOREDUMP
213 if (WCOREDUMP(status))
214 *exit_code_ptr = RERR_CRASHED;
215 else
216#endif
217 if (WIFSIGNALED(status))
218 *exit_code_ptr = RERR_TERMINATED;
219 else
220 *exit_code_ptr = RERR_WAITCHILD;
221 } else
222 *exit_code_ptr = WEXITSTATUS(status);
223}
224
225void write_del_stats(int f)
226{

Callers 2

do_recvFunction · 0.85
client_runFunction · 0.85

Calls 4

wait_processFunction · 0.85
msleepFunction · 0.85
io_flushFunction · 0.85
rsyserrFunction · 0.70

Tested by

no test coverage detected