2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
6 #include "linux/sched.h"
7 #include "linux/file.h"
8 #include "linux/smp_lock.h"
10 #include "linux/utsname.h"
11 #include "linux/msg.h"
12 #include "linux/shm.h"
13 #include "linux/sys.h"
14 #include "linux/syscalls.h"
15 #include "linux/unistd.h"
16 #include "linux/slab.h"
17 #include "linux/utime.h"
18 #include <linux/vs_base.h>
19 #include <linux/vs_cvirt.h>
22 #include "asm/uaccess.h"
23 #include "kern_util.h"
24 #include "user_util.h"
25 #include "sysdep/syscalls.h"
26 #include "mode_kern.h"
27 #include "choose-mode.h"
29 /* Unlocked, I don't care if this is a bit off */
36 current->thread.forking = 1;
37 ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs),
38 ¤t->thread.regs, 0, NULL, NULL);
39 current->thread.forking = 0;
47 current->thread.forking = 1;
48 ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
49 UPT_SP(¤t->thread.regs.regs),
50 ¤t->thread.regs, 0, NULL, NULL);
51 current->thread.forking = 0;
55 /* common code for old and new mmaps */
56 long sys_mmap2(unsigned long addr, unsigned long len,
57 unsigned long prot, unsigned long flags,
58 unsigned long fd, unsigned long pgoff)
61 struct file * file = NULL;
63 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
64 if (!(flags & MAP_ANONYMOUS)) {
70 down_write(¤t->mm->mmap_sem);
71 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
72 up_write(¤t->mm->mmap_sem);
80 long old_mmap(unsigned long addr, unsigned long len,
81 unsigned long prot, unsigned long flags,
82 unsigned long fd, unsigned long offset)
85 if (offset & ~PAGE_MASK)
88 err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
93 * sys_pipe() is the normal C calling standard for creating
94 * a pipe. It's not the way unix traditionally does this, though.
96 long sys_pipe(unsigned long __user * fildes)
103 if (copy_to_user(fildes, fd, sizeof(fd)))
110 long sys_uname(struct old_utsname __user * name)
116 err = copy_to_user(name, vx_new_utsname(), sizeof (*name));
118 return err?-EFAULT:0;
121 long sys_olduname(struct oldold_utsname __user * name)
124 struct new_utsname *ptr;
128 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
133 ptr = vx_new_utsname();
134 error = __copy_to_user(&name->sysname,ptr->sysname,
136 error |= __put_user(0,name->sysname+__OLD_UTS_LEN);
137 error |= __copy_to_user(&name->nodename,ptr->nodename,
139 error |= __put_user(0,name->nodename+__OLD_UTS_LEN);
140 error |= __copy_to_user(&name->release,ptr->release,
142 error |= __put_user(0,name->release+__OLD_UTS_LEN);
143 error |= __copy_to_user(&name->version,ptr->version,
145 error |= __put_user(0,name->version+__OLD_UTS_LEN);
146 error |= __copy_to_user(&name->machine,ptr->machine,
148 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
152 error = error ? -EFAULT : 0;
157 DEFINE_SPINLOCK(syscall_lock);
159 static int syscall_index = 0;
161 int next_syscall_index(int limit)
165 spin_lock(&syscall_lock);
167 if(++syscall_index == limit)
169 spin_unlock(&syscall_lock);