42859eea96
Pull generic execve() changes from Al Viro: "This introduces the generic kernel_thread() and kernel_execve() functions, and switches x86, arm, alpha, um and s390 over to them." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (26 commits) s390: convert to generic kernel_execve() s390: switch to generic kernel_thread() s390: fold kernel_thread_helper() into ret_from_fork() s390: fold execve_tail() into start_thread(), convert to generic sys_execve() um: switch to generic kernel_thread() x86, um/x86: switch to generic sys_execve and kernel_execve x86: split ret_from_fork alpha: introduce ret_from_kernel_execve(), switch to generic kernel_execve() alpha: switch to generic kernel_thread() alpha: switch to generic sys_execve() arm: get rid of execve wrapper, switch to generic execve() implementation arm: optimized current_pt_regs() arm: introduce ret_from_kernel_execve(), switch to generic kernel_execve() arm: split ret_from_fork, simplify kernel_thread() [based on patch by rmk] generic sys_execve() generic kernel_execve() new helper: current_pt_regs() preparation for generic kernel_thread() um: kill thread->forking um: let signal_delivered() do SIGTRAP on singlestepping into handler ...
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#include <linux/file.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/utsname.h>
|
|
#include <linux/syscalls.h>
|
|
#include <asm/current.h>
|
|
#include <asm/mman.h>
|
|
#include <asm/uaccess.h>
|
|
#include <asm/unistd.h>
|
|
|
|
long sys_fork(void)
|
|
{
|
|
return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs),
|
|
¤t->thread.regs, 0, NULL, NULL);
|
|
}
|
|
|
|
long sys_vfork(void)
|
|
{
|
|
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
|
|
UPT_SP(¤t->thread.regs.regs),
|
|
¤t->thread.regs, 0, NULL, NULL);
|
|
}
|
|
|
|
long sys_clone(unsigned long clone_flags, unsigned long newsp,
|
|
void __user *parent_tid, void __user *child_tid)
|
|
{
|
|
if (!newsp)
|
|
newsp = UPT_SP(¤t->thread.regs.regs);
|
|
|
|
return do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid,
|
|
child_tid);
|
|
}
|
|
|
|
long old_mmap(unsigned long addr, unsigned long len,
|
|
unsigned long prot, unsigned long flags,
|
|
unsigned long fd, unsigned long offset)
|
|
{
|
|
long err = -EINVAL;
|
|
if (offset & ~PAGE_MASK)
|
|
goto out;
|
|
|
|
err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
|
|
out:
|
|
return err;
|
|
}
|