From 7d0199963a2ec019270ee187f8c9cb8adb25dac1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 15 Apr 2022 06:30:46 +0000 Subject: Add waitn_posix() and waitn_reap_posix() Signed-off-by: Laurent Bercot --- src/libstddjb/waitn_reap.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/libstddjb/waitn_reap.c') diff --git a/src/libstddjb/waitn_reap.c b/src/libstddjb/waitn_reap.c index 9f26b5d..2c4ebe8 100644 --- a/src/libstddjb/waitn_reap.c +++ b/src/libstddjb/waitn_reap.c @@ -1,19 +1,11 @@ /* ISC license. */ #include + #include int waitn_reap (pid_t *pids, unsigned int len) { - unsigned int n = 0 ; - while (len) - { - int w ; - int r = wait_pids_nohang(pids, len, &w) ; - if (r < 0) return r ; - else if (!r) break ; - pids[r-1] = pids[--len] ; - n++ ; - } - return n ; + int dummy ; + return waitn_reap_posix(pids, len, &dummy) ; } -- cgit v1.3.1