mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Fix clock_gettime with CLOCK_PROCESS_CPUTIME_ID
@ 2008-11-24 14:46 Petr Tesarik
  2008-11-24 15:32 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Tesarik @ 2008-11-24 14:46 UTC (permalink / raw)
  To: LKML, Thomas Gleixner

Since CLOCK_PROCESS_CPUTIME_ID is in fact translated to -6, the switch
statement in cpu_clock_sample_group() must first mask off the irrelevant
bits, similar to cpu_clock_sample().

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>

--
 posix-cpu-timers.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -311,7 +311,7 @@ static int cpu_clock_sample_group(const clockid_t which_clock,
 	struct task_cputime cputime;
 
 	thread_group_cputime(p, &cputime);
-	switch (which_clock) {
+	switch (CPUCLOCK_WHICH(which_clock)) {
 	default:
 		return -EINVAL;
 	case CPUCLOCK_PROF:



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix clock_gettime with CLOCK_PROCESS_CPUTIME_ID
  2008-11-24 14:46 Fix clock_gettime with CLOCK_PROCESS_CPUTIME_ID Petr Tesarik
@ 2008-11-24 15:32 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2008-11-24 15:32 UTC (permalink / raw)
  To: Petr Tesarik; +Cc: LKML, Oleg Nesterov, Roland McGrath

On Mon, 24 Nov 2008, Petr Tesarik wrote:

> Since CLOCK_PROCESS_CPUTIME_ID is in fact translated to -6, the switch
> statement in cpu_clock_sample_group() must first mask off the irrelevant
> bits, similar to cpu_clock_sample().
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.cz>

Good catch. Applied.

Thanks,

	tglx

> --
>  posix-cpu-timers.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
> --- a/kernel/posix-cpu-timers.c
> +++ b/kernel/posix-cpu-timers.c
> @@ -311,7 +311,7 @@ static int cpu_clock_sample_group(const clockid_t which_clock,
>  	struct task_cputime cputime;
>  
>  	thread_group_cputime(p, &cputime);
> -	switch (which_clock) {
> +	switch (CPUCLOCK_WHICH(which_clock)) {
>  	default:
>  		return -EINVAL;
>  	case CPUCLOCK_PROF:
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-24 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-24 14:46 Fix clock_gettime with CLOCK_PROCESS_CPUTIME_ID Petr Tesarik
2008-11-24 15:32 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®