Re: Can we drop upstream Linux x32 support?

From: Linus Torvalds
Date: Fri Dec 14 2018 - 15:13:27 EST


On Fri, Dec 14, 2018 at 10:58 AM Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
> Does anyone know *why* Linuxâs x32 has __kernel_long_t defined as long long?

It *needs* to be long long, since the headers are used for builds in
user mode using ILP32.

Since __kernel_long_t is a 64-bit (the _kernel_ is not ILP32), you
need to use "long long" when building in ILP32.

Obviously, it could be something like

#ifdef __KERNEL__
typedef long __kernel_long_t;
#else
typedef long long __kernel_long_t;
#endif

or similar to make it more obvious what's going on.

Or we could encourage all the uapi header files to always just use
explicit sizing like __u64, but some of the structures really end up
being "kernel long size" for sad historical reasons. Not lovely, but
there we are..

Linus