[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH hurd] Use rpc_time_value_t in user space to avoid build error
From: |
Samuel Thibault |
Subject: |
Re: [PATCH hurd] Use rpc_time_value_t in user space to avoid build errors |
Date: |
Sun, 12 Feb 2023 23:05:12 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Flavio Cruz, le dim. 12 févr. 2023 16:54:52 -0500, a ecrit:
> rpc_time_value_t was introduced in
> https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=5fdc928d3d29fdc93ad00cea5f5c877a19013d44
> but it breaks the build.
Argl, I was wondering a bit about whether exposing rpc_ names could
pose problem, and for structures it makes them incompatible indeed. But
actually in userland we don't have any difference between the two, it's
only C that refuses the compatibility.
I'd say we'd rather avoid such flag-day issue and make the kernel header
use rpc_* only #if KERNEL?
> This change fixes it.
> ---
> libps/spec.c | 8 ++++----
> procfs/process.c | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libps/spec.c b/libps/spec.c
> index adca2e9c..38ececc1 100644
> --- a/libps/spec.c
> +++ b/libps/spec.c
> @@ -198,7 +198,7 @@ const struct ps_getter ps_max_priority_getter =
> static void
> ps_get_usr_time (struct proc_stat *ps, struct timeval *tv)
> {
> - time_value_t tvt = proc_stat_thread_basic_info (ps)->user_time;
> + rpc_time_value_t tvt = proc_stat_thread_basic_info (ps)->user_time;
> tv->tv_sec = tvt.seconds;
> tv->tv_usec = tvt.microseconds;
> }
> @@ -208,7 +208,7 @@ const struct ps_getter ps_usr_time_getter =
> static void
> ps_get_sys_time (struct proc_stat *ps, struct timeval *tv)
> {
> - time_value_t tvt = proc_stat_thread_basic_info (ps)->system_time;
> + rpc_time_value_t tvt = proc_stat_thread_basic_info (ps)->system_time;
> tv->tv_sec = tvt.seconds;
> tv->tv_usec = tvt.microseconds;
> }
> @@ -218,7 +218,7 @@ const struct ps_getter ps_sys_time_getter =
> static void
> ps_get_tot_time (struct proc_stat *ps, struct timeval *tv)
> {
> - time_value_t tvt = proc_stat_thread_basic_info (ps)->user_time;
> + rpc_time_value_t tvt = proc_stat_thread_basic_info (ps)->user_time;
> time_value_add (&tvt, &proc_stat_thread_basic_info (ps)->system_time);
> tv->tv_sec = tvt.seconds;
> tv->tv_usec = tvt.microseconds;
> @@ -229,7 +229,7 @@ const struct ps_getter ps_tot_time_getter =
> static void
> ps_get_start_time (struct proc_stat *ps, struct timeval *tv)
> {
> - time_value_t *const tvt = &proc_stat_task_basic_info (ps)->creation_time;
> + rpc_time_value_t *const tvt = &proc_stat_task_basic_info
> (ps)->creation_time;
> tv->tv_sec = tvt->seconds;
> tv->tv_usec = tvt->microseconds;
> }
> diff --git a/procfs/process.c b/procfs/process.c
> index f608bed6..0ae01db7 100644
> --- a/procfs/process.c
> +++ b/procfs/process.c
> @@ -75,7 +75,7 @@ static const char *state_string (struct proc_stat *ps)
> return "? (unknown)";
> }
>
> -static long long int timeval_jiffies (time_value_t tv)
> +static long long int timeval_jiffies (rpc_time_value_t tv)
> {
> double secs = tv.seconds * 1000000. + tv.microseconds;
> return secs * opt_clk_tck / 1000000.;
> --
> 2.39.1
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.