]>
Commit | Line | Data |
---|---|---|
1d3468a6 | 1 | /* |
ba180fd4 | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
1da177e4 LT |
3 | * Licensed under the GPL |
4 | */ | |
5 | ||
1da177e4 | 6 | #include "linux/file.h" |
4e950f6f | 7 | #include "linux/fs.h" |
ba180fd4 JD |
8 | #include "linux/mm.h" |
9 | #include "linux/sched.h" | |
1da177e4 | 10 | #include "linux/utsname.h" |
f8b72560 | 11 | #include "linux/syscalls.h" |
ba180fd4 | 12 | #include "asm/current.h" |
1da177e4 LT |
13 | #include "asm/mman.h" |
14 | #include "asm/uaccess.h" | |
ba180fd4 | 15 | #include "asm/unistd.h" |
ff64b4c1 | 16 | #include "internal.h" |
1da177e4 | 17 | |
1da177e4 LT |
18 | long sys_fork(void) |
19 | { | |
d2ce4e92 | 20 | return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
e0877f07 | 21 | ¤t->thread.regs, 0, NULL, NULL); |
1da177e4 LT |
22 | } |
23 | ||
24 | long sys_vfork(void) | |
25 | { | |
d2ce4e92 | 26 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
e0877f07 JD |
27 | UPT_SP(¤t->thread.regs.regs), |
28 | ¤t->thread.regs, 0, NULL, NULL); | |
d2ce4e92 AV |
29 | } |
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); | |
1da177e4 LT |
39 | } |
40 | ||
1da177e4 LT |
41 | long old_mmap(unsigned long addr, unsigned long len, |
42 | unsigned long prot, unsigned long flags, | |
43 | unsigned long fd, unsigned long offset) | |
44 | { | |
45 | long err = -EINVAL; | |
46 | if (offset & ~PAGE_MASK) | |
47 | goto out; | |
48 | ||
f8b72560 | 49 | err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); |
1da177e4 LT |
50 | out: |
51 | return err; | |
52 | } | |
1da177e4 | 53 | |
d7627467 DH |
54 | int kernel_execve(const char *filename, |
55 | const char *const argv[], | |
56 | const char *const envp[]) | |
3db03b4a AB |
57 | { |
58 | mm_segment_t fs; | |
59 | int ret; | |
60 | ||
61 | fs = get_fs(); | |
62 | set_fs(KERNEL_DS); | |
cb1dcc0f RW |
63 | ret = um_execve(filename, (const char __user *const __user *)argv, |
64 | (const char __user *const __user *) envp); | |
3db03b4a AB |
65 | set_fs(fs); |
66 | ||
67 | return ret; | |
68 | } |