diff mbox series

[v2,05/13] tools/nolibc: add more wait status related types

Message ID e578baa7116bb09f406a2beaea8298f7bbb22d6c.1685387484.git.falcon@tinylab.org
State New
Headers show
Series [v2,01/13] selftests/nolibc: remove gettimeofday_bad1/2 completely | expand

Commit Message

Zhangjin Wu May 29, 2023, 7:51 p.m. UTC
More wait status related types are added for the coming waitid syscall
based wait4() support.

Resue the ones from <linux/wait.h>, add the missing ones from sys/wait.h
and bits/waitstatus.h of glibc.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/include/nolibc/types.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index f96e28bff4ba..698d859fc6e2 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -10,6 +10,7 @@ 
 #include "std.h"
 #include <linux/time.h>
 #include <linux/stat.h>
+#include <linux/wait.h>
 
 
 /* Only the generic macros and types may be defined here. The arch-specific
@@ -91,9 +92,13 @@ 
 #define WIFEXITED(status)   (((status) & 0x7f) == 0)
 #define WTERMSIG(status)    ((status) & 0x7f)
 #define WIFSIGNALED(status) ((status) - 1 < 0xff)
+#define WIFSTOPPED(status)  (((status) & 0xff) == 0x7f)
 
-/* waitpid() flags */
-#define WNOHANG      1
+/* Macros for constructing status values.  */
+#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
+#define W_STOPCODE(sig)      ((sig) << 8 | 0x7f)
+#define W_CONTINUED          0xffff
+#define WCOREFLAG            0x80
 
 /* standard exit() codes */
 #define EXIT_SUCCESS 0