diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-20 09:28:25 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2012-09-27 12:04:55 -0400 |
commit | d2ce4e92fa4f79a5fdb4cc912b411280afe21697 (patch) | |
tree | d7b1cae518d150b30342cef8dfa1a76e82005d25 /arch/um/kernel | |
parent | f9a38eace4498a5e9f6d2cdfc879d5444edc3a5f (diff) |
um: kill thread->forking
we only use that to tell copy_thread() done by syscall from that
done by kernel_thread(). However, it's easier to do simply by
checking PF_KTHREAD in thread flags.
Merge sys_clone() guts for 32bit and 64bit, while we are at it...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/process.c | 8 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 57fc7028714..c5f5afa5074 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -181,11 +181,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
181 | struct pt_regs *regs) | 181 | struct pt_regs *regs) |
182 | { | 182 | { |
183 | void (*handler)(void); | 183 | void (*handler)(void); |
184 | int kthread = current->flags & PF_KTHREAD; | ||
184 | int ret = 0; | 185 | int ret = 0; |
185 | 186 | ||
186 | p->thread = (struct thread_struct) INIT_THREAD; | 187 | p->thread = (struct thread_struct) INIT_THREAD; |
187 | 188 | ||
188 | if (current->thread.forking) { | 189 | if (!kthread) { |
189 | memcpy(&p->thread.regs.regs, ®s->regs, | 190 | memcpy(&p->thread.regs.regs, ®s->regs, |
190 | sizeof(p->thread.regs.regs)); | 191 | sizeof(p->thread.regs.regs)); |
191 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); | 192 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); |
@@ -195,8 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
195 | handler = fork_handler; | 196 | handler = fork_handler; |
196 | 197 | ||
197 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | 198 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
198 | } | 199 | } else { |
199 | else { | ||
200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); | 200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); |
201 | p->thread.request.u.thread = current->thread.request.u.thread; | 201 | p->thread.request.u.thread = current->thread.request.u.thread; |
202 | handler = new_thread_handler; | 202 | handler = new_thread_handler; |
@@ -204,7 +204,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
204 | 204 | ||
205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); | 205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); |
206 | 206 | ||
207 | if (current->thread.forking) { | 207 | if (!kthread) { |
208 | clear_flushed_tls(p); | 208 | clear_flushed_tls(p); |
209 | 209 | ||
210 | /* | 210 | /* |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index f958cb876ee..a4c6d8eee74 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -17,25 +17,25 @@ | |||
17 | 17 | ||
18 | long sys_fork(void) | 18 | long sys_fork(void) |
19 | { | 19 | { |
20 | long ret; | 20 | return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
21 | |||
22 | current->thread.forking = 1; | ||
23 | ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), | ||
24 | ¤t->thread.regs, 0, NULL, NULL); | 21 | ¤t->thread.regs, 0, NULL, NULL); |
25 | current->thread.forking = 0; | ||
26 | return ret; | ||
27 | } | 22 | } |
28 | 23 | ||
29 | long sys_vfork(void) | 24 | long sys_vfork(void) |
30 | { | 25 | { |
31 | long ret; | 26 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
32 | |||
33 | current->thread.forking = 1; | ||
34 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | ||
35 | UPT_SP(¤t->thread.regs.regs), | 27 | UPT_SP(¤t->thread.regs.regs), |
36 | ¤t->thread.regs, 0, NULL, NULL); | 28 | ¤t->thread.regs, 0, NULL, NULL); |
37 | current->thread.forking = 0; | 29 | } |
38 | return ret; | 30 | |
31 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
32 | void __user *parent_tid, void __user *child_tid) | ||
33 | { | ||
34 | if (!newsp) | ||
35 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
36 | |||
37 | return do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
38 | child_tid); | ||
39 | } | 39 | } |
40 | 40 | ||
41 | long old_mmap(unsigned long addr, unsigned long len, | 41 | long old_mmap(unsigned long addr, unsigned long len, |