[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/26] linux-user: Remove unnecessary nptl_flags vari
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 23/26] linux-user: Remove unnecessary nptl_flags variable from do_fork() |
Date: |
Thu, 22 Sep 2016 15:13:43 +0300 |
From: Peter Maydell <address@hidden>
The 'nptl_flags' variable in do_fork() is set to a copy of
'flags', and then the CLONE_NPTL_FLAGS are cleared out of 'flags'.
However the only effect of this is that the later check on
"if (flags & CLONE_PARENT_SETTID)" is never true. Since we
will already have done the setting of parent_tidptr in clone_func()
in the child thread, we don't need to do it again.
Delete the dead if() and the clearing of CLONE_NPTL_FLAGS from
'flags', and then use 'flags' where we were previously using
'nptl_flags', so we can delete the unnecessary variable.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 27ad6a2..3b7b51f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6011,7 +6011,6 @@ static int do_fork(CPUArchState *env, unsigned int flags,
abi_ulong newsp,
TaskState *ts;
CPUState *new_cpu;
CPUArchState *new_env;
- unsigned int nptl_flags;
sigset_t sigmask;
/* Emulate vfork() with fork() */
@@ -6034,15 +6033,14 @@ static int do_fork(CPUArchState *env, unsigned int
flags, abi_ulong newsp,
ts->bprm = parent_ts->bprm;
ts->info = parent_ts->info;
ts->signal_mask = parent_ts->signal_mask;
- nptl_flags = flags;
- flags &= ~CLONE_NPTL_FLAGS2;
- if (nptl_flags & CLONE_CHILD_CLEARTID) {
+ if (flags & CLONE_CHILD_CLEARTID) {
ts->child_tidptr = child_tidptr;
}
- if (nptl_flags & CLONE_SETTLS)
+ if (flags & CLONE_SETTLS) {
cpu_set_tls (new_env, newtls);
+ }
/* Grab a mutex so that thread setup appears atomic. */
pthread_mutex_lock(&clone_lock);
@@ -6052,10 +6050,12 @@ static int do_fork(CPUArchState *env, unsigned int
flags, abi_ulong newsp,
pthread_mutex_lock(&info.mutex);
pthread_cond_init(&info.cond, NULL);
info.env = new_env;
- if (nptl_flags & CLONE_CHILD_SETTID)
+ if (flags & CLONE_CHILD_SETTID) {
info.child_tidptr = child_tidptr;
- if (nptl_flags & CLONE_PARENT_SETTID)
+ }
+ if (flags & CLONE_PARENT_SETTID) {
info.parent_tidptr = parent_tidptr;
+ }
ret = pthread_attr_init(&attr);
ret = pthread_attr_setstacksize(&attr, NEW_STACK_SIZE);
@@ -6074,8 +6074,6 @@ static int do_fork(CPUArchState *env, unsigned int flags,
abi_ulong newsp,
/* Wait for the child to initialize. */
pthread_cond_wait(&info.cond, &info.mutex);
ret = info.tid;
- if (flags & CLONE_PARENT_SETTID)
- put_user_u32(ret, parent_tidptr);
} else {
ret = -1;
}
--
2.1.4
- [Qemu-devel] [PULL 14/26] linux-user: Use glib malloc functions in load_symbols(), (continued)
- [Qemu-devel] [PULL 14/26] linux-user: Use glib malloc functions in load_symbols(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 12/26] linux-user: Fix error handling in flatload.c target_pread(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 16/26] linux-user: ppc64: set MSR_CM bit for BookE 2.06 MMU, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 17/26] linux-user: Recheck for pending synchronous signals too, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 18/26] linux-user: Pass si_type information to queue_signal() explicitly, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 24/26] linux-user: Sanity check clone flags, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 19/26] linux-user: SIGSEGV on signal entry need not be fatal, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 20/26] linux-user: ARM: Give SIGSEGV if signal frame setup fails, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 21/26] linux-user: SIGSEGV from sigreturn need not be fatal, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 22/26] linux-user: Implement force_sigsegv() via force_sig(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 23/26] linux-user: Remove unnecessary nptl_flags variable from do_fork(),
riku . voipio <=
- [Qemu-devel] [PULL 25/26] linux-user: Fix incorrect offset of tuc_stack in ARM do_sigframe_return_v2, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 26/26] linux-user: fix TARGET_NR_select, riku . voipio, 2016/09/22
- Re: [Qemu-devel] [PULL 00/26] linux-user update, no-reply, 2016/09/22
- Re: [Qemu-devel] [PULL 00/26] linux-user update, Peter Maydell, 2016/09/22