From d80d30ff8b9122aa51135e942e35566904f32ee5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 7 Mar 2005 18:17:29 -0800 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/posix-timers.h | 2 ++ include/linux/sched.h | 6 ++++-- include/linux/signal.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 2820fd4ab58b..f942e2bad8e3 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -133,5 +133,7 @@ void run_posix_cpu_timers(struct task_struct *); void posix_cpu_timers_exit(struct task_struct *); void posix_cpu_timers_exit_group(struct task_struct *); +void set_process_cpu_timer(struct task_struct *, unsigned int, + cputime_t *, cputime_t *); #endif diff --git a/include/linux/sched.h b/include/linux/sched.h index 5fe77e2927af..cf90d1ed1a1f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -305,6 +305,10 @@ struct signal_struct { struct timer_list real_timer; unsigned long it_real_value, it_real_incr; + /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ + cputime_t it_prof_expires, it_virt_expires; + cputime_t it_prof_incr, it_virt_incr; + /* job control IDs */ pid_t pgrp; pid_t tty_old_pgrp; @@ -609,8 +613,6 @@ struct task_struct { int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ unsigned long rt_priority; - cputime_t it_virt_value, it_virt_incr; - cputime_t it_prof_value, it_prof_incr; cputime_t utime, stime; unsigned long nvcsw, nivcsw; /* context switch counts */ struct timespec start_time; diff --git a/include/linux/signal.h b/include/linux/signal.h index e5f3d83ab215..3d8bf1afdb51 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -212,6 +212,7 @@ static inline void init_sigpending(struct sigpending *sig) } extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); +extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); extern long do_sigpending(void __user *, unsigned long); extern int sigprocmask(int, sigset_t *, sigset_t *); -- cgit v1.2.3