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

Sam James sam@gentoo.org
Sun Nov 23 18:32:03 GMT 2025


Osama Abdelkader <osama.abdelkader@gmail.com> writes:

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

I recommend not hurrying to send another vN, we're still waiting on
feedback from rth (or possibly lindholm, who is the new kernel
co-maintainer I've CC'd). It's easier if we can discuss in one thread
rather than across many.

>
> Best regards,
> Osama


More information about the Libc-alpha mailing list