diff mbox series

[RFC,2/5] tools/nolibc: add helpers for wait() signal exits

Message ID 20230223-nolibc-stackprotector-v1-2-3e74d81b3f21@weissschuh.net (mailing list archive)
State Accepted
Commit 8c934d4822c77818d53f5f4c948c3ace6fda1505
Headers show
Series tools/nolibc: add support for stack protector | expand

Commit Message

Thomas Weißschuh March 7, 2023, 10:22 p.m. UTC
These are useful for users and will also be used in an upcoming
testcase.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/include/nolibc/types.h | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index 10823e5ac44b..aedd7d9e3f64 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -97,6 +97,8 @@ 
 /* Macros used on waitpid()'s return status */
 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
 #define WIFEXITED(status)   (((status) & 0x7f) == 0)
+#define WTERMSIG(status)    ((status) & 0x7f)
+#define WIFSIGNALED(status) ((status) - 1 < 0xff)
 
 /* waitpid() flags */
 #define WNOHANG      1