mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Thomas Weißschuh" <linux@weissschuh.net>
Subject: [PATCH] ARM: uapi: Add ucontext.h
Date: Sat, 14 Mar 2026 13:17:13 +0100	[thread overview]
Message-ID: <20260314-uapi-ucontext-arm-v1-1-d9922bdf7dbc@weissschuh.net> (raw)

The ARM asm/ucontext.h header was written to be usable both inside the
kernel and in the UAPI, by using '#ifdef __KERNEL__' guards.
However as the header is not located in the 'uapi/' directory, it will
never be exposed as such.

Move the UAPI bits to a new UAPI header and remove the pointless
ifdeffery.

While at it, also add some necessary includes to the new header.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 arch/arm/include/asm/ucontext.h      | 28 +---------------------------
 arch/arm/include/uapi/asm/ucontext.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/arch/arm/include/asm/ucontext.h b/arch/arm/include/asm/ucontext.h
index 4048c92d9c2b..e4e00822198e 100644
--- a/arch/arm/include/asm/ucontext.h
+++ b/arch/arm/include/asm/ucontext.h
@@ -4,31 +4,7 @@
 
 #include <asm/fpstate.h>
 #include <asm/user.h>
-
-/*
- * struct sigcontext only has room for the basic registers, but struct
- * ucontext now has room for all registers which need to be saved and
- * restored.  Coprocessor registers are stored in uc_regspace.  Each
- * coprocessor's saved state should start with a documented 32-bit magic
- * number, followed by a 32-bit word giving the coproccesor's saved size.
- * uc_regspace may be expanded if necessary, although this takes some
- * coordination with glibc.
- */
-
-struct ucontext {
-	unsigned long	  uc_flags;
-	struct ucontext  *uc_link;
-	stack_t		  uc_stack;
-	struct sigcontext uc_mcontext;
-	sigset_t	  uc_sigmask;
-	/* Allow for uc_sigmask growth.  Glibc uses a 1024-bit sigset_t.  */
-	int		  __unused[32 - (sizeof (sigset_t) / sizeof (int))];
-	/* Last for extensibility.  Eight byte aligned because some
-	   coprocessors require eight byte alignment.  */
- 	unsigned long	  uc_regspace[128] __attribute__((__aligned__(8)));
-};
-
-#ifdef __KERNEL__
+#include <uapi/asm/ucontext.h>
 
 /*
  * Coprocessor save state.  The magic values and specific
@@ -91,6 +67,4 @@ struct aux_sigframe {
 	unsigned long		end_magic;
 } __attribute__((__aligned__(8)));
 
-#endif
-
 #endif /* !_ASMARM_UCONTEXT_H */
diff --git a/arch/arm/include/uapi/asm/ucontext.h b/arch/arm/include/uapi/asm/ucontext.h
new file mode 100644
index 000000000000..6e6c3202e85e
--- /dev/null
+++ b/arch/arm/include/uapi/asm/ucontext.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_ASMARM_UCONTEXT_H
+#define _UAPI_ASMARM_UCONTEXT_H
+
+#include <asm/sigcontext.h>
+#include <asm/signal.h>
+
+/*
+ * struct sigcontext only has room for the basic registers, but struct
+ * ucontext now has room for all registers which need to be saved and
+ * restored.  Coprocessor registers are stored in uc_regspace.  Each
+ * coprocessor's saved state should start with a documented 32-bit magic
+ * number, followed by a 32-bit word giving the coproccesor's saved size.
+ * uc_regspace may be expanded if necessary, although this takes some
+ * coordination with glibc.
+ */
+
+struct ucontext {
+	unsigned long	  uc_flags;
+	struct ucontext  *uc_link;
+	stack_t		  uc_stack;
+	struct sigcontext uc_mcontext;
+	sigset_t	  uc_sigmask;
+	/* Allow for uc_sigmask growth.  Glibc uses a 1024-bit sigset_t.  */
+	int		  __unused[32 - (sizeof (sigset_t) / sizeof (int))];
+	/* Last for extensibility.  Eight byte aligned because some
+	   coprocessors require eight byte alignment.  */
+	unsigned long	  uc_regspace[128] __attribute__((__aligned__(8)));
+};
+
+#endif

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260314-uapi-ucontext-arm-70f9a57cb91d

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


                 reply	other threads:[~2026-03-14 12:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260314-uapi-ucontext-arm-v1-1-d9922bdf7dbc@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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®