[PATCH] Fix POSIX compliance: Make blkcnt_t and blksize_t signed on alpha

Osama Abdelkader osama.abdelkader@gmail.com
Sun Nov 23 14:20:12 GMT 2025


On Sun, Nov 23, 2025 at 01:25:59PM +0100, Florian Weimer wrote:
> * Osama Abdelkader:
> 
> > 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
> 
> Isn't __SLONGWORD_TYPE 64 bit?  So this is a fairly significant ABI
> change.

Yes it is 64-bit.
> 
> Switching to a 32-bit signed type would halve maximum file size,
> though.

OK, let's use __S32_TYPE (32-bit signed) to minimize ABI impact.
You are the experts here, appreciate your feedback.

Best regards,
Osama


More information about the Libc-alpha mailing list