aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 4854c2c4a82e..9b51a1b190d4 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -808,6 +808,12 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
808 sig->cputime_expires.virt_exp = cputime_zero; 808 sig->cputime_expires.virt_exp = cputime_zero;
809 sig->cputime_expires.sched_exp = 0; 809 sig->cputime_expires.sched_exp = 0;
810 810
811 if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
812 sig->cputime_expires.prof_exp =
813 secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
814 sig->cputimer.running = 1;
815 }
816
811 /* The timer lists. */ 817 /* The timer lists. */
812 INIT_LIST_HEAD(&sig->cpu_timers[0]); 818 INIT_LIST_HEAD(&sig->cpu_timers[0]);
813 INIT_LIST_HEAD(&sig->cpu_timers[1]); 819 INIT_LIST_HEAD(&sig->cpu_timers[1]);
@@ -823,11 +829,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
823 atomic_inc(&current->signal->live); 829 atomic_inc(&current->signal->live);
824 return 0; 830 return 0;
825 } 831 }
826 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
827
828 if (sig)
829 posix_cpu_timers_init_group(sig);
830 832
833 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
831 tsk->signal = sig; 834 tsk->signal = sig;
832 if (!sig) 835 if (!sig)
833 return -ENOMEM; 836 return -ENOMEM;
@@ -865,6 +868,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
865 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); 868 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
866 task_unlock(current->group_leader); 869 task_unlock(current->group_leader);
867 870
871 posix_cpu_timers_init_group(sig);
872
868 acct_init_pacct(&sig->pacct); 873 acct_init_pacct(&sig->pacct);
869 874
870 tty_audit_fork(sig); 875 tty_audit_fork(sig);