2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
6 #include "linux/file.h"
9 #include "linux/sched.h"
10 #include "linux/utsname.h"
11 #include "asm/current.h"
13 #include "asm/uaccess.h"
14 #include "asm/unistd.h"
20 current
->thread
.forking
= 1;
21 ret
= do_fork(SIGCHLD
, UPT_SP(¤t
->thread
.regs
.regs
),
22 ¤t
->thread
.regs
, 0, NULL
, NULL
);
23 current
->thread
.forking
= 0;
31 current
->thread
.forking
= 1;
32 ret
= do_fork(CLONE_VFORK
| CLONE_VM
| SIGCHLD
,
33 UPT_SP(¤t
->thread
.regs
.regs
),
34 ¤t
->thread
.regs
, 0, NULL
, NULL
);
35 current
->thread
.forking
= 0;
39 /* common code for old and new mmaps */
40 long sys_mmap2(unsigned long addr
, unsigned long len
,
41 unsigned long prot
, unsigned long flags
,
42 unsigned long fd
, unsigned long pgoff
)
45 struct file
* file
= NULL
;
47 flags
&= ~(MAP_EXECUTABLE
| MAP_DENYWRITE
);
48 if (!(flags
& MAP_ANONYMOUS
)) {
54 down_write(¤t
->mm
->mmap_sem
);
55 error
= do_mmap_pgoff(file
, addr
, len
, prot
, flags
, pgoff
);
56 up_write(¤t
->mm
->mmap_sem
);
64 long old_mmap(unsigned long addr
, unsigned long len
,
65 unsigned long prot
, unsigned long flags
,
66 unsigned long fd
, unsigned long offset
)
69 if (offset
& ~PAGE_MASK
)
72 err
= sys_mmap2(addr
, len
, prot
, flags
, fd
, offset
>> PAGE_SHIFT
);
77 long sys_uname(struct old_utsname __user
* name
)
83 err
= copy_to_user(name
, utsname(), sizeof (*name
));
88 long sys_olduname(struct oldold_utsname __user
* name
)
94 if (!access_ok(VERIFY_WRITE
,name
,sizeof(struct oldold_utsname
)))
99 error
= __copy_to_user(&name
->sysname
, &utsname()->sysname
,
101 error
|= __put_user(0, name
->sysname
+ __OLD_UTS_LEN
);
102 error
|= __copy_to_user(&name
->nodename
, &utsname()->nodename
,
104 error
|= __put_user(0, name
->nodename
+ __OLD_UTS_LEN
);
105 error
|= __copy_to_user(&name
->release
, &utsname()->release
,
107 error
|= __put_user(0, name
->release
+ __OLD_UTS_LEN
);
108 error
|= __copy_to_user(&name
->version
, &utsname()->version
,
110 error
|= __put_user(0, name
->version
+ __OLD_UTS_LEN
);
111 error
|= __copy_to_user(&name
->machine
, &utsname()->machine
,
113 error
|= __put_user(0, name
->machine
+ __OLD_UTS_LEN
);
117 error
= error
? -EFAULT
: 0;
122 int kernel_execve(const char *filename
, char *const argv
[], char *const envp
[])
129 ret
= um_execve(filename
, argv
, envp
);