From: Khem Raj <raj.khem@gmail.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Kamil Rytarowski <kamil@netbsd.org>,
Riku Voipio <riku.voipio@iki.fi>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] replace struct ucontext with ucontext_t type
Date: Thu, 29 Jun 2017 06:12:02 -0700 [thread overview]
Message-ID: <CAMKF1sqdJ0yyC2aG7wHipdGHZfXmL_kJrkd8-rCwQtuhr4hrJw@mail.gmail.com> (raw)
In-Reply-To: <927f7df8-7956-45b9-eb5e-0ea5f71779ea@vivier.eu>
On Thu, Jun 29, 2017 at 1:02 AM, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 28/06/2017 à 22:44, Khem Raj a écrit :
>> The ucontext_t type had a tag struct ucontext until now
>> but newer glibc will drop it so we need to adjust and use
>> the exposed type instead
>
> I didn't find in glib git tree the commit dropping the struct tags for
> ucontext. Could you point it out?
>
see https://sourceware.org/git/?p=glibc.git;a=commit;h=251287734e89a52da3db682a8241eb6bccc050c9
its also documented in (upcoming ) release notes
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27struct_ucontext.27
> Thanks,
> Laurent
>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> Cc: Kamil Rytarowski <kamil@netbsd.org>
>> Cc: Riku Voipio <riku.voipio@iki.fi>
>> Cc: Laurent Vivier <laurent@vivier.eu>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> linux-user/host/aarch64/hostdep.h | 2 +-
>> linux-user/host/arm/hostdep.h | 2 +-
>> linux-user/host/i386/hostdep.h | 2 +-
>> linux-user/host/ppc64/hostdep.h | 2 +-
>> linux-user/host/s390x/hostdep.h | 2 +-
>> linux-user/host/x86_64/hostdep.h | 2 +-
>> linux-user/signal.c | 10 +++++-----
>> tests/tcg/test-i386.c | 4 ++--
>> user-exec.c | 18 +++++++++---------
>> 9 files changed, 22 insertions(+), 22 deletions(-)
>>
>> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
>> index 64f75cef49..a8d41a21ad 100644
>> --- a/linux-user/host/aarch64/hostdep.h
>> +++ b/linux-user/host/aarch64/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> __u64 *pcreg = &uc->uc_mcontext.pc;
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h
>> index 5c1ae60120..9276fe6ceb 100644
>> --- a/linux-user/host/arm/hostdep.h
>> +++ b/linux-user/host/arm/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> unsigned long *pcreg = &uc->uc_mcontext.arm_pc;
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h
>> index d834bd80ea..073be74d87 100644
>> --- a/linux-user/host/i386/hostdep.h
>> +++ b/linux-user/host/i386/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> greg_t *pcreg = &uc->uc_mcontext.gregs[REG_EIP];
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h
>> index 0b0f5f7821..98979ad917 100644
>> --- a/linux-user/host/ppc64/hostdep.h
>> +++ b/linux-user/host/ppc64/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP];
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h
>> index 6f9da9c608..4f0171f36f 100644
>> --- a/linux-user/host/s390x/hostdep.h
>> +++ b/linux-user/host/s390x/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> unsigned long *pcreg = &uc->uc_mcontext.psw.addr;
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h
>> index 3b4259633e..a4fefb5114 100644
>> --- a/linux-user/host/x86_64/hostdep.h
>> +++ b/linux-user/host/x86_64/hostdep.h
>> @@ -24,7 +24,7 @@ extern char safe_syscall_end[];
>> /* Adjust the signal context to rewind out of safe-syscall if we're in it */
>> static inline void rewind_if_in_safe_syscall(void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP];
>>
>> if (*pcreg > (uintptr_t)safe_syscall_start
>> diff --git a/linux-user/signal.c b/linux-user/signal.c
>> index 3d18d1b3ee..2c55a4f600 100644
>> --- a/linux-user/signal.c
>> +++ b/linux-user/signal.c
>> @@ -3346,7 +3346,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
>> *
>> * a0 = signal number
>> * a1 = pointer to siginfo_t
>> - * a2 = pointer to struct ucontext
>> + * a2 = pointer to ucontext_t
>> *
>> * $25 and PC point to the signal handler, $29 points to the
>> * struct sigframe.
>> @@ -3733,7 +3733,7 @@ struct target_signal_frame {
>>
>> struct rt_signal_frame {
>> siginfo_t info;
>> - struct ucontext uc;
>> + ucontext_t uc;
>> uint32_t tramp[2];
>> };
>>
>> @@ -3949,7 +3949,7 @@ struct rt_signal_frame {
>> siginfo_t *pinfo;
>> void *puc;
>> siginfo_t info;
>> - struct ucontext uc;
>> + ucontext_t uc;
>> uint16_t retcode[4]; /* Trampoline code. */
>> };
>>
>> @@ -4484,7 +4484,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
>> tswap_siginfo(&frame->info, info);
>> }
>>
>> - /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/
>> + /*err |= __clear_user(&frame->uc, offsetof(ucontext_t, uc_mcontext));*/
>> __put_user(0, &frame->uc.tuc_flags);
>> __put_user(0, &frame->uc.tuc_link);
>> __put_user(target_sigaltstack_used.ss_sp,
>> @@ -4976,7 +4976,7 @@ enum {
>>
>> struct target_ucontext {
>> target_ulong tuc_flags;
>> - target_ulong tuc_link; /* struct ucontext __user * */
>> + target_ulong tuc_link; /* ucontext_t __user * */
>> struct target_sigaltstack tuc_stack;
>> #if !defined(TARGET_PPC64)
>> int32_t tuc_pad[7];
>> diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
>> index 0f7b943b0c..9599204895 100644
>> --- a/tests/tcg/test-i386.c
>> +++ b/tests/tcg/test-i386.c
>> @@ -1720,7 +1720,7 @@ int tab[2];
>>
>> void sig_handler(int sig, siginfo_t *info, void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>>
>> printf("si_signo=%d si_errno=%d si_code=%d",
>> info->si_signo, info->si_errno, info->si_code);
>> @@ -1912,7 +1912,7 @@ void test_exceptions(void)
>> /* specific precise single step test */
>> void sig_trap_handler(int sig, siginfo_t *info, void *puc)
>> {
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> printf("EIP=" FMTLX "\n", (long)uc->uc_mcontext.gregs[REG_EIP]);
>> }
>>
>> diff --git a/user-exec.c b/user-exec.c
>> index a8f95fa1e1..2a975eaf69 100644
>> --- a/user-exec.c
>> +++ b/user-exec.c
>> @@ -167,7 +167,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> #elif defined(__OpenBSD__)
>> struct sigcontext *uc = puc;
>> #else
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> #endif
>> unsigned long pc;
>> int trapno;
>> @@ -222,7 +222,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> #elif defined(__OpenBSD__)
>> struct sigcontext *uc = puc;
>> #else
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> #endif
>>
>> pc = PC_sig(uc);
>> @@ -289,7 +289,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>> ucontext_t *uc = puc;
>> #else
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> #endif
>> unsigned long pc;
>> int is_write;
>> @@ -316,7 +316,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> void *puc)
>> {
>> siginfo_t *info = pinfo;
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> uint32_t *pc = uc->uc_mcontext.sc_pc;
>> uint32_t insn = *pc;
>> int is_write = 0;
>> @@ -414,7 +414,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> #if defined(__NetBSD__)
>> ucontext_t *uc = puc;
>> #else
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> #endif
>> unsigned long pc;
>> int is_write;
>> @@ -441,7 +441,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
>> {
>> siginfo_t *info = pinfo;
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> uintptr_t pc = uc->uc_mcontext.pc;
>> uint32_t insn = *(uint32_t *)pc;
>> bool is_write;
>> @@ -474,7 +474,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
>> int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
>> {
>> siginfo_t *info = pinfo;
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> unsigned long ip;
>> int is_write = 0;
>>
>> @@ -505,7 +505,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> void *puc)
>> {
>> siginfo_t *info = pinfo;
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> unsigned long pc;
>> uint16_t *pinsn;
>> int is_write = 0;
>> @@ -558,7 +558,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>> void *puc)
>> {
>> siginfo_t *info = pinfo;
>> - struct ucontext *uc = puc;
>> + ucontext_t *uc = puc;
>> greg_t pc = uc->uc_mcontext.pc;
>> int is_write;
>>
>>
>
next prev parent reply other threads:[~2017-06-29 13:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 20:44 [Qemu-devel] [PATCH] replace struct ucontext with ucontext_t type Khem Raj
2017-06-29 8:02 ` Laurent Vivier
2017-06-29 13:12 ` Khem Raj [this message]
2017-06-29 9:05 ` Peter Maydell
2017-06-29 13:12 ` Markus Armbruster
2017-06-29 13:10 ` Kamil Rytarowski
2017-06-29 13:18 ` Daniel P. Berrange
2017-07-19 1:06 ` Eric Blake
2017-07-20 9:59 ` Peter Maydell
2017-06-29 14:09 ` Laurent Vivier
2017-07-19 1:07 ` Eric Blake
2017-07-06 23:49 ` no-reply
2017-07-07 0:02 ` Fam Zheng
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=CAMKF1sqdJ0yyC2aG7wHipdGHZfXmL_kJrkd8-rCwQtuhr4hrJw@mail.gmail.com \
--to=raj.khem@gmail.com \
--cc=kamil@netbsd.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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;
as well as URLs for NNTP newsgroup(s).