Skip to contentSkip to conversation

selftests/powerpc: Fix: use ucontext_t instead of struct ucontext

PATCH Applied Harish 2 participants 2 messages Feb 13, 2018 – Feb 14, 2018

Subsystems (2)
lore
Share & tools
lore

Harish

author
#0 lore raw

PATCH 1/1 selftests/powerpc: Fix: use ucontext_t instead of struct ucontext

With glibc 2.26 'struct ucontext' is removed to improve POSIX compliance, which breaks powerpc/alignment_handler selftest. Fix the test by using ucontext_t. Tested on ppc, works with older glibc versions as well.

Fixes the following:
alignment_handler.c: In function ‘sighandler’:
alignment_handler.c:68:5: error: dereferencing pointer to incomplete type ‘struct ucontext’

  ucp->uc_mcontext.gp_regs[PT_NIP] += 4;
     ^~
---
 tools/testing/selftests/powerpc/alignment/alignment_handler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/alignment/alignment_handler.c +1 -1
index 39fd362..0f2698f 100644
@@ -57,7 +57,7 @@ volatile int gotsig;
 
 void sighandler(int sig, siginfo_t *info, void *ctx)
 {
-	struct ucontext *ucp = ctx;
+	ucontext_t *ucp = ctx;
 
 	if (!testing) {
 		signal(sig, SIG_DFL);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Harish

With glibc 2.26 'struct ucontext' is removed to improve POSIX compliance, which breaks powerpc/alignment_handler selftest. Fix the test by using ucontext_t. Tested on ppc, works with older glibc versions as well.

Quoted 7 lines

Fixes the following:
alignment_handler.c: In function ‘sighandler’:
alignment_handler.c:68:5: error: dereferencing pointer to incomplete type ‘struct ucontext’

  ucp->uc_mcontext.gp_regs[PT_NIP] += 4;
     ^~

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/ecdf06e1ea5376bba03c155751f686

cheers