MCPcopy Create free account
hub / github.com/coreutils/coreutils / reap

Function reap

src/sort.c:761–779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759 exited, return 0 without waiting. */
760
761static pid_t
762reap (pid_t pid)
763{
764 int status;
765 pid_t cpid = waitpid ((pid ? pid : -1), &status, (pid ? 0 : WNOHANG));
766
767 if (cpid < 0)
768 error (SORT_FAILURE, errno, _("waiting for %s [-d]"),
769 quoteaf (compress_program));
770 else if (0 < cpid && (0 < pid || delete_proc (cpid)))
771 {
772 if (! WIFEXITED (status) || WEXITSTATUS (status))
773 error (SORT_FAILURE, 0, _("%s [-d] terminated abnormally"),
774 quoteaf (compress_program));
775 --nprocs;
776 }
777
778 return cpid;
779}
780
781/* TEMP represents a new process; add it to the process table. Create
782 the process table the first time it's called. */

Callers 4

wait_procFunction · 0.85
reap_exitedFunction · 0.85
reap_someFunction · 0.85
reap_allFunction · 0.85

Calls 1

delete_procFunction · 0.85

Tested by

no test coverage detected