bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH gnumach] Fix task_info for TASK_THREAD_TIMES_INFO.


From: Samuel Thibault
Subject: Re: [PATCH gnumach] Fix task_info for TASK_THREAD_TIMES_INFO.
Date: Wed, 17 May 2023 19:25:06 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le mar. 16 mai 2023 23:01:01 -0400, a ecrit:
> We are checking for the existence of time_value64_t but we didn't add
> that to the task_thread_times_info structure.
> ---
>  include/mach/task_info.h | 6 ++++++
>  kern/task.c              | 8 +++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/include/mach/task_info.h b/include/mach/task_info.h
> index 2631b04e..0e048c5e 100644
> --- a/include/mach/task_info.h
> +++ b/include/mach/task_info.h
> @@ -97,10 +97,16 @@ typedef struct task_events_info           
> *task_events_info_t;
>                                          only accurate if suspended */
>  
>  struct task_thread_times_info {
> +     /* Deprecated, please use user_time64 */
>       rpc_time_value_t        user_time;      /* total user run time for
>                                          live threads */
> +     /* Deprecated, please use system_time64 */
>       rpc_time_value_t        system_time;    /* total system run time for
>                                          live threads */
> +     time_value64_t          user_time64;    /* total user run time for
> +                                                live threads */
> +     time_value64_t          system_time64;  /* total system run time for
> +                                                live threads */
>  };
>  
>  typedef struct task_thread_times_info        task_thread_times_info_data_t;
> diff --git a/kern/task.c b/kern/task.c
> index 9492b448..60ab4d73 100644
> --- a/kern/task.c
> +++ b/kern/task.c
> @@ -887,8 +887,14 @@ kern_return_t task_info(
>               task_unlock(task);
>               TIME_VALUE64_TO_TIME_VALUE(&acc_user_time, 
> &times_info->user_time);
>               TIME_VALUE64_TO_TIME_VALUE(&acc_system_time, 
> &times_info->system_time);
> +             if (*task_info_count >= TASK_THREAD_TIMES_INFO_COUNT) {
> +                 /* Copy new time_value64_t fields */
> +                 times_info->user_time64 = acc_user_time;
> +                 times_info->system_time64 = acc_system_time;
> +             }
>  
> -             *task_info_count = TASK_THREAD_TIMES_INFO_COUNT;
> +             if (*task_info_count > TASK_THREAD_TIMES_INFO_COUNT)
> +               *task_info_count = TASK_THREAD_TIMES_INFO_COUNT;
>               break;
>           }
>  
> -- 
> 2.39.2
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]