[PATCH] Fix POSIX compliance: Make blkcnt_t and blksize_t signed on alpha
Collin Funk
collin.funk1@gmail.com
Sat Nov 22 21:08:24 GMT 2025
Hi Osama,
Osama Abdelkader <osama.abdelkader@gmail.com> writes:
> POSIX requires that blkcnt_t and blksize_t are signed integer types.
> On alpha, these were incorrectly defined as unsigned types (__U32_TYPE).
> This change makes them signed (__SLONGWORD_TYPE) to match:
> - POSIX requirements
> - All other architectures in glibc
> - Similar types on alpha (off_t, clock_t, time_t)
>
> Fixes #33355
>
> Suggested-by: Collin Funk <collin.funk@gmail.com>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
> sysdeps/unix/sysv/linux/alpha/bits/typesizes.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
> index 8cc4491c0b..2682dfc83f 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
> @@ -38,7 +38,7 @@
> #define __PID_T_TYPE __S32_TYPE
> #define __RLIM_T_TYPE __ULONGWORD_TYPE
> #define __RLIM64_T_TYPE __U64_TYPE
> -#define __BLKCNT_T_TYPE __U32_TYPE
> +#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
> #define __BLKCNT64_T_TYPE __U64_TYPE
> #define __FSBLKCNT_T_TYPE __S32_TYPE
> #define __FSBLKCNT64_T_TYPE __S64_TYPE
> @@ -54,7 +54,7 @@
> #define __KEY_T_TYPE __S32_TYPE
> #define __CLOCKID_T_TYPE __S32_TYPE
> #define __TIMER_T_TYPE void *
> -#define __BLKSIZE_T_TYPE __U32_TYPE
> +#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
> #define __FSID_T_TYPE struct { int __val[2]; }
> #define __SSIZE_T_TYPE __SWORD_TYPE
> #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
Thanks for the patch.
I had something similar written myself, but I wasn't sure if there was a
historical reason for this definition. And I do not have an alpha
machine to test on to make sure things work as expected after the
change.
CC'ing Richard Henderson who is listed as the system maintainer for
alpha in MAINTAINERS [1].
Collin
[1] https://sourceware.org/glibc/wiki/MAINTAINERS#Machine_maintainers
More information about the Libc-alpha
mailing list