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 989c7c202b3d..b9e2edd00726 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -800,6 +800,12 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
800 sig->cputime_expires.virt_exp = cputime_zero; 800 sig->cputime_expires.virt_exp = cputime_zero;
801 sig->cputime_expires.sched_exp = 0; 801 sig->cputime_expires.sched_exp = 0;
802 802
803 if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
804 sig->cputime_expires.prof_exp =
805 secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
806 sig->cputimer.running = 1;
807 }
808
803 /* The timer lists. */ 809 /* The timer lists. */
804 INIT_LIST_HEAD(&sig->cpu_timers[0]); 810 INIT_LIST_HEAD(&sig->cpu_timers[0]);
805 INIT_LIST_HEAD(&sig->cpu_timers[1]); 811 INIT_LIST_HEAD(&sig->cpu_timers[1]);
@@ -815,11 +821,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
815 atomic_inc(&current->signal->live); 821 atomic_inc(&current->signal->live);
816 return 0; 822 return 0;
817 } 823 }
818 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
819
820 if (sig)
821 posix_cpu_timers_init_group(sig);
822 824
825 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
823 tsk->signal = sig; 826 tsk->signal = sig;
824 if (!sig) 827 if (!sig)
825 return -ENOMEM; 828 return -ENOMEM;
@@ -859,6 +862,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
859 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); 862 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
860 task_unlock(current->group_leader); 863 task_unlock(current->group_leader);
861 864
865 posix_cpu_timers_init_group(sig);
866
862 acct_init_pacct(&sig->pacct); 867 acct_init_pacct(&sig->pacct);
863 868
864 tty_audit_fork(sig); 869 tty_audit_fork(sig);