summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/forkfd/forkfd.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-02-21 12:41:19 -0800
committerEdward Welbourne <eddy@chaos.org.uk>2020-03-25 20:19:34 +0100
commit4605583fec7b101057f72b0c8b967fcfac07e12d (patch)
tree8b6c97fa241447b76c48e0be70b3c2abf8072c31 /src/3rdparty/forkfd/forkfd.h
parent2b9137426182fb0e0c3ef37cfa8dec0762ad52b4 (diff)
forkfd: introduce forkfd_wait4() that takes options
"wait4" because it looks like the wait4() BSD function, which has the signature: pid_t wait4(pid_t pid, int *wstatus, int options, struct rusage *rusage); And because ours also has 4 parameters. Having options is important anyway. I might want to add some more later, but we can't really support them with the fall back implementation (in fact, we don't honor WNOHANG in the fall back implementation either). Change-Id: I4e559af2a9a1455ab770fffd15f5858bb357e15b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/3rdparty/forkfd/forkfd.h')
-rw-r--r--src/3rdparty/forkfd/forkfd.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/3rdparty/forkfd/forkfd.h b/src/3rdparty/forkfd/forkfd.h
index fe70371719..205928cc2b 100644
--- a/src/3rdparty/forkfd/forkfd.h
+++ b/src/3rdparty/forkfd/forkfd.h
@@ -44,13 +44,20 @@ extern "C" {
#define FFD_CHILD_PROCESS (-2)
+#define FFDW_NOHANG 1 /* WNOHANG */
+#define FFDW_NOWAIT 2 /* WNOWAIT */
+
struct forkfd_info {
int32_t code;
int32_t status;
};
int forkfd(int flags, pid_t *ppid);
-int forkfd_wait(int ffd, struct forkfd_info *info, struct rusage *rusage);
+int forkfd_wait4(int ffd, struct forkfd_info *info, int options, struct rusage *rusage);
+static inline int forkfd_wait(int ffd, struct forkfd_info *info, struct rusage *rusage)
+{
+ return forkfd_wait4(ffd, info, 0, rusage);
+}
int forkfd_close(int ffd);
#if _POSIX_SPAWN > 0