[git commit] platform.h: fix for Bionic >= 21 not having wait3()

Denys Vlasenko vda.linux at googlemail.com
Wed Apr 14 20:14:36 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=c0943ac451051b734711b0c95731ae7c515dbb31
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/platform.h | 4 ++++
 miscutils/time.c   | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/include/platform.h b/include/platform.h
index 24efd186b..387b6f537 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -424,6 +424,7 @@ typedef unsigned smalluint;
 #define HAVE_NET_ETHERNET_H 1
 #define HAVE_SYS_STATFS_H 1
 #define HAVE_PRINTF_PERCENTM 1
+#define HAVE_WAIT3 1
 
 #if defined(__UCLIBC__)
 # if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32)
@@ -535,6 +536,9 @@ typedef unsigned smalluint;
 #  undef HAVE_STPCPY
 #  undef HAVE_STPNCPY
 # endif
+# if __ANDROID_API__ >= 21
+#  undef HAVE_WAIT3
+# endif
 # undef HAVE_MEMPCPY
 # undef HAVE_STRCHRNUL
 # undef HAVE_STRVERSCMP
diff --git a/miscutils/time.c b/miscutils/time.c
index 0006c59d8..c4bcbcbc9 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -33,6 +33,13 @@
 
 #include "libbb.h"
 
+#ifndef HAVE_WAIT3
+static pid_t wait3(int *status, int options, struct rusage *rusage)
+{
+	return wait4(-1, status, options, rusage);
+}
+#endif
+
 /* Information on the resources used by a child process.  */
 typedef struct {
 	int waitstatus;


More information about the busybox-cvs mailing list