diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bf582f75014b..3b5dcf9a66aa 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -820,17 +820,17 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) | |||
820 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | 820 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) |
821 | { | 821 | { |
822 | struct signal_struct *sig; | 822 | struct signal_struct *sig; |
823 | int ret; | ||
824 | 823 | ||
825 | if (clone_flags & CLONE_THREAD) { | 824 | if (clone_flags & CLONE_THREAD) { |
826 | ret = thread_group_cputime_clone_thread(current); | 825 | atomic_inc(¤t->signal->count); |
827 | if (likely(!ret)) { | 826 | atomic_inc(¤t->signal->live); |
828 | atomic_inc(¤t->signal->count); | 827 | return 0; |
829 | atomic_inc(¤t->signal->live); | ||
830 | } | ||
831 | return ret; | ||
832 | } | 828 | } |
833 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); | 829 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); |
830 | |||
831 | if (sig) | ||
832 | posix_cpu_timers_init_group(sig); | ||
833 | |||
834 | tsk->signal = sig; | 834 | tsk->signal = sig; |
835 | if (!sig) | 835 | if (!sig) |
836 | return -ENOMEM; | 836 | return -ENOMEM; |
@@ -854,21 +854,20 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
854 | sig->tty_old_pgrp = NULL; | 854 | sig->tty_old_pgrp = NULL; |
855 | sig->tty = NULL; | 855 | sig->tty = NULL; |
856 | 856 | ||
857 | sig->cutime = sig->cstime = cputime_zero; | 857 | sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero; |
858 | sig->gtime = cputime_zero; | 858 | sig->gtime = cputime_zero; |
859 | sig->cgtime = cputime_zero; | 859 | sig->cgtime = cputime_zero; |
860 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; | 860 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; |
861 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; | 861 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; |
862 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; | 862 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; |
863 | task_io_accounting_init(&sig->ioac); | 863 | task_io_accounting_init(&sig->ioac); |
864 | sig->sum_sched_runtime = 0; | ||
864 | taskstats_tgid_init(sig); | 865 | taskstats_tgid_init(sig); |
865 | 866 | ||
866 | task_lock(current->group_leader); | 867 | task_lock(current->group_leader); |
867 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); | 868 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); |
868 | task_unlock(current->group_leader); | 869 | task_unlock(current->group_leader); |
869 | 870 | ||
870 | posix_cpu_timers_init_group(sig); | ||
871 | |||
872 | acct_init_pacct(&sig->pacct); | 871 | acct_init_pacct(&sig->pacct); |
873 | 872 | ||
874 | tty_audit_fork(sig); | 873 | tty_audit_fork(sig); |
@@ -904,7 +903,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p) | |||
904 | clear_freeze_flag(p); | 903 | clear_freeze_flag(p); |
905 | } | 904 | } |
906 | 905 | ||
907 | asmlinkage long sys_set_tid_address(int __user *tidptr) | 906 | SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr) |
908 | { | 907 | { |
909 | current->clear_child_tid = tidptr; | 908 | current->clear_child_tid = tidptr; |
910 | 909 | ||
@@ -1010,6 +1009,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1010 | * triggers too late. This doesn't hurt, the check is only there | 1009 | * triggers too late. This doesn't hurt, the check is only there |
1011 | * to stop root fork bombs. | 1010 | * to stop root fork bombs. |
1012 | */ | 1011 | */ |
1012 | retval = -EAGAIN; | ||
1013 | if (nr_threads >= max_threads) | 1013 | if (nr_threads >= max_threads) |
1014 | goto bad_fork_cleanup_count; | 1014 | goto bad_fork_cleanup_count; |
1015 | 1015 | ||
@@ -1093,7 +1093,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1093 | #ifdef CONFIG_DEBUG_MUTEXES | 1093 | #ifdef CONFIG_DEBUG_MUTEXES |
1094 | p->blocked_on = NULL; /* not blocked yet */ | 1094 | p->blocked_on = NULL; /* not blocked yet */ |
1095 | #endif | 1095 | #endif |
1096 | if (unlikely(ptrace_reparented(current))) | 1096 | if (unlikely(current->ptrace)) |
1097 | ptrace_fork(p, clone_flags); | 1097 | ptrace_fork(p, clone_flags); |
1098 | 1098 | ||
1099 | /* Perform scheduler related setup. Assign this task to a CPU. */ | 1099 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
@@ -1601,7 +1601,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp | |||
1601 | * constructed. Here we are modifying the current, active, | 1601 | * constructed. Here we are modifying the current, active, |
1602 | * task_struct. | 1602 | * task_struct. |
1603 | */ | 1603 | */ |
1604 | asmlinkage long sys_unshare(unsigned long unshare_flags) | 1604 | SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) |
1605 | { | 1605 | { |
1606 | int err = 0; | 1606 | int err = 0; |
1607 | struct fs_struct *fs, *new_fs = NULL; | 1607 | struct fs_struct *fs, *new_fs = NULL; |