bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] htl: Make pthread_mutex_t pointer-aligned


From: Samuel Thibault
Subject: Re: [PATCH 3/3] htl: Make pthread_mutex_t pointer-aligned
Date: Mon, 27 Feb 2023 23:06:30 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Sergey Bugaev via Libc-alpha, le mar. 14 févr. 2023 20:37:22 +0300, a ecrit:
> This is for future-proofing. On i386, it is 4-byte aligned anyway, but
> on x86_64, we want it 8-byte aligned, not 4-byte aligned.
> 
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  .../hurd/htl/bits/types/struct___pthread_mutex.h    | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h 
> b/sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h
> index d7b239f4..11caa870 100644
> --- a/sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h
> +++ b/sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h
> @@ -30,20 +30,23 @@ struct __pthread_mutex
>    int __shpid;
>    int __type;
>    int __flags;
> -  unsigned int __reserved1;
> -  unsigned int __reserved2;
> +  union
> +  {
> +    unsigned int __reserved[2];
> +    void *__pointer_aligned;
> +  };
>  };
>  
>  /* Static mutex initializers. */
>  #define __PTHREAD_MUTEX_INITIALIZER   \
> -  { 0, 0, 0, 0, __PTHREAD_MUTEX_TIMED, 0, 0, 0 }
> +  { 0, 0, 0, 0, __PTHREAD_MUTEX_TIMED, 0, { { 0, 0 } } }
>  
>  /* The +1 is to mantain binary compatibility with the old
>   * libpthread implementation. */
>  #define __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER   \
> -  { 0, 0, 0, 0, __PTHREAD_MUTEX_ERRORCHECK + 1, 0, 0, 0 }
> +  { 0, 0, 0, 0, __PTHREAD_MUTEX_ERRORCHECK + 1, 0, { { 0, 0 } } }
>  
>  #define __PTHREAD_RECURSIVE_MUTEX_INITIALIZER   \
> -  { 0, 0, 0, 0, __PTHREAD_MUTEX_RECURSIVE + 1, 0, 0, 0 }
> +  { 0, 0, 0, 0, __PTHREAD_MUTEX_RECURSIVE + 1, 0, { { 0, 0 } } }
>  
>  #endif /* bits/types/struct___pthread_mutex.h */
> -- 
> 2.39.1
> 

-- 
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]