lkml.org 
[lkml]   [2023]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] tools/nolibc: Implement WTERMSIG()
Add an implementation of WTERMSIG() to allow nolibc programs to obtain the
signal that caused the exit of a process, and use it in WIFEXITED() since
the condition being checked there is that no signal was reported.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/include/nolibc/types.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index fbbc0e68c001..eb0b9f1ffe18 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -79,8 +79,9 @@
#define LINUX_REBOOT_CMD_SW_SUSPEND 0xd000fce2

/* Macros used on waitpid()'s return status */
+#define WTERMSIG(status) ((status) & 0x7f)
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
-#define WIFEXITED(status) (((status) & 0x7f) == 0)
+#define WIFEXITED(status) (WTERMSIG(status) == 0)

/* waitpid() flags */
#define WNOHANG 1
---
base-commit: 457391b0380335d5e9a5babdec90ac53928b23b4
change-id: 20230427-nolibc-wtermsig-95c5d064f949
Best regards,
--
Mark Brown <broonie@kernel.org>

\
 
 \ /
  Last update: 2023-04-28 17:25    [W:0.022 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site