From: Mark Brown <broonie@kernel.org>
To: Willy Tarreau <w@1wt.eu>, "Paul E. McKenney" <paulmck@kernel.org>
Cc: linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH] tools/nolibc: Implement WTERMSIG()
Date: Fri, 28 Apr 2023 16:24:36 +0100 [thread overview]
Message-ID: <20230427-nolibc-wtermsig-v1-1-6baf4219bb32@kernel.org> (raw)
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>
next reply other threads:[~2023-04-28 15:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 15:24 Mark Brown [this message]
2023-05-02 6:20 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230427-nolibc-wtermsig-v1-1-6baf4219bb32@kernel.org \
--to=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®