x86, um: convert to saner kernel_execve() semantics
[cascardo/linux.git] / arch / um / kernel / syscall.c
1 /*
2  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3  * Licensed under the GPL
4  */
5
6 #include "linux/file.h"
7 #include "linux/fs.h"
8 #include "linux/mm.h"
9 #include "linux/sched.h"
10 #include "linux/utsname.h"
11 #include "linux/syscalls.h"
12 #include "asm/current.h"
13 #include "asm/mman.h"
14 #include "asm/uaccess.h"
15 #include "asm/unistd.h"
16
17 long sys_fork(void)
18 {
19         return do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
20                       &current->thread.regs, 0, NULL, NULL);
21 }
22
23 long sys_vfork(void)
24 {
25         return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
26                       UPT_SP(&current->thread.regs.regs),
27                       &current->thread.regs, 0, NULL, NULL);
28 }
29
30 long sys_clone(unsigned long clone_flags, unsigned long newsp,
31                void __user *parent_tid, void __user *child_tid)
32 {
33         if (!newsp)
34                 newsp = UPT_SP(&current->thread.regs.regs);
35
36         return do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
37                       child_tid);
38 }
39
40 long old_mmap(unsigned long addr, unsigned long len,
41               unsigned long prot, unsigned long flags,
42               unsigned long fd, unsigned long offset)
43 {
44         long err = -EINVAL;
45         if (offset & ~PAGE_MASK)
46                 goto out;
47
48         err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
49  out:
50         return err;
51 }