blob: a81f3705e90f6e23448ab827c5e980fa8306d9e6 [file] [log] [blame]
Jeff Dike1d3468a2006-07-10 04:45:13 -07001/*
Jeff Dikeba180fd2007-10-16 01:27:00 -07002 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Licensed under the GPL
4 */
5
Al Viro37185b32012-10-08 03:27:32 +01006#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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017long sys_fork(void)
18{
Al Virod2ce4e92012-09-20 09:28:25 -040019 return do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
Jeff Dikee0877f02005-06-25 14:55:21 -070020 &current->thread.regs, 0, NULL, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070021}
22
23long sys_vfork(void)
24{
Al Virod2ce4e92012-09-20 09:28:25 -040025 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
Jeff Dikee0877f02005-06-25 14:55:21 -070026 UPT_SP(&current->thread.regs.regs),
27 &current->thread.regs, 0, NULL, NULL);
Al Virod2ce4e92012-09-20 09:28:25 -040028}
29
30long 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);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040long 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
Al Virof8b72562009-11-30 17:37:04 -050048 err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 out:
50 return err;
51}