diff options
| author | Roland McGrath <roland@redhat.com> | 2005-03-07 18:17:29 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-07 18:17:29 -0800 |
| commit | d80d30ff8b9122aa51135e942e35566904f32ee5 (patch) | |
| tree | 3c285ba3ebe248e77f76321bcc82ac21d589b59f /kernel/fork.c | |
| parent | c1dcd6c2d9b7478baf876725bd356f1b19eeaa65 (diff) | |
[PATCH] make ITIMER_PROF, ITIMER_VIRTUAL per-process
POSIX requires that setitimer, getitimer, and alarm work on a per-process
basis. Currently, Linux implements these for individual threads. This patch
fixes these semantics for the ITIMER_PROF timer (which generates SIGPROF) and
the ITIMER_VIRTUAL timer (which generates SIGVTALRM), making them shared by
all threads in a process (thread group). This patch should be applied after
the one that fixes ITIMER_REAL.
The essential machinery for these timers is tied into the new posix-timers
code for process CPU clocks and timers. This patch requires the cputimers
patch and its dependencies.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index a1d1939f596c..37d6b4769965 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -745,6 +745,11 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts sig->real_timer.data = (unsigned long) tsk; init_timer(&sig->real_timer); + sig->it_virt_expires = cputime_zero; + sig->it_virt_incr = cputime_zero; + sig->it_prof_expires = cputime_zero; + sig->it_prof_incr = cputime_zero; + sig->tty = current->signal->tty; sig->pgrp = process_group(current); sig->session = current->signal->session; @@ -875,11 +880,6 @@ static task_t *copy_process(unsigned long clone_flags, clear_tsk_thread_flag(p, TIF_SIGPENDING); init_sigpending(&p->pending); - p->it_virt_value = cputime_zero; - p->it_virt_incr = cputime_zero; - p->it_prof_value = cputime_zero; - p->it_prof_incr = cputime_zero; - p->utime = cputime_zero; p->stime = cputime_zero; p->sched_time = 0; @@ -1028,7 +1028,11 @@ static task_t *copy_process(unsigned long clone_flags, set_tsk_thread_flag(p, TIF_SIGPENDING); } - if (!list_empty(¤t->signal->cpu_timers[0]) || + if (!cputime_eq(current->signal->it_virt_expires, + cputime_zero) || + !cputime_eq(current->signal->it_prof_expires, + cputime_zero) || + !list_empty(¤t->signal->cpu_timers[0]) || !list_empty(¤t->signal->cpu_timers[1]) || !list_empty(¤t->signal->cpu_timers[2])) { /* |
