Re: [PATCH] uapi: Make __{u,s}64 match {u,}int64_t in userspace
From: Arnd Bergmann
Date: Mon Nov 22 2021 - 15:49:07 EST
On Mon, Nov 22, 2021 at 5:43 PM Cyril Hrubis <chrubis@xxxxxxx> wrote:
>
> +
> +#include <asm/bitsperlong.h>
> +
> /*
> - * int-ll64 is used everywhere now.
> + * int-ll64 is used everywhere in kernel now.
> */
> -#include <asm-generic/int-ll64.h>
> +#if __BITS_PER_LONG == 64 && !defined(__KERNEL__)
> +# include <asm-generic/int-l64.h>
> +#else
> +# include <asm-generic/int-ll64.h>
> +#endif
I don't think this is correct on all 64-bit architectures, as far as I
remember the
definition can use either 'long' or 'long long' depending on the user space
toolchain.
Out of the ten supported 64-bit architectures, there are four that already
use asm-generic/int-l64.h conditionally, and six that don't, and I
think at least
some of those are intentional.
I think it would be safer to do this one architecture at a time to make
sure this doesn't regress on those that require the int-ll64.h version.
There should also be a check for __SANE_USERSPACE_TYPES__
to let userspace ask for the ll64 version everywhere.
Arnd