aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 1d68f1255dd8..6d5dbb7a13e2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -817,17 +817,17 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
817static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 817static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
818{ 818{
819 struct signal_struct *sig; 819 struct signal_struct *sig;
820 int ret;
821 820
822 if (clone_flags & CLONE_THREAD) { 821 if (clone_flags & CLONE_THREAD) {
823 ret = thread_group_cputime_clone_thread(current); 822 atomic_inc(&current->signal->count);
824 if (likely(!ret)) { 823 atomic_inc(&current->signal->live);
825 atomic_inc(&current->signal->count); 824 return 0;
826 atomic_inc(&current->signal->live);
827 }
828 return ret;
829 } 825 }
830 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); 826 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
827
828 if (sig)
829 posix_cpu_timers_init_group(sig);
830
831 tsk->signal = sig; 831 tsk->signal = sig;
832 if (!sig) 832 if (!sig)
833 return -ENOMEM; 833 return -ENOMEM;
@@ -864,8 +864,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
864 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); 864 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
865 task_unlock(current->group_leader); 865 task_unlock(current->group_leader);
866 866
867 posix_cpu_timers_init_group(sig);
868
869 acct_init_pacct(&sig->pacct); 867 acct_init_pacct(&sig->pacct);
870 868
871 tty_audit_fork(sig); 869 tty_audit_fork(sig);
@@ -901,7 +899,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
901 clear_freeze_flag(p); 899 clear_freeze_flag(p);
902} 900}
903 901
904asmlinkage long sys_set_tid_address(int __user *tidptr) 902SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
905{ 903{
906 current->clear_child_tid = tidptr; 904 current->clear_child_tid = tidptr;
907 905
@@ -1007,6 +1005,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1007 * triggers too late. This doesn't hurt, the check is only there 1005 * triggers too late. This doesn't hurt, the check is only there
1008 * to stop root fork bombs. 1006 * to stop root fork bombs.
1009 */ 1007 */
1008 retval = -EAGAIN;
1010 if (nr_threads >= max_threads) 1009 if (nr_threads >= max_threads)
1011 goto bad_fork_cleanup_count; 1010 goto bad_fork_cleanup_count;
1012 1011
@@ -1603,7 +1602,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
1603 * constructed. Here we are modifying the current, active, 1602 * constructed. Here we are modifying the current, active,
1604 * task_struct. 1603 * task_struct.
1605 */ 1604 */
1606asmlinkage long sys_unshare(unsigned long unshare_flags) 1605SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1607{ 1606{
1608 int err = 0; 1607 int err = 0;
1609 struct fs_struct *fs, *new_fs = NULL; 1608 struct fs_struct *fs, *new_fs = NULL;