From 4b2cbddf2fdd394d4a91735237b266f9b026123c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 3 Sep 2026 22:42:12 +0000 Subject: Add waitpids, waitpids_nohang, refactor wait stuff Also fix fd_cat doc --- src/include/skalibs/djbunix.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/include') diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h index d6efa09..0bba29a 100644 --- a/src/include/skalibs/djbunix.h +++ b/src/include/skalibs/djbunix.h @@ -59,18 +59,23 @@ extern int openc_write (char const *) ; extern size_t path_canonicalize (char *, char const *, int) ; -extern pid_t wait_nointr (int *) ; +#define wait_status(w) (WIFSIGNALED(w) ? 256 + WTERMSIG(w) : WEXITSTATUS(w)) +#define wait_estatus(w) (WIFSIGNALED(w) ? 128 + WTERMSIG(w) : WEXITSTATUS(w) >= 128 ? 128 : WEXITSTATUS(w)) + +/* These do not reap unknown children */ extern pid_t waitpid_nointr (pid_t, int *, int) ; #define wait_pid(pid, wstat) waitpid_nointr(pid, (wstat), 0) #define waitpid_nohang(pid, wstat) waitpid_nointr(pid, (wstat), WNOHANG) +extern int waitpids_nohang (pid_t const *, size_t, int *, size_t *) ; +extern size_t waitpids (pid_t const *, size_t, int *) ; + +/* These reap unknown children */ +extern pid_t wait_nointr (int *) ; #define wait_nohang(wstat) waitpid_nohang(-1, (wstat)) extern pid_t wait_pid_nohang (pid_t, int *) ; extern int wait_pids_nohang (pid_t const *, unsigned int, int *) ; -extern int waitpids_nohang (pid_t const *, unsigned int, int *) ; - -#define wait_status(w) (WIFSIGNALED(w) ? 256 + WTERMSIG(w) : WEXITSTATUS(w)) -#define wait_estatus(w) (WIFSIGNALED(w) ? 128 + WTERMSIG(w) : WEXITSTATUS(w) >= 128 ? 128 : WEXITSTATUS(w)) +/* These will disappear or be refactored */ extern unsigned int wait_reap (void) ; extern int waitn (pid_t *, unsigned int) ; extern int waitn_posix (pid_t *, unsigned int, int *) ; -- cgit v1.3.1