diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-23 13:17:59 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-28 21:49:04 -0500 |
| commit | d2125043aebf7f53cd1c72115c17b01d0bc06ce1 (patch) | |
| tree | e6d510a22905d870a612660c2da0bdb6e36bc7e6 /kernel | |
| parent | 25906730ec01be664534c9439d7cf5a373e8a4e4 (diff) | |
generic sys_fork / sys_vfork / sys_clone
... and get rid of idiotic struct pt_regs * in asm-generic/syscalls.h
prototypes of the same, while we are at it. Eventually we want those
in linux/syscalls.h, of course, but that'll have to wait a bit.
Note that there are *three* variants of sys_clone() order of arguments.
Braindamage galore...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 8b20ab7d3aa..27a337549da 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -1645,6 +1645,49 @@ pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | |||
| 1645 | } | 1645 | } |
| 1646 | #endif | 1646 | #endif |
| 1647 | 1647 | ||
| 1648 | #ifdef __ARCH_WANT_SYS_FORK | ||
| 1649 | SYSCALL_DEFINE0(fork) | ||
| 1650 | { | ||
| 1651 | #ifdef CONFIG_MMU | ||
| 1652 | return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL); | ||
| 1653 | #else | ||
| 1654 | /* can not support in nommu mode */ | ||
| 1655 | return(-EINVAL); | ||
| 1656 | #endif | ||
| 1657 | } | ||
| 1658 | #endif | ||
| 1659 | |||
| 1660 | #ifdef __ARCH_WANT_SYS_VFORK | ||
| 1661 | SYSCALL_DEFINE0(vfork) | ||
| 1662 | { | ||
| 1663 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, current_pt_regs(), | ||
| 1664 | 0, NULL, NULL); | ||
| 1665 | } | ||
| 1666 | #endif | ||
| 1667 | |||
| 1668 | #ifdef __ARCH_WANT_SYS_CLONE | ||
| 1669 | #ifdef CONFIG_CLONE_BACKWARDS | ||
| 1670 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | ||
| 1671 | int __user *, parent_tidptr, | ||
| 1672 | int, tls_val, | ||
| 1673 | int __user *, child_tidptr) | ||
| 1674 | #elif defined(CONFIG_CLONE_BACKWARDS2) | ||
| 1675 | SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags, | ||
| 1676 | int __user *, parent_tidptr, | ||
| 1677 | int __user *, child_tidptr, | ||
| 1678 | int, tls_val) | ||
| 1679 | #else | ||
| 1680 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | ||
| 1681 | int __user *, parent_tidptr, | ||
| 1682 | int __user *, child_tidptr, | ||
| 1683 | int, tls_val) | ||
| 1684 | #endif | ||
| 1685 | { | ||
| 1686 | return do_fork(clone_flags, newsp, current_pt_regs(), 0, | ||
| 1687 | parent_tidptr, child_tidptr); | ||
| 1688 | } | ||
| 1689 | #endif | ||
| 1690 | |||
| 1648 | #ifndef ARCH_MIN_MMSTRUCT_ALIGN | 1691 | #ifndef ARCH_MIN_MMSTRUCT_ALIGN |
| 1649 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | 1692 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 |
| 1650 | #endif | 1693 | #endif |
