ARM: uapi: Add ucontext.h
PATCH 1/1 ARM: uapi: Add ucontext.h
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 <[email protected]>
--- arch/arm/include/asm/ucontext.h | 28 +--------------------------- arch/arm/include/uapi/asm/ucontext.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 27 deletions(-)
arch/arm/include/asm/ucontext.h +1 -27
@@ -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 */
arch/arm/include/uapi/asm/ucontext.h new file +31 -0
@@ -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,
Signature · 1 line
Thomas Weißschuh <[email protected]>