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

Zhangjin Wu falcon at tinylab.org
Mon May 29 12:51:48 PDT 2023


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 at tinylab.org>
---
 tools/include/nolibc/types.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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
-- 
2.25.1




More information about the linux-riscv mailing list