bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH hurd] Improve portability for rpctrace on x86_64


From: Samuel Thibault
Subject: Re: [PATCH hurd] Improve portability for rpctrace on x86_64
Date: Mon, 24 Apr 2023 22:38:27 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le lun. 24 avril 2023 00:57:53 -0400, a ecrit:
> Defined alignment as __alignof__(uintptr_t) to match MiG.
> 
> Also used char* instead of void* during the message iteration since it's
> more portable as pointer arithmetic on void* is a GNU extension.
> ---
>  utils/rpctrace.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/rpctrace.c b/utils/rpctrace.c
> index c2bc0062..09edc1e8 100644
> --- a/utils/rpctrace.c
> +++ b/utils/rpctrace.c
> @@ -41,6 +41,9 @@
>  
>  #include "msgids.h"
>  
> +/* Should match MiG's desired_complex_alignof */
> +#define MSG_ALIGNMENT __alignof__(uintptr_t)
> +
>  const char *argp_program_version = STANDARD_HURD_VERSION (rpctrace);
>  
>  static unsigned strsize = 80;
> @@ -807,7 +810,7 @@ print_contents (mach_msg_header_t *inp,
>    int first = 1;
>  
>    /* Process the message data, wrapping ports and printing data.  */
> -  while (msg_buf_ptr < (void *) inp + inp->msgh_size)
> +  while (msg_buf_ptr < (char *) inp + inp->msgh_size)
>      {
>        mach_msg_type_t *const type = msg_buf_ptr;
>        mach_msg_type_long_t *const lt = (void *) type;
> @@ -839,8 +842,7 @@ print_contents (mach_msg_header_t *inp,
>         msg_buf_ptr += sizeof (void *);
>       }
>        else
> -     msg_buf_ptr += ((nelt * eltsize + sizeof(natural_t) - 1)
> -                     & ~(sizeof(natural_t) - 1));
> +     msg_buf_ptr += ((nelt * eltsize + MSG_ALIGNMENT - 1) & ~(MSG_ALIGNMENT 
> - 1));
>  
>        if (first)
>       first = 0;
> -- 
> 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]