dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0200-Update-references-of-struct-ucontext-to-ucontext_t.patch

Nathaniel McCallum cf6afb
From 4eea6d48daa1d1f7dda3e1458b992302c1dd040e Mon Sep 17 00:00:00 2001
Nathaniel McCallum cf6afb
From: Nathaniel McCallum <npmccallum@redhat.com>
Nathaniel McCallum cf6afb
Date: Tue, 18 Jul 2017 18:19:38 -0400
Nathaniel McCallum cf6afb
Subject: [PATCH] Update references of "struct ucontext" to "ucontext_t"
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
Glibc used to have:
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
   typedef struct ucontext { ... } ucontext_t;
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
Glibc now has:
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
   typedef struct ucontext_t { ... } ucontext_t;
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
However, Qemu used "struct ucontext" in declarations. This is a
Nathaniel McCallum cf6afb
private name and compatiblity cannot be guaranteed. This patch
Nathaniel McCallum cf6afb
updates Qemu to only use the standardized type name.
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
Signed-off-by: Nathaniel McCallum <npmccallum@redhat.com>
Nathaniel McCallum cf6afb
---
Nathaniel McCallum cf6afb
 linux-user/host/aarch64/hostdep.h |  2 +-
Nathaniel McCallum cf6afb
 linux-user/host/arm/hostdep.h     |  2 +-
Nathaniel McCallum cf6afb
 linux-user/host/i386/hostdep.h    |  2 +-
Nathaniel McCallum cf6afb
 linux-user/host/ppc64/hostdep.h   |  2 +-
Nathaniel McCallum cf6afb
 linux-user/host/s390x/hostdep.h   |  2 +-
Nathaniel McCallum cf6afb
 linux-user/host/x86_64/hostdep.h  |  2 +-
Nathaniel McCallum cf6afb
 linux-user/signal.c               | 10 +++++-----
Nathaniel McCallum cf6afb
 tests/tcg/test-i386.c             |  4 ++--
Nathaniel McCallum cf6afb
 user-exec.c                       | 18 +++++++++---------
Nathaniel McCallum cf6afb
 9 files changed, 22 insertions(+), 22 deletions(-)
Nathaniel McCallum cf6afb
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
Nathaniel McCallum cf6afb
index 64f75cef49..a8d41a21ad 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/aarch64/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/aarch64/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     __u64 *pcreg = &uc->uc_mcontext.pc;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h
Nathaniel McCallum cf6afb
index 5c1ae60120..9276fe6ceb 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/arm/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/arm/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     unsigned long *pcreg = &uc->uc_mcontext.arm_pc;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h
Nathaniel McCallum cf6afb
index d834bd80ea..073be74d87 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/i386/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/i386/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     greg_t *pcreg = &uc->uc_mcontext.gregs[REG_EIP];
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h
Nathaniel McCallum cf6afb
index 0b0f5f7821..98979ad917 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/ppc64/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/ppc64/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP];
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h
Nathaniel McCallum cf6afb
index 6f9da9c608..4f0171f36f 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/s390x/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/s390x/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     unsigned long *pcreg = &uc->uc_mcontext.psw.addr;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h
Nathaniel McCallum cf6afb
index 3b4259633e..a4fefb5114 100644
Nathaniel McCallum cf6afb
--- a/linux-user/host/x86_64/hostdep.h
Nathaniel McCallum cf6afb
+++ b/linux-user/host/x86_64/hostdep.h
Nathaniel McCallum cf6afb
@@ -24,7 +24,7 @@ extern char safe_syscall_end[];
Nathaniel McCallum cf6afb
 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
Nathaniel McCallum cf6afb
 static inline void rewind_if_in_safe_syscall(void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP];
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     if (*pcreg > (uintptr_t)safe_syscall_start
Nathaniel McCallum cf6afb
diff --git a/linux-user/signal.c b/linux-user/signal.c
Nathaniel McCallum cf6afb
index 3d18d1b3ee..2c55a4f600 100644
Nathaniel McCallum cf6afb
--- a/linux-user/signal.c
Nathaniel McCallum cf6afb
+++ b/linux-user/signal.c
Nathaniel McCallum cf6afb
@@ -3346,7 +3346,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
Nathaniel McCallum cf6afb
     *
Nathaniel McCallum cf6afb
     *   a0 = signal number
Nathaniel McCallum cf6afb
     *   a1 = pointer to siginfo_t
Nathaniel McCallum cf6afb
-    *   a2 = pointer to struct ucontext
Nathaniel McCallum cf6afb
+    *   a2 = pointer to ucontext_t
Nathaniel McCallum cf6afb
     *
Nathaniel McCallum cf6afb
     * $25 and PC point to the signal handler, $29 points to the
Nathaniel McCallum cf6afb
     * struct sigframe.
Nathaniel McCallum cf6afb
@@ -3733,7 +3733,7 @@ struct target_signal_frame {
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
 struct rt_signal_frame {
Nathaniel McCallum cf6afb
     siginfo_t info;
Nathaniel McCallum cf6afb
-    struct ucontext uc;
Nathaniel McCallum cf6afb
+    ucontext_t uc;
Nathaniel McCallum cf6afb
     uint32_t tramp[2];
Nathaniel McCallum cf6afb
 };
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
@@ -3949,7 +3949,7 @@ struct rt_signal_frame {
Nathaniel McCallum cf6afb
     siginfo_t *pinfo;
Nathaniel McCallum cf6afb
     void *puc;
Nathaniel McCallum cf6afb
     siginfo_t info;
Nathaniel McCallum cf6afb
-    struct ucontext uc;
Nathaniel McCallum cf6afb
+    ucontext_t uc;
Nathaniel McCallum cf6afb
     uint16_t retcode[4];      /* Trampoline code. */
Nathaniel McCallum cf6afb
 };
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
@@ -4484,7 +4484,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
Nathaniel McCallum cf6afb
         tswap_siginfo(&frame->info, info);
Nathaniel McCallum cf6afb
     }
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
-    /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/
Nathaniel McCallum cf6afb
+    /*err |= __clear_user(&frame->uc, offsetof(ucontext_t, uc_mcontext));*/
Nathaniel McCallum cf6afb
     __put_user(0, &frame->uc.tuc_flags);
Nathaniel McCallum cf6afb
     __put_user(0, &frame->uc.tuc_link);
Nathaniel McCallum cf6afb
     __put_user(target_sigaltstack_used.ss_sp,
Nathaniel McCallum cf6afb
@@ -4976,7 +4976,7 @@ enum {
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
 struct target_ucontext {
Nathaniel McCallum cf6afb
     target_ulong tuc_flags;
Nathaniel McCallum cf6afb
-    target_ulong tuc_link;    /* struct ucontext __user * */
Nathaniel McCallum cf6afb
+    target_ulong tuc_link;    /* ucontext_t __user * */
Nathaniel McCallum cf6afb
     struct target_sigaltstack tuc_stack;
Nathaniel McCallum cf6afb
 #if !defined(TARGET_PPC64)
Nathaniel McCallum cf6afb
     int32_t tuc_pad[7];
Nathaniel McCallum cf6afb
diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
Nathaniel McCallum cf6afb
index 0f7b943b0c..9599204895 100644
Nathaniel McCallum cf6afb
--- a/tests/tcg/test-i386.c
Nathaniel McCallum cf6afb
+++ b/tests/tcg/test-i386.c
Nathaniel McCallum cf6afb
@@ -1720,7 +1720,7 @@ int tab[2];
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
 void sig_handler(int sig, siginfo_t *info, void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     printf("si_signo=%d si_errno=%d si_code=%d",
Nathaniel McCallum cf6afb
            info->si_signo, info->si_errno, info->si_code);
Nathaniel McCallum cf6afb
@@ -1912,7 +1912,7 @@ void test_exceptions(void)
Nathaniel McCallum cf6afb
 /* specific precise single step test */
Nathaniel McCallum cf6afb
 void sig_trap_handler(int sig, siginfo_t *info, void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     printf("EIP=" FMTLX "\n", (long)uc->uc_mcontext.gregs[REG_EIP]);
Nathaniel McCallum cf6afb
 }
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
diff --git a/user-exec.c b/user-exec.c
Nathaniel McCallum cf6afb
index a8f95fa1e1..2a975eaf69 100644
Nathaniel McCallum cf6afb
--- a/user-exec.c
Nathaniel McCallum cf6afb
+++ b/user-exec.c
Nathaniel McCallum cf6afb
@@ -167,7 +167,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
 #elif defined(__OpenBSD__)
Nathaniel McCallum cf6afb
     struct sigcontext *uc = puc;
Nathaniel McCallum cf6afb
 #else
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #endif
Nathaniel McCallum cf6afb
     unsigned long pc;
Nathaniel McCallum cf6afb
     int trapno;
Nathaniel McCallum cf6afb
@@ -222,7 +222,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
 #elif defined(__OpenBSD__)
Nathaniel McCallum cf6afb
     struct sigcontext *uc = puc;
Nathaniel McCallum cf6afb
 #else
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #endif
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
     pc = PC_sig(uc);
Nathaniel McCallum cf6afb
@@ -289,7 +289,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
Nathaniel McCallum cf6afb
     ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #else
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #endif
Nathaniel McCallum cf6afb
     unsigned long pc;
Nathaniel McCallum cf6afb
     int is_write;
Nathaniel McCallum cf6afb
@@ -316,7 +316,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
                            void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
     siginfo_t *info = pinfo;
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     uint32_t *pc = uc->uc_mcontext.sc_pc;
Nathaniel McCallum cf6afb
     uint32_t insn = *pc;
Nathaniel McCallum cf6afb
     int is_write = 0;
Nathaniel McCallum cf6afb
@@ -414,7 +414,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
 #if defined(__NetBSD__)
Nathaniel McCallum cf6afb
     ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #else
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
 #endif
Nathaniel McCallum cf6afb
     unsigned long pc;
Nathaniel McCallum cf6afb
     int is_write;
Nathaniel McCallum cf6afb
@@ -441,7 +441,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
 int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
     siginfo_t *info = pinfo;
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     uintptr_t pc = uc->uc_mcontext.pc;
Nathaniel McCallum cf6afb
     uint32_t insn = *(uint32_t *)pc;
Nathaniel McCallum cf6afb
     bool is_write;
Nathaniel McCallum cf6afb
@@ -474,7 +474,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
Nathaniel McCallum cf6afb
 int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
     siginfo_t *info = pinfo;
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     unsigned long ip;
Nathaniel McCallum cf6afb
     int is_write = 0;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
@@ -505,7 +505,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
                        void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
     siginfo_t *info = pinfo;
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     unsigned long pc;
Nathaniel McCallum cf6afb
     uint16_t *pinsn;
Nathaniel McCallum cf6afb
     int is_write = 0;
Nathaniel McCallum cf6afb
@@ -558,7 +558,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
Nathaniel McCallum cf6afb
                        void *puc)
Nathaniel McCallum cf6afb
 {
Nathaniel McCallum cf6afb
     siginfo_t *info = pinfo;
Nathaniel McCallum cf6afb
-    struct ucontext *uc = puc;
Nathaniel McCallum cf6afb
+    ucontext_t *uc = puc;
Nathaniel McCallum cf6afb
     greg_t pc = uc->uc_mcontext.pc;
Nathaniel McCallum cf6afb
     int is_write;
Nathaniel McCallum cf6afb
 
Nathaniel McCallum cf6afb
-- 
Nathaniel McCallum cf6afb
2.13.3
Nathaniel McCallum cf6afb