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/x86/um | |
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/x86/um')
-rw-r--r-- | arch/x86/um/shared/sysdep/syscalls.h | 2 | ||||
-rw-r--r-- | arch/x86/um/sys_call_table_32.c | 2 | ||||
-rw-r--r-- | arch/x86/um/syscalls_32.c | 27 | ||||
-rw-r--r-- | arch/x86/um/syscalls_64.c | 23 |
4 files changed, 13 insertions, 41 deletions
diff --git a/arch/x86/um/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls.h index bd9a89b67e41..ca255a805ed9 100644 --- a/arch/x86/um/shared/sysdep/syscalls.h +++ b/arch/x86/um/shared/sysdep/syscalls.h | |||
@@ -1,3 +1,5 @@ | |||
1 | extern long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
2 | void __user *parent_tid, void __user *child_tid); | ||
1 | #ifdef __i386__ | 3 | #ifdef __i386__ |
2 | #include "syscalls_32.h" | 4 | #include "syscalls_32.h" |
3 | #else | 5 | #else |
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c index 68d1dc91b37b..b5408cecac6c 100644 --- a/arch/x86/um/sys_call_table_32.c +++ b/arch/x86/um/sys_call_table_32.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define ptregs_execve sys_execve | 28 | #define ptregs_execve sys_execve |
29 | #define ptregs_iopl sys_iopl | 29 | #define ptregs_iopl sys_iopl |
30 | #define ptregs_vm86old sys_vm86old | 30 | #define ptregs_vm86old sys_vm86old |
31 | #define ptregs_clone sys_clone | 31 | #define ptregs_clone i386_clone |
32 | #define ptregs_vm86 sys_vm86 | 32 | #define ptregs_vm86 sys_vm86 |
33 | #define ptregs_sigaltstack sys_sigaltstack | 33 | #define ptregs_sigaltstack sys_sigaltstack |
34 | #define ptregs_vfork sys_vfork | 34 | #define ptregs_vfork sys_vfork |
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c index b853e8600b9d..db444c7218fe 100644 --- a/arch/x86/um/syscalls_32.c +++ b/arch/x86/um/syscalls_32.c | |||
@@ -3,37 +3,24 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sched.h" | 6 | #include <linux/syscalls.h> |
7 | #include "linux/shm.h" | 7 | #include <sysdep/syscalls.h> |
8 | #include "linux/ipc.h" | ||
9 | #include "linux/syscalls.h" | ||
10 | #include "asm/mman.h" | ||
11 | #include "asm/uaccess.h" | ||
12 | #include "asm/unistd.h" | ||
13 | 8 | ||
14 | /* | 9 | /* |
15 | * The prototype on i386 is: | 10 | * The prototype on i386 is: |
16 | * | 11 | * |
17 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) | 12 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls |
18 | * | 13 | * |
19 | * and the "newtls" arg. on i386 is read by copy_thread directly from the | 14 | * and the "newtls" arg. on i386 is read by copy_thread directly from the |
20 | * register saved on the stack. | 15 | * register saved on the stack. |
21 | */ | 16 | */ |
22 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | 17 | long i386_clone(unsigned long clone_flags, unsigned long newsp, |
23 | int __user *parent_tid, void *newtls, int __user *child_tid) | 18 | int __user *parent_tid, void *newtls, int __user *child_tid) |
24 | { | 19 | { |
25 | long ret; | 20 | return sys_clone(clone_flags, newsp, parent_tid, child_tid); |
26 | |||
27 | if (!newsp) | ||
28 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
29 | |||
30 | current->thread.forking = 1; | ||
31 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
32 | child_tid); | ||
33 | current->thread.forking = 0; | ||
34 | return ret; | ||
35 | } | 21 | } |
36 | 22 | ||
23 | |||
37 | long sys_sigaction(int sig, const struct old_sigaction __user *act, | 24 | long sys_sigaction(int sig, const struct old_sigaction __user *act, |
38 | struct old_sigaction __user *oact) | 25 | struct old_sigaction __user *oact) |
39 | { | 26 | { |
diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c index f3d82bb6e15a..adb08eb5c22a 100644 --- a/arch/x86/um/syscalls_64.c +++ b/arch/x86/um/syscalls_64.c | |||
@@ -5,12 +5,9 @@ | |||
5 | * Licensed under the GPL | 5 | * Licensed under the GPL |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "linux/linkage.h" | 8 | #include <linux/sched.h> |
9 | #include "linux/personality.h" | 9 | #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
10 | #include "linux/utsname.h" | 10 | #include <os.h> |
11 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ | ||
12 | #include "asm/uaccess.h" | ||
13 | #include "os.h" | ||
14 | 11 | ||
15 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) | 12 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
16 | { | 13 | { |
@@ -79,20 +76,6 @@ long sys_arch_prctl(int code, unsigned long addr) | |||
79 | return arch_prctl(current, code, (unsigned long __user *) addr); | 76 | return arch_prctl(current, code, (unsigned long __user *) addr); |
80 | } | 77 | } |
81 | 78 | ||
82 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
83 | void __user *parent_tid, void __user *child_tid) | ||
84 | { | ||
85 | long ret; | ||
86 | |||
87 | if (!newsp) | ||
88 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
89 | current->thread.forking = 1; | ||
90 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
91 | child_tid); | ||
92 | current->thread.forking = 0; | ||
93 | return ret; | ||
94 | } | ||
95 | |||
96 | void arch_switch_to(struct task_struct *to) | 79 | void arch_switch_to(struct task_struct *to) |
97 | { | 80 | { |
98 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) | 81 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) |